Asystent AI
Pomoc przy skrypcie...
 
Powiadomienia
Wyczyść wszystko

Pomoc Pomoc przy skrypcie dzVents

8 Wpisów
2 Użytkownicy
0 Reactions
3,019 Wyświetleń
(@pit_h)
Wpisów: 23
Praktykant
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 
[#2303]

Witam, mam problem ze skryptem. Załącza światła prawidłowo, ale niestety nie wyłącza ich. Jak rozdzielę go na dwa osobne skrypty, czyli poniżej Lux i powyżej Lux, wtedy wyłącza.

return {
 on = {
       timer = { 'at 6:30-7:10',
           'at 16:30-23:30' }
    },

	logging = 
	
    {
        level = domoticz.LOG_INFO,ERROR, 
    },
  execute = function(dz, device)
 
    local Light = dz.groups('OutsideLight' )
    local Lux = dz.devices('Luxmeter')
    local LUX = Lux.lux
       if (LUX <= 5) then
       if (Light.state == 'Off') then
        Light.switchOn()
        elseif (LUX >= 5) then
       if (Light.state == 'On') then
        Light.switchOff()
       end
       end
    end
end 
}

 
Dodane : 22/03/2021 12:45 pm
isom
 isom
(@isom)
Wpisów: 5319
Szef wszystkich szefów Moderator Zasłużony dla Forum, Donator 2K19, Donator 2K20
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@pit_h zobacz to 

return {
 on = {
       timer = { 'at 6:30-7:10', 'at 16:30-23:30' }

	},
		logging =   
    {
        level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
        marker = 'Grupa oświetlenie +lux',
    },
		execute = function(dz,item)
		local group = dz.groups('Grupa_lampy')    
		local Lux = dz.devices('Czujnik lux')
		local LUX = Lux.lux
		
		if group.state == 'Off' and LUX <= 5 then 
		    group.switchOn()
		elseif  group.state == 'On' and LUX > 5 then    
	        group.switchOff()
	 end
end
} 

 
Dodane : 22/03/2021 10:20 pm
(@pit_h)
Wpisów: 23
Praktykant
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@isom Dziękuję, jak do tej pory światło się nie załączyło (lux powyżej 5), czyli działa narazie zgodnie z założeniami.

Światła włączyły się prawidłowo, jeszcze raz dziękuję. A czy jest może możliwość wyłączenia świateł na koniec timera, żeby wszystko było w jednym skrypcie? W tej chwili mam drugi skrypt do wyłączania świateł. 


 
Dodane : 23/03/2021 4:20 pm
(@pit_h)
Wpisów: 23
Praktykant
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@isom Jeszcze jedna sprawa. Czy można dodać do skryptu opcję wyłączania świateł na koniec, czyli o 23:30 i 7:10 (jeśli są włączone), bo teraz mam to w osobnym skrypcie. No i czy prawidłowo będzie wyglądać skrypt nie pod grupę, a pod konkretną lampę:

return {
 on = {
       timer = { 'at 6:30-7:10', 'at 16:30-23:30' }

	},
		logging =   
    {
        level = domoticz.LOG_DEBUG, -- set to LOG_ERROR when tested and OK
        marker = 'Oświetlenie +lux',
    },
		execute = function(dz,item)
		local Light = dz.devices('Nazwa_Lampy')    
		local Lux = dz.devices('Czujnik lux')
		local LUX = Lux.lux
		
		if Light.state == 'Off' and LUX <= 5 then 
		    Light.switchOn()
		elseif  Light.state == 'On' and LUX > 5 then    
	        Light.switchOff()
	 end
end
} 

 
Dodane : 02/04/2021 8:19 pm
isom
 isom
(@isom)
Wpisów: 5319
Szef wszystkich szefów Moderator Zasłużony dla Forum, Donator 2K19, Donator 2K20
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@pit_h skrypt pod lampę jest OK . Jak chcesz dodać sztywną godzinę wyłączenia to trzeba trochę przebudować skrypt . Masz tu przykład gdzie połączyłem lampę , grupę i wyłączenie na sztywno o wyznaczonej godzinie . Wystarczy dołożyć godziny popołudniowo - wieczorne  i drugą godzinę wyłączenia

return 
{
    on = 
    { timer = {'between 6:30 and 7:10','at 7:11'},
        devices = {'Czujnik Lux'}
    },

   execute = function(dz, item)
        local lampa = dz.devices('Nazwa lampy')
        local grupa = dz.groups(' Nazwa Grupy')
        local Lux = dz.devices('Czujnik Lux')
		local LUX = Lux.lux
		
	    if dz.time.matchesRule('between 6:30 and 7:10') and LUX < 5 then     
             lampa.switchOn().checkFirst()
			 grupa.switchOn().checkFirst()
         end
        if dz.time.matchesRule('between 6:30 and 7:10') and LUX > 5 then 
            lampa.switchOff().checkFirst()
			grupa.switchOff().checkFirst()
              end
        if dz.time.matchesRule('at 7:11') then
             lampa.switchOff().checkFirst()
			 grupa.switchOff().checkFirst()
       
        end
end
}


 
Dodane : 02/04/2021 10:49 pm
(@pit_h)
Wpisów: 23
Praktykant
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

@isom Dziękuję za pomoc. Czyli skrypt dla jednej lampy i dwóch czasów powinien wyglądać tak:

return 
{
    on = 
    { timer = {'between 6:30 and 7:09','at 7:10','between 16:30 and 23:29','at 23:30'},
        devices = {'Luxmeter'}
    },

   execute = function(dz, item)
        local lampa = dz.devices('Elewacja')
--        local grupa = dz.groups(' Nazwa Grupy')
        local Lux = dz.devices('Luxmeter')
		local LUX = Lux.lux
		
	    if dz.time.matchesRule('between 6:30 and 7:09','between 16:30 and 23:29') and LUX < 2 then     
             lampa.switchOn().checkFirst()
--			 grupa.switchOn().checkFirst()
         end
        if dz.time.matchesRule('between 6:30 and 7:09','between 16:30 and 23:29') and LUX > 2 then 
            lampa.switchOff().checkFirst()
--			grupa.switchOff().checkFirst()
              end
        if dz.time.matchesRule('at 7:10','at 23:30') then
             lampa.switchOff().checkFirst()
--			 grupa.switchOff().checkFirst()       

        end

end
}

 

czy tak:

 

return 
{
    on = 
    { timer = {'between 6:30 and 7:09','at 7:10','between 16:30 and 23:29','at 23:30'},
        devices = {'Luxmeter'}
    },

   execute = function(dz, item)
        local lampa = dz.devices('Elewacja')
--        local grupa = dz.groups(' Nazwa Grupy')
        local Lux = dz.devices('Luxmeter')
		local LUX = Lux.lux
		
	    if dz.time.matchesRule('between 6:30 and 7:09') and LUX < 2 then     
             lampa.switchOn().checkFirst()
--			 grupa.switchOn().checkFirst()
         end
        if dz.time.matchesRule('between 6:30 and 7:09') and LUX > 2 then 
            lampa.switchOff().checkFirst()
--			grupa.switchOff().checkFirst()
              end
        if dz.time.matchesRule('at 7:10') then
             lampa.switchOff().checkFirst()
--			 grupa.switchOff().checkFirst()       
        end
	    if dz.time.matchesRule('between 16:30 and 23:29') and LUX < 2 then     
             lampa.switchOn().checkFirst()
--			 grupa.switchOn().checkFirst()
         end
        if dz.time.matchesRule('between 16:30 and 23:29') and LUX > 2 then 
            lampa.switchOff().checkFirst()
--			grupa.switchOff().checkFirst()
              end
        if dz.time.matchesRule('at 23:30') then
             lampa.switchOff().checkFirst()
--			 grupa.switchOff().checkFirst()
       
        end

end
}

 
Dodane : 03/04/2021 2:44 pm
isom
 isom
(@isom)
Wpisów: 5319
Szef wszystkich szefów Moderator Zasłużony dla Forum, Donator 2K19, Donator 2K20
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Zdecydowanie wersja 2


 
Dodane : 03/04/2021 5:47 pm
(@pit_h)
Wpisów: 23
Praktykant
Autor tematu
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Ok. Dzięki wielkie.


 
Dodane : 03/04/2021 5:56 pm
Udostępnij: