• 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 fails with ping state
#1
In pilight 7.0 on RPi when using following device:

Code:
        "cellphone": {
            "protocol": [ "ping" ],
            "id": [{
                "ip": "abc.xyz.xyz.xyz"
            }],
            "state": "disconnected",
            "poll-interval": 60
        },

with the following rule

Code:
        "sleepplugs": {
            "rule": "IF (  ( cellphone.state IS disconnected) AND (CurrentDateTime.hour == 9 AND CurrentDateTime.minute == 14 AND CurrentDateTime.second == 0) ) THEN switch DEVICE plug2 AND plug3 TO up",
        "active": 0}


I get the following error:

Code:
[Jun 09 10:02:54:980489] pilight-daemon: ERROR: rule #2 invalid: operator "cellphone.state" does not exist
[Jun 09 10:02:54:980664] pilight-daemon: INFO: rule #2 was parsed until: ... ( ( cellphone.state IS disconnected) AND (CurrentDateTime.hour == 9 AND CurrentDateTime.minute == 14 AND CurrentDateTime.second == 0) ) THEN switch $
[Jun 09 10:02:54:980797] pilight-daemon: INFO: rule #2 sleepplugs was parsed in 0.000167 seconds

How do I use the ping-state in a rule correctly?
 
Reply
#2
!. Try removing all unnecessary brackets and spaces
2. Set "active" to 1 if you want the rule to be executed


Code:
"sleepplugs": {
            "rule": "IF cellphone.state IS disconnected AND CurrentDateTime.hour == 9 AND CurrentDateTime.minute == 14 AND CurrentDateTime.second == 0 THEN switch DEVICE plug2 AND plug3 TO up",
        "active": 1}

3. You didn't post the device config of plug2 and plug3, but looking at your rule, they must be screen devices, are they?
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  pilight fails starting on boot Alex 5 486 06-09-2019, 06:02 PM
Last Post: curlymo
  GPIO input -> starting a rule scootermacro 1 136 06-09-2019, 07:40 AM
Last Post: curlymo
  Compile with Optimization fails / timedate missing fourty2 6 348 04-29-2019, 12:27 PM
Last Post: fourty2
  Set color of label from rule Ulrich.Arnold 2 492 03-11-2018, 01:15 PM
Last Post: Ulrich.Arnold
  pilight dont save state Lloyd Smallwood 0 459 09-12-2017, 05:34 PM
Last Post: Lloyd Smallwood
  pilight rule does not execute pinu 1 836 06-09-2017, 10:01 AM
Last Post: Niek
  Problem with a Switch rule viper2035 2 1,240 01-12-2017, 04:33 PM
Last Post: viper2035
  Rule reset status hazzard 42 10,966 03-20-2016, 07:50 PM
Last Post: jowe2460
  rule with suneset and datetime gets an error Rschnauzer 1 1,013 02-02-2016, 04:36 PM
Last Post: Niek
  new install fails - dev/nightly gneandr 11 8,921 01-29-2016, 11:30 AM
Last Post: WEBcast

Forum Jump:


Browsing: 1 Guest(s)