• 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
  Rule triggers twice Thorben653 13 2,020 02-05-2020, 01:06 PM
Last Post: VicktorKopf
  Exclude Weekend from a rule PT-Biker 1 573 12-08-2019, 10:22 AM
Last Post: curlymo
  [Solved] On and Off for one device in one rule Oliver 3 657 10-28-2019, 06:55 PM
Last Post: Oliver
  [solved] sunset rule doesn't work fleisch 4 671 10-26-2019, 07:05 AM
Last Post: fleisch
  Sunset state check parse error dennisvo 6 738 09-27-2019, 08:34 PM
Last Post: curlymo
  Rule with&without device. One working not the other... Tamadite 9 1,740 07-24-2018, 08:55 AM
Last Post: curlymo
  rule executed once at start up segalion 3 917 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem with executing bash script via rule/program dYna 1 1,214 02-15-2018, 09:06 PM
Last Post: dYna
  Problem with a Rule for a One Button Switch martin-dj 1 1,503 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 1,099 02-25-2017, 10:43 PM
Last Post: curlymo

Forum Jump:


Browsing: 1 Guest(s)