The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 895 - File: showthread.php PHP 7.3.14-1~deb10u1 (Linux)
File Line Function
/showthread.php 895 errorHandler->error



  • 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
Sunset state check parse error
#1
Dear all,

I'm a long time and very happy user of pilight. pilight was working like a charm for many years, managing the lights in my house. It runs on a Raspberry Pi, until the SD card stopped working recently. I've now replaced the SD card and re-installed the latest version of pilight . I had to fix some minor rules, but surprisingly this wasn't that much work. There is one rule though that refuses to work in version 8, which worked fine in version 5.

Whenever I want to test if the sun has status 'set' or 'rise' in a rule, the parser throws an error and refuses to start pilight:

Code:
(/home/pilight/source/daemon-dev/libs/pilight/events/events.c #285) [Sep 21 17:09:17:376111] ERROR:
... sunrisesetdevice.sun IS set AND currentdatetime.second ...
                            ^ unexpected symbol, expected a condition

The rule looks as follows:

Code:
"rules": {
   "opstaan": {
       "rule": "IF sunrisesetdevice.sun IS set AND currentdatetime.second == 0 AND currentdatetime.minute == 30 AND currentdatetime.hour == 7 AND currentdatetime.weekday != 1 AND currentdatetime.weekday != 7 THEN switch DEVICE front TO on",
       "active": 1
    }
},

When I remove the rule, it starts fine. 

Below you can find my config (the essential part of it). Who knows what I'm doing wrong here? I've looked everywhere and spent hours, but can't find a solution that works. It used to work in an old version of pilight.

Thanks in advance for your help and ideas!

Kind regards,

Dennis.

Code:
{
  "devices": {
      "currentdatetime": {
          "protocol": [ "datetime" ],
          "id": [{
              "longitude": 1.2345,
              "latitude": 12.3456
          }],
          "year": 2019,
          "month": 9,
          "day": 21,
          "hour": 18,
          "minute": 50,
          "second": 19,
          "weekday": 7,
          "dst": 0
      },
      "sunrisesetdevice": {
          "protocol": [ "sunriseset" ],
          "id": [{
               "longitude": 1.2345,
               "latitude": 12.34567
          }],
          "sunrise": 7.55,
          "sunset": 17.55,
          "sun": "rise"
      },
      "front": {
          "protocol": [ "kaku_switch" ],
          "id": [{
               "id": 1234567,
               "unit": 0
          }],
          "state": "off"
      },
   },
   "rules": {
      "opstaan": {
          "rule": "IF sunrisesetdevice.sun IS set AND currentdatetime.second == 0 AND currentdatetime.minute == 30 AND currentdatetime.hour == 7 AND currentdatetime.weekday != 1 AND currentdatetime.weekday != 7 THEN switch DEVICE front TO on",
          "active": 1
      }
   },
   "gui": {},
   "settings": {
      "log-level": 6,
      "pid-file": "/var/run/pilight.pid",
      "log-file": "/var/log/pilight.log",
      "webserver-enable": 0,
      "gpio-platform": "raspberrypi2",
   },
   "hardware": {
      "433gpio": {
          "sender": 0,
          "receiver": 1
      }
   },
   "registry": {
      "pilight": {
          "version": {
              "current": "8.1.5"
          }
      }
   }
}
 
Reply
  


Messages In This Thread
Sunset state check parse error - by dennisvo - 09-21-2019, 06:21 PM
RE: Sunset state check parse error - by curlymo - 09-21-2019, 06:51 PM
RE: Sunset state check parse error - by dennisvo - 09-22-2019, 12:46 AM
Sunset state check parse error - by curlymo - 09-22-2019, 08:09 AM
RE: Sunset state check parse error - by dennisvo - 09-22-2019, 12:41 PM
RE: Sunset state check parse error - by curlymo - 09-22-2019, 02:09 PM
RE: Sunset state check parse error - by curlymo - 09-27-2019, 08:34 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  [solved] sunset rule doesn't work fleisch 5 1,498 08-29-2020, 05:23 AM
Last Post: CharlesRhymn
  [8.1.2] variables in rules -> error terrar 1 1,010 09-14-2018, 05:28 PM
Last Post: curlymo
  Can't switch Relay device by rules: Error switch.lua:77 wobbi 6 2,072 07-31-2018, 06:25 AM
Last Post: curlymo
  Program can't be set to state running Gisto 7 2,277 07-17-2018, 12:51 PM
Last Post: Gisto
  Error in Actions with 8.1.0 tomk 1 1,154 05-30-2018, 06:20 AM
Last Post: curlymo
  Rule Sunset works, Sunrise not apartmedia 1 1,690 12-05-2017, 07:09 PM
Last Post: apartmedia
  Always trigger event on any device state Phil 8 3,738 03-22-2017, 07:30 PM
Last Post: Phil
  ERROR: rule #21 invalid: variable "label" of device "WindMax" cannot be used in even koos147 2 2,467 04-02-2016, 10:24 PM
Last Post: koos147
  Difference switching device or state droptix 3 2,739 10-29-2015, 05:52 PM
Last Post: terrar
Question [SOLVED] - How to switch a device 15 minutes after sunset with newest nightly Seebueb 8 5,754 08-02-2015, 11:03 AM
Last Post: curatio

Forum Jump:


Browsing: 1 Guest(s)