• 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
Example on doc fails
#1
The following devices and rules configuration is a verbatim copy of the example found under "Docs / Eventing / Examples / Time based":
Code:
{
       "devices": {
               "currentdatetime": {
                       "protocol": [ "datetime" ],
                       "id": [{
                               "longitude": 1.2345,
                               "latitude": 12.3456
                       }],
                       "year": 2018,
                       "month": 7,
                       "day": 30,
                       "hour": 22,
                       "minute": 3,
                       "second": 20,
                       "weekday": 2,
                       "dst": 0
               },
               "outsidelight": {
                       "protocol": [ "kaku_switch" ],
                       "id": [{
                               "id": 123456,
                               "unit": 0
                       }],
                       "state": "off"
               }
       },
       "rules": {
               "christmass-tree-off": {
                       "rule": "IF DATE_FORMAT(currentdatetime, %H.%M%S) == 23.0000 THEN switch DEVICE outsidelight TO on AFTER RANDOM(0, 90) . ' MINUTE' FOR RANDOM(5, 15) . ' MINUTE'",
                       "active": 1
               }
       },
       "gui": {},
       "settings": {
               "log-level": 6,
               "pid-file": "/var/run/pilight.pid",
               "log-file": "/var/log/pilight.log",
               "webserver-enable": 1,
               "webserver-root": "/usr/local/share/pilight/webgui",
               "webserver-http-port": 5001,
               "webserver-https-port": 5002,
               "webserver-cache": 1,
               "gpio-platform": "raspberrypi2",
               "port": 5000
       },
       "hardware": {
               "433gpio": {
                       "sender": 0,
                       "receiver": 1
               }
       },
       "registry": {
               "webserver": {
                       "ssl": {
                               "certificate": {
                                       "secure": 0,
                                       "location": "/etc/pilight/pilight.pem"
                               }
                       }
               },
               "pilight": {
                       "version": {
                               "current": "8.1.2"
                       }
               }
       }
}
 
It seems it fails on the rules section because of the "23.0000".
 
Reply
#2
Can you post the output of the actual error?
 
Reply
#3
(07-31-2018, 06:26 AM)curlymo Wrote: Can you post the output of the actual error?

Code:
● pilight.service - pilight
  Loaded: loaded (/etc/systemd/system/pilight.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Tue 2018-07-31 09:17:12 CEST; 1min 54s ago
 Process: 32674 ExecStart=/usr/local/sbin/pilight-daemon (code=exited, status=1/FAILURE)
Main PID: 29174 (code=exited, status=0/SUCCESS)

Jul 31 09:17:12 rpihass systemd[1]: Starting pilight...
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Control process exited, code=exited status=1
Jul 31 09:17:12 rpihass systemd[1]: Failed to start pilight.
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Unit entered failed state.
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Failed with result 'exit-code'.


Code:
Jul 31 09:17:11 rpihass sudo[32646]:       pi : TTY=pts/0 ; PWD=/etc/pilight ; USER=root ; COMMAND=/usr/sbin/service pilight start
Jul 31 09:17:11 rpihass sudo[32646]: pam_unix(sudo:session): session opened for user root by pi(uid=0)
Jul 31 09:17:12 rpihass systemd[1]: Starting pilight...
-- Subject: Unit pilight.service has begun start-up
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit pilight.service has begun starting up.
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Control process exited, code=exited status=1
Jul 31 09:17:12 rpihass systemd[1]: Failed to start pilight.
-- Subject: Unit pilight.service has failed
-- Defined-By: systemd
-- Support: https://www.debian.org/support
--
-- Unit pilight.service has failed.
--
-- The result is failed.
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Unit entered failed state.
Jul 31 09:17:12 rpihass systemd[1]: pilight.service: Failed with result 'exit-code'.
Jul 31 09:17:12 rpihass sudo[32646]: pam_unix(sudo:session): session closed for user root

Just for your information, the configuration gets passed correctly if I remove the dot that is:

Code:
IF DATE_FORMAT(currentdatetime, %H.%M%S) == 230000 ...
 
Reply
#4
That not pilight debugging output but systemd output. Please check the manual about how to get pilight debugging output.
 
Reply
#5
(07-31-2018, 05:26 PM)curlymo Wrote: That not pilight debugging output but systemd output. Please check the manual about how to get pilight debugging output.

Code:
[ Jul 31 21:09:35:38971] pilight-daemon: DEBUG: loaded event action /usr/local/lib/pilight/actions/sendmail.lua v4.1
[ Jul 31 21:09:35:43032] pilight-daemon: ERROR:
... %H.%M%S) == 23.0000 THEN switch DEVICE outsidelight TO on AFTER RANDOM(0, ...
                       ^ unexpected symbol, expected a condition
[ Jul 31 21:09:35:43163] pilight-daemon: INFO: rule #1 christmass-tree-off was parsed in 0.003324 seconds
 
Reply
#6
There you go. Check my updated example. It was indeed wrong.
 
Reply
  


Forum Jump:


Browsing: 1 Guest(s)