• 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 with&without device. One working not the other... Tamadite 9 907 07-24-2018, 08:55 AM
Last Post: curlymo
  Program can't be set to state running Gisto 7 860 07-17-2018, 12:51 PM
Last Post: Gisto
  rule executed once at start up segalion 3 523 07-12-2018, 05:28 PM
Last Post: curlymo
  Problem FOR Alex 5 748 05-18-2018, 01:21 PM
Last Post: curlymo
  Rule Sunset works, Sunrise not apartmedia 1 916 12-05-2017, 07:09 PM
Last Post: apartmedia
  when signal income run script brnste 1 789 05-22-2017, 05:42 PM
Last Post: pilino1234
  Problem with a Rule for a One Button Switch martin-dj 1 1,148 03-06-2017, 12:01 PM
Last Post: pilino1234
  Rule executed at wrong time philipp81 1 820 02-25-2017, 10:43 PM
Last Post: curlymo
  Sunriseset problem switches on at 0:00 kgulti 13 3,503 12-26-2016, 08:08 PM
Last Post: PekkaLahtela
  Rule is executed repeatedly Niek 3 1,373 11-09-2016, 10:22 PM
Last Post: wo_rasp

Forum Jump:


Browsing: 1 Guest(s)