Page 1 of 1

More options to trigger devices

Posted: Wednesday 18 November 2020 21:03
by alexkoel
It would be great if it was possible to trigger a device on a status or value of another device.
e.g. Blinds closes when the sun sensor is above a specific value, bathroom fan activates when humidity reaches a certain level, spot on the driveway activates when PIR senses moving during the night, etc.

I know you can do a lot with scripting, but I found out that the most easy one (dzvents) has his strange behaviors. It is also not userfriendly for people who are not familiar with scripting.

Re: More options to trigger devices

Posted: Wednesday 18 November 2020 21:59
by waaren
alexkoel wrote: Wednesday 18 November 2020 21:03 but I found out that the most easy one (dzvents) has his strange behaviors.
Can you please elaborate on what you call "strange behaviors"
I might be able to explain / clarify.

Re: More options to trigger devices

Posted: Wednesday 18 November 2020 23:17
by alexkoel
I copied a very simple script and adjust it to my needs. It switched a light on when temerature was below 14 degrees. It worked. I changed the light to a blind and I received "attempt to call a nil value (field 'SwitchOff'". I changed switchoff() to close(), same result. I changed back to the light. Fault persists. I wasn't able to make the script working.
Not working script below:

Code: Select all

return {
   on = {
       timer = { 'every minute'  } },
      
   execute = function(domoticz)
      local Sensor = domoticz.devices('Temp Druiven')
      if Sensor.temperature < 14 then
         domoticz.devices('SWD Staande lamp TV').SwitchOff()
      end
   end
}

Re: More options to trigger devices

Posted: Wednesday 18 November 2020 23:33
by waaren
alexkoel wrote: Wednesday 18 November 2020 23:17 I copied a very simple script and adjust it to my needs. It switched a light on when temerature was below 14 degrees. It worked. I changed the light to a blind and I received "attempt to call a nil value (field 'SwitchOff'". I changed switchoff() to close(), same result. I changed back to the light. Fault persists. I wasn't able to make the script working.
Case matters...

The method SwitchOff() does not exist. Try again and use switchOff()