• 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
Can't switch Relay device by rules: Error switch.lua:77
Dear all,
after installing v8.1.2 I get trouble with switching devices via rules (see below Timer1, which have worked with v8.0.x, but if I use Timer2 (a different device), the rule will work).

I have already changed the new syntax, but I get following error message by using "pilight-daemon -D":
pilight-daemon: ERROR: /usr/local/lib/pilight/actions/switch.lua:77: device "gartenbewaesserung_relay1" can't be set to state "off"

Here  an extraction from my config:
"devices": {
                "gartenbewaesserung_relay1": {
                        "uuid": "0000-b8-27-eb-decaf1",
                        "protocol": [ "relay" ],
                        "id": [{
                                "gpio": 26
                        "state": "on"

               "Brennenstuhl_C": {
                        "protocol": [ "elro_800_switch" ],
                        "id": [{
                                "systemcode": 23,
                                "unitcode": 4
                        "state": "off"

"rules": {
                "Timer1“: {
                        "rule": "IF (gartenbewaesserung_relay1.state == on) THEN switch DEVICE gartenbewaesserung_relay1 TO off AFTER '15 MINUTE'",
                        "active": 1
                "Timer2“: {
                        "rule": "IF (gartenbewaesserung_relay1.state == on) THEN switch DEVICE Brennenstuhl_C TO off AFTER '15 MINUTE'",
                        "active": 1

"gui": { "gartenbewaesserung_relay1": {
                        "name": "Kirschlorbeeren 15min",
                        "group": [ "Bewässerung" ],
                        "media": [ "all" ],
                        "confirm": 0
Unfortunately I find no wrong setting.

In advance: thanks for support and great tool....

Added information/question:
The device with the error is on a second Raspberry, which a previous version of pilight.
Could this be the issue? Most all pilight instances have the some pilight version?

  1. Please start with editing your post using code tags.
  2. Yes, both instances must have the same pilight version.
Both instances have the same pilight version 8.1.2, but the device with protocol Relay makes trouble by using rules. With buttons in the GUI it is possible to switch on / off this device, but the rules still make trouble  as mentioned below:
ERROR: /usr/local/lib/pilight/actions/switch.lua:77: device "gartenbewaesserung_relay1" can't be set to state "off"
You still didn't edit your initial post to comply with the forum rules (using code tags).

It seems that the lua relay device isn't being installed. I see it is present on github, but it is missing in lua/devices after installation.
@wobbi, can you try the latest nightly?
Now I have this version
and it works!
Thanks for your quick support.
@wobbi, thanks for testing but you still need to fix your post.

Possibly Related Threads...
Thread Author Replies Views Last Post
  [Solved] On and Off for one device in one rule Oliver 3 759 10-28-2019, 06:55 PM
Last Post: Oliver
  Sunset state check parse error dennisvo 6 835 09-27-2019, 08:34 PM
Last Post: curlymo
  skipping overridden action switch do1eh 2 943 01-19-2019, 05:25 PM
Last Post: do1eh
  [8.1.2] variables in rules -> error terrar 1 797 09-14-2018, 05:28 PM
Last Post: curlymo
  Rules wont work bdb 2 1,129 08-12-2018, 06:25 PM
Last Post: bdb
  Rule with&without device. One working not the other... Tamadite 9 1,939 07-24-2018, 08:55 AM
Last Post: curlymo
  Strange behavior of rules currock 4 1,358 06-28-2018, 05:57 PM
Last Post: currock
  Error in Actions with 8.1.0 tomk 1 966 05-30-2018, 06:20 AM
Last Post: curlymo
  feature request: switching rules terrar 7 1,909 05-05-2018, 09:23 PM
Last Post: trader23
  Send on command when switch is already "on" joshovki 1 786 01-28-2018, 11:27 PM
Last Post: curlymo

Forum Jump:

Browsing: 1 Guest(s)