Page 1 of 1

Request Help for Script with Times

Posted: Monday 01 July 2019 11:10
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

Re: Request Help for Script with Times

Posted: Monday 01 July 2019 13:22
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")

Re: Request Help for Script with Times

Posted: Thursday 11 July 2019 9:00
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?

Re: Request Help for Script with Times  [Solved]

Posted: Saturday 13 July 2019 11:19
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
}