Request Help for Script with Times  [Solved]

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

Moderator: leecollings

Post Reply
mastadook
Posts: 58
Joined: Wednesday 18 April 2018 13:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Deutschland
Contact:

Request Help for Script with Times

Post by mastadook »

Hi Guys,

I like to request help from you regarding my Script for Shutters:

Code: Select all

return {
   on = {timer = {"every 10 Minutes between 08:30 and 19:30"}},
   execute = function(domoticz, timer)
      if domoticz.devices('Lichtstärke Ostseite').lux > 800 and domoticz.devices('Sensor Ostseite').temperature > 20 and domoticz.devices('Rolladen 01').level <= 60 then
         domoticz.devices('Rolladen 01').switchSelector(60)
      elseif domoticz.devices('Sensor Ostseite').temperature > 25 and domoticz.devices('Rolladen Nassia').level <= 60 then
         domoticz.devices('Rolladen 01').switchSelector(60)
      elseif [b](domoticz.time.hour > 10 or domoticz.time.hour < 14) and domoticz.devices('Sensor Ostseite').temperature > 30 and domoticz.devices('Rolladen 01').level <= 80 then
         domoticz.devices('Rolladen 01).switchSelector(80)    [/b] 
      end
end
}
The Problem is, that all wents fine except the Part with Time from 10-14.
If it is between 10-14 and very warm shut down to 80%

Is it possible or did I try something impossible?

regards
Clemens
________________________________________________________________________
global chief of permanent lightning and strike detonator
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Request Help for Script with Times

Post by waaren »

mastadook wrote: Monday 01 July 2019 11:10 I like to request help from you regarding my Script for Shutters:

Code: Select all

      elseif (domoticz.time.hour > 10 or domoticz.time.hour < 14) then
Should be possible but please note that (time > 10 or time < 14) will always evaluate to true
Please also have a look at the dzVents wiki (search for "matchesRule")
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
mastadook
Posts: 58
Joined: Wednesday 18 April 2018 13:03
Target OS: Raspberry Pi / ODroid
Domoticz version: 2022.1
Location: Deutschland
Contact:

Re: Request Help for Script with Times

Post by mastadook »

Thank you Waaren, works now for me.

I have another Question but I did not find it in Forum or Wiki.

I like to have another Switch (Scene or Dummy switch) with which I can control the Scripts
and prevent it from running when I´m at home and don´t like to automation...

Code: Select all

return {
   on = {
       timer = {"every 10 Minutes between 08:30 and 19:30"}},
   execute = function(domoticz, timer)
      if domoticz.devices('Lichtstärke Ostseite').lux < 400 and domoticz.devices('Sensor Ostseite').temperature < 30 and domoticz.devices('Rolladen 01').level >= 40 then
         domoticz.devices('Rolladen 01').switchSelector(0)
      end
   end
}
Now I like to add a Masterswitch so to say, disable or enable this Script. Is it possible?
I just found to enter a Switch in the ON Section but this is an OR Option. I need a Master Off

Any Idea?
________________________________________________________________________
global chief of permanent lightning and strike detonator
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Request Help for Script with Times  [Solved]

Post by waaren »

mastadook wrote: Thursday 11 July 2019 9:00 I like to have another Switch (Scene or Dummy switch) with which I can control the Scripts
and prevent it from running when I´m at home and don´t like to automation...
Try this.

Code: Select all

return {
      active = function(domoticz)
                     return domoticz.devices('Masterswitch').active
            end,

   on = {
       timer = {"every 10 Minutes between 08:30 and 19:30"}},
   execute = function(domoticz, timer)
      if domoticz.devices('Lichtstärke Ostseite').lux < 400 and domoticz.devices('Sensor Ostseite').temperature < 30 and domoticz.devices('Rolladen 01').level >= 40 then
         domoticz.devices('Rolladen 01').switchSelector(0)
      end
   end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest