Devicechanged script not triggered

Moderator: leecollings

Post Reply
Piacco
Posts: 70
Joined: Friday 14 November 2014 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Devicechanged script not triggered

Post by Piacco »

Hello, i have a Itho ventilation system with a remote control en Itho ESP.
When i press a button on my remote control i want to update a selector switch in Domoticz.
To update the selector switch i use a LUA script, only this script won't run, in my devices tab i see that when i press a button on the remote control that Itho_actuele_stand is updated, what do i wrong?

Code: Select all

commandArray = {}
if (devicechanged['Itho_actuele_stand'] == '1.00' and otherdevices['Ihto Ventilatie'] ~= 'Low') then
commandArray['UpdateDevice'] = '290|10|10'
elseif (devicechanged['Itho_actuele_stand'] == '2.00' and otherdevices['Ihto Ventilatie'] ~= 'Medium') then
commandArray['UpdateDevice'] = '290|20|20'
elseif (devicechanged['Itho_actuele_stand'] == '3.00' and otherdevices['Ihto Ventilatie'] ~= 'High') then
commandArray['UpdateDevice'] = '290|30|30'
elseif (devicechanged['Itho_actuele_stand'] == '13.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer1') then
commandArray['UpdateDevice'] = '290|40|40'
elseif (devicechanged['Itho_actuele_stand'] == '23.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer2') then
commandArray['UpdateDevice'] = '290|50|50'
elseif (devicechanged['Itho_actuele_stand'] == '33.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer3') then
commandArray['UpdateDevice'] = '290|60|60'
end
return commandArray
SweetPants

Re: Devicechanged script not triggered

Post by SweetPants »

Try to add some print statements so you know if/where your script fails.
Piacco
Posts: 70
Joined: Friday 14 November 2014 9:33
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Devicechanged script not triggered

Post by Piacco »

I have changed the script into:

Code: Select all

return {
	on = {
		devices = {
			'Itho_actuele_stand'
		}
	},
	execute = function(domoticz, device)
	    
if (device['Itho_actuele_stand'] == '1.00' and otherdevices['Ihto Ventilatie'] ~= 'Low') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|10|10'
    elseif (device['Itho_actuele_stand'] == '2.00' and otherdevices['Ihto Ventilatie'] ~= 'Medium') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|20|20'
    elseif (device['Itho_actuele_stand'] == '3.00' and otherdevices['Ihto Ventilatie'] ~= 'High') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|30|30'
    elseif (device['Itho_actuele_stand'] == '13.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer1') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|40|40'
    elseif (device['Itho_actuele_stand'] == '23.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer2') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|50|50'  
    elseif (device['Itho_actuele_stand'] == '33.00' and otherdevices['Ihto Ventilatie'] ~= 'Timer3') then
        domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)
        commandArray['UpdateDevice'] = '290|60|60'
end
return commandArray	
	end
}

Now i can see that the script is triggerd, but the selector switch won't update :( i have (checked the idx of the selector switch)
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Devicechanged script not triggered

Post by HansieNL »

Your nValues and sValues are the same. Have you tried to change the nValue to 1.

Code: Select all

commandArray['UpdateDevice'] = '290|1|10'
Blah blah blah
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest