• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule Sunset works, Sunrise not
#1
I‘m using pilight version v8.0.4 with 2 rules for switching a device before sunrise and after sunset.
For some reason the sunrise rule does not get executed while the sunset does.
Any idea what could be wrong with my rules?

Code:
"sunrise-decolight": {
"rule": "IF (sunrisesetdev.sunrise == DATE_FORMAT(DATE_ADD(datetimedev, -1 HOUR), \"%Y-%m-%d %H:%M:%S\", %H.%M)) AND datetimedev.second == 0 THEN switch DEVICE light_deco_mirror_livingroom TO off",
"active": 1
},
"sunset-decolight": {
"rule": "IF (sunrisesetdev.sunset == DATE_FORMAT(DATE_ADD(datetimedev, +30 MINUTE), \"%Y-%m-%d %H:%M:%S\", %H.%M)) AND datetimedev.second == 0 THEN switch DEVICE light_deco_mirror_livingroom TO on",
"active": 1
}

The log does not show rule sunrise-decolight getting parsed so my lamp stays switched on the whole day.
 
Reply
#2
I tried to change the rule syntax a bit.
I figured out that playing with the hooks (meaning the round brackets) created even more weird results.
If I place the „datetimedev.second == 0“ condition inside the IF brackets as shown in the manual the device starts turning on and off in a second intervall.
The same happens if I omit the brackets around the IF condition completely.

So the following syntax results in a on-off blinking device:

Code:
"sunrise-decolight": {
"rule": "IF (sunrisesetdev.sunrise == DATE_FORMAT(DATE_ADD(datetimedev, -1 HOUR), \"%Y-%m-%d %H:%M:%S\", %H.%M) AND datetimedev.second == 0) THEN switch DEVICE light_deco_mirror_livingroom TO off",
"active": 1
},
"sunset-decolight": {
"rule": "IF (sunrisesetdev.sunset == DATE_FORMAT(DATE_ADD(datetimedev, +30 MINUTE), \"%Y-%m-%d %H:%M:%S\", %H.%M) AND datetimedev.second == 0) THEN switch DEVICE light_deco_mirror_livingroom TO on",
"active": 1

The same for this syntax:

Code:
"sunrise-decolight": {
"rule": "IF sunrisesetdev.sunrise == DATE_FORMAT(DATE_ADD(datetimedev, -1 HOUR), \"%Y-%m-%d %H:%M:%S\", %H.%M) AND datetimedev.second == 0 THEN switch DEVICE light_deco_mirror_livingroom TO off",
"active": 1
},
"sunset-decolight": {
"rule": "IF sunrisesetdev.sunset == DATE_FORMAT(DATE_ADD(datetimedev, +30 MINUTE), \"%Y-%m-%d %H:%M:%S\", %H.%M) AND datetimedev.second == 0 THEN switch DEVICE light_deco_mirror_livingroom TO on",
"active": 1

The curious thing is that these rules did work perfect on latest pilight versions v7.x.x

Any ideas what could be wrong in my technically simple rule would be nice.
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  [solved] sunset rule doesn't work fleisch 5 1,359 08-29-2020, 05:23 AM
Last Post: CharlesRhymn
  Rule triggers twice Thorben653 13 3,154 02-05-2020, 01:06 PM
Last Post: VicktorKopf
  Exclude Weekend from a rule PT-Biker 1 838 12-08-2019, 10:22 AM
Last Post: curlymo
  [Solved] On and Off for one device in one rule Oliver 3 952 10-28-2019, 06:55 PM
Last Post: Oliver
  Sunset state check parse error dennisvo 6 1,147 09-27-2019, 08:34 PM
Last Post: curlymo
  Rule with&without device. One working not the other... Tamadite 9 2,419 07-24-2018, 08:55 AM
Last Post: curlymo
  rule executed once at start up segalion 3 1,211 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 1,557 02-15-2018, 09:06 PM
Last Post: dYna
  Problem with a Rule for a One Button Switch martin-dj 1 1,719 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 1,304 02-25-2017, 10:43 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)