dzVents temperature switch

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

dzVents temperature switch

Post by Remicade »

Hi Forum,
After a lot of reading and trying still strugling to get this dzVents script working.
I use the Omnik script to read the temperature.
This is a Custom Device.
The fan should cool the inverterabove 25 degrees Celcius.

Can somebody please give me a suggestion why the script is faulty?

return {
on = {
timer = 'every minute'
},
execute = function(domoticz)
local Sensor = domoticz.devices( 'Omnik temperature' )
if (Sensor.temperature) >= 25) then
domoticz.devices( 'Omnik Ventilator' ).switchOn()
end
end
}

btw what tochoose by
event name,
dzVents,
???

Thanks Paul
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: dzVents temperature switch

Post by dannybloe »

Try to remove all the ( and ) in your if-statement.

And next time post the errors you get. That helps 😀
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: dzVents temperature switch

Post by EdwinK »

Can you please use the [ code ] and [ /code ] blocks. It will make everything easier to read

Thanks.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: dzVents temperature switch

Post by Remicade »

Hi and thanks for your support.
I will try to make it more readable...... :oops:

Now changed the script as suggested :

Code: Select all

 
return {
   on = {
      timer = 'every minute'
   },
   execute = function(domoticz)
      local Sensor = domoticz.devices('Omnik temperature')
      if Sensor.temperature >= 25 then
         domoticz.devices('Omnik Ventilator').switchOn()
      end
   end
}
Can it be the problem with the Custom Sensor?
Or the fact that "spacebar" is used between Omnik temperature?

Thanks again!
Paul
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents temperature switch

Post by waaren »

Remicade wrote: Thursday 02 August 2018 20:16 I will try to make it more readable...... :oops:
Can it be the problem with the Custom Sensor?
Or the fact that "spacebar" is used between Omnik temperature?

Thanks again!
Paul
Problem is that you forgot a pair of {}
Please find corrected script below.

Code: Select all

 
return {
   on = {       timer = { 'every minute'  } },
      
   execute = function(domoticz)
      local Sensor = domoticz.devices('Omnik temperature')
      if Sensor.temperature >= 25 then
         domoticz.devices('Omnik Ventilator').switchOn()
      end
   end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: dzVents temperature switch

Post by Remicade »

Thanks waaren,
If you three guys think that the script is o.k. but it is still not working....Could it be that my devices are not correct?
I had a typo in the previous script but that seems o.k. now.
Now will try to debug, after finding out how exactly.

Thanks!
Paul
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: dzVents temperature switch

Post by EdwinK »

Sounds so easy :) Was trying to get something like this for a few weeks. Now I've two of these scripts running for the two ventilators I've got, but could those also be combined in one script?
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: dzVents temperature switch

Post by EdwinK »

Remicade wrote: Thursday 02 August 2018 20:56 Thanks waaren,
If you three guys think that the script is o.k. but it is still not working....Could it be that my devices are not correct?
I had a typo in the previous script but that seems o.k. now.
Now will try to debug, after finding out how exactly.

Thanks!
Paul
I have my fan's as on/off switch and the temperature is coming from two temperature devices, not custom sensors.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzVents temperature switch

Post by waaren »

Remicade wrote: Thursday 02 August 2018 20:56 Thanks waaren,
If you three guys think that the script is o.k. but it is still not working....Could it be that my devices are not correct?
I had a typo in the previous script but that seems o.k. now.
Now will try to debug, after finding out how exactly.

Thanks!
Paul
What about looking at the log in the GUI ? [SETUP][LOG][ALL] do you see anything there on every minute :00 ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Remicade
Posts: 26
Joined: Friday 15 September 2017 21:43
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.10717
Location: Netherlands
Contact:

Re: dzVents temperature switch

Post by Remicade »

Hi EdwinK,
That did the trick.
Made a new device, but now Type Temp.
In the Omnik changed IDX.
The script is now running and switching my OmnikVentilator.
Thanks for the help!
Paul
User avatar
EdwinK
Posts: 1820
Joined: Sunday 22 January 2017 21:46
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Rhoon
Contact:

Re: dzVents temperature switch

Post by EdwinK »

i thought this would be working, as the fan in the living room doesn't have to be on at night.

Code: Select all

 return {
   on = {       timer = { 'every minute at daytime'  } },
      
   execute = function(domoticz)
      local Sensor = domoticz.devices('HSKTemp')
      if Sensor.temperature >= 20 then
         domoticz.devices('FAN Huiskamer').switchOn()
      end
   end
}
Same would be for the bedroom fan; but then during night-time. But unfortunately, this doesn't seem to work.
Running latest BETA on a Pi-3 | Toon® Thermostat (rooted) | Hue | Tuya | IKEA tradfri | Dashticz V3 on Lenovo Huawei Tablet | Conbee
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests