• 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
  Compile with Optimization fails / timedate missing fourty2 6 152 04-29-2019, 12:27 PM
Last Post: fourty2
  Set color of label from rule Ulrich.Arnold 2 383 03-11-2018, 01:15 PM
Last Post: Ulrich.Arnold
  pilight dont save state Lloyd Smallwood 0 383 09-12-2017, 05:34 PM
Last Post: Lloyd Smallwood
  pilight rule does not execute pinu 1 731 06-09-2017, 10:01 AM
Last Post: Niek
  Problem with a Switch rule viper2035 2 1,113 01-12-2017, 04:33 PM
Last Post: viper2035
  Rule reset status hazzard 42 10,271 03-20-2016, 07:50 PM
Last Post: jowe2460
  rule with suneset and datetime gets an error Rschnauzer 1 941 02-02-2016, 04:36 PM
Last Post: Niek
  new install fails - dev/nightly gneandr 11 8,395 01-29-2016, 11:30 AM
Last Post: WEBcast
  rule #1 invalid: trying to compare string variable "datetime.hour" to an integer Michel 3 1,131 12-14-2015, 10:11 PM
Last Post: curlymo
  Change state by physical sender RZandvoort 4 1,770 09-24-2015, 07:38 AM
Last Post: pilino1234

Forum Jump:


Browsing: 1 Guest(s)