• 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
Problem with executing bash script via rule/program
#1
I am trying to execute a bash script, when a button on a remote is pressed.
So i set up these devices (the shell scripts themself work fine):
Code:
       "programm_licht": {
           "protocol": [ "program" ],
           "id": [{
               "name": "Licht"
           }],
           "program": "/bin/bash",
           "arguments": "",
           "stop-command": "/home/pi/licht_aus",
           "start-command": "/home/pi/licht_an",
           "state": "stopped",
           "pid": 0
       },
       "switch_licht": {
            "protocol": [ "elro_800_switch" ],
            "id": [{
            "systemcode": 1,
            "unitcode": 2
            }],
            "state": "on"

   },

Theses are the corresponding rules:
Code:
               "rule_licht_an": {
                       "rule": "IF switch_licht.state IS on THEN switch DEVICE programm_licht TO running",
                       "active": 1
               },
               "rule_licht_aus": {
                       "rule": "IF switch_licht.state IS off THEN switch DEVICE programm_licht TO stopped",
                       "active": 1
               }

I can turn the light ON but not OFF (with GUI and the actual remote).
What am i doing wrong?
Thanks!
 
Reply
#2
Ok, i figured out a way to get it working.
Not that clean, but hey, it works...

Devices:
Code:
               "programm_licht_an": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Licht_an"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/licht_an",
                       "state": "stopped",
                       "pid": 0
               },
               "programm_licht_aus": {
                       "protocol": [ "program" ],
                       "id": [{
                               "name": "Licht_aus"
                       }],
                       "program": "",
                       "arguments": "",
                       "stop-command": "",
                       "start-command": "/home/pi/licht_aus",
                       "state": "stopped",
                       "pid": 0
               },
                "switch_licht": {
                        "protocol": [ "elro_800_switch" ],
                        "id": [{
                                "systemcode": 1,
                                "unitcode": 2
                        }],
                        "state": "off"
                }
And the rules:
Code:
               "rule_licht_an": {
                       "rule": "IF switch_licht.state IS on THEN switch DEVICE programm_licht_an TO running",
                       "active": 1
               },
               "rule_licht_aus": {
                       "rule": "IF switch_licht.state IS off THEN switch DEVICE programm_licht_aus TO running",
                       "active": 1
               }
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Rule triggers twice Thorben653 13 915 02-05-2020, 01:06 PM
Last Post: VicktorKopf
  Exclude Weekend from a rule PT-Biker 1 422 12-08-2019, 10:22 AM
Last Post: curlymo
  [Solved] On and Off for one device in one rule Oliver 3 446 10-28-2019, 06:55 PM
Last Post: Oliver
  [solved] sunset rule doesn't work fleisch 4 441 10-26-2019, 07:05 AM
Last Post: fleisch
  Rule with&without device. One working not the other... Tamadite 9 1,388 07-24-2018, 08:55 AM
Last Post: curlymo
  Program can't be set to state running Gisto 7 1,288 07-17-2018, 12:51 PM
Last Post: Gisto
  rule executed once at start up segalion 3 748 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem FOR Alex 5 1,139 05-18-2018, 01:21 PM
Last Post: curlymo
  Rule Sunset works, Sunrise not apartmedia 1 1,189 12-05-2017, 07:09 PM
Last Post: apartmedia
  when signal income run script brnste 1 933 05-22-2017, 05:42 PM
Last Post: pilino1234

Forum Jump:


Browsing: 1 Guest(s)