• 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
Configuration example with program and ACTION to control MPD
#1
Hi all

As it took quite a long time for me to get this working, I want to share my configuration with you. It works pretty well, so feel free to copy. pilight is GREAT!

What my config does:
- 2 switches and 1 dimmer (the easy part)
- 1 button to play/pause my mpd server (press button on remote control or on the pilight web gui and pilight toggles between play and pause of my music player daemon server)
- 1 button to play the next mpd song (press button on remote control or on the pilight web gui and pilight presses next on the mpd server)

(I've changed the IDs of my buttons....)

Code:
{
        "devices": {
                "next": {
                        "protocol": [ "program" ],
                        "id": [{
                                "name": "Next"
                        }],
                        "program": "/etc/pilight/next.sh",
                        "arguments": "",
                        "stop-command": "/etc/pilight/next.sh",
                        "start-command": "/etc/pilight/./next.sh",
                        "state": "stopped",
                        "pid": 0
                },
                "toggle": {
                        "protocol": [ "program" ],
                        "id": [{
                                "name": "Toggle"
                        }],
                        "program": "/etc/pilight/toggle.sh",
                        "arguments": "",
                        "stop-command": "/etc/pilight/toggle.sh",
                        "start-command": "/etc/pilight/./toggle.sh",
                        "state": "stopped",
                        "pid": 0
                },
                "dummyswitch": {
                        "protocol": [ "elro_400_switch" ],
                        "id": [{
                                "systemcode": 21,
                                "unitcode": 15
                        }],
                        "state": "off"
                },
                "dummytoggle": {
                        "protocol": [ "elro_400_switch" ],
                        "id": [{
                                "systemcode": 21,
                                "unitcode": 23
                        }],
                        "state": "off"
                },
                "switch1": {
                        "protocol": [ "intertechno_switch" ],
                        "id": [{
                                "id": 20189102,
                                "unit": 0
                        }],
                        "state": "on"
                },
                "switch2": {
                        "protocol": [ "intertechno_switch" ],
                        "id": [{
                                "id": 20189102,
                                "unit": 1
                        }],
                        "state": "on"
                },
                "switch3": {
                        "protocol": [ "kaku_dimmer", "clarus_switch" ],
                        "id": [{
                                "id": 20189102,
                                "unit": 2
                        },
                        {
                                "id": "B0",
                                "unit": 60
                        }],
                        "state": "off",
                        "dimlevel": 7  
                }
        },
        "rules": {
                "switch_next1": {
                        "rule": "IF dummyswitch.state IS on THEN switch DEVICE next TO running AND switch DEVICE dummyswitch TO off AFTER 1 SECOND",
                        "active": 1
                },
                "switch_toggle": {
                        "rule": "IF dummytoggle.state IS on THEN switch DEVICE toggle TO running AND switch DEVICE dummytoggle TO off AFTER 1 SECOND",
                        "active": 1
                }
        },
        "gui": {
                "switch1": {
                        "name": "Weihnachtsbeleuchtung",
                        "group": [ "Gruppe1" ],
                        "media": [ "all" ],
                        "readonly": 0
                },
                "switch2": {
                        "name": "Wandbild",
                        "group": [ "Gruppe1" ],
                        "media": [ "all" ],
                        "readonly": 0
                },
                "switch3": {
                        "name": "Deckenfluter-Dimmer",
                        "group": [ "Gruppe1" ],
                        "media": [ "all" ],
                        "readonly": 0
                },
                "dummyswitch": {
                        "name": "Next",
                        "group": [ "Generic" ],
                        "media": [ "all" ]
                },
                "dummytoggle": {
                        "name": "Toggle",
                        "group": [ "Generic" ],
                        "media": [ "all" ]
                }
        },
        "settings": {
                "log-level": 5,
                "pid-file": "/var/run/pilight.pid",
                "log-file": "/var/log/pilight.log",
                "webserver-enable": 1,
                "webserver-root": "/usr/local/share/pilight/",
                "webserver-http-port": 5001,
                "webserver-cache": 1
        },
        "hardware": {
                "433gpio": {
                        "sender": 0,
                        "receiver": 1
                }
        },
        "registry": {
                "pilight": {
                        "firmware": {
                                "version": 16831,
                                "lpf": 199160,  
                                "hpf": 290
                        },
                        "version": {
                                "current": "7.0"
                        }
                },
                "webgui": {
                        "tabs": 0
                }
        }
}


the script to toggle (toggle.sh) is just one line of code (removed the password, you should add it for you mpd server):
Code:
mpc -h 10.23.6.17 -p 6600 toggle
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  Protocol Program PID AdHoc-Client Bigmama 12 800 01-26-2019, 07:36 PM
Last Post: Bigmama
  error pilightsend, recieve and control hansipi 2 421 11-04-2018, 03:46 PM
Last Post: hansipi
  sendraw action felfert 1 279 10-19-2018, 03:13 PM
Last Post: curlymo
  ["SOLVED"] Not able to control intertechno ITR-1500 Kambaramba 12 1,443 10-03-2018, 05:52 PM
Last Post: curlymo
Rainbow Trying to control RF Celling FAN bennyboy 0 354 06-23-2018, 05:49 PM
Last Post: bennyboy
  need some help with program protocol charlesjacob4695 1 425 05-15-2018, 05:58 PM
Last Post: curlymo
  Time to handle configuration edits properly amahlaka 4 919 03-19-2017, 04:26 PM
Last Post: pilino1234
  pilight-receive with intertechno ITZ-500 remote control Pik 3 2,258 08-22-2016, 09:16 AM
Last Post: Pik
Question brennenstuhl RCS 1000SN remote control not recognized by receiver droptix 15 5,115 08-01-2016, 02:06 PM
Last Post: droptix
Thumbs Up PROJECT: Automate control of regulation swimming pool with RPI and pilight segalion 1 1,260 06-28-2016, 01:05 PM
Last Post: pilino1234

Forum Jump:


Browsing: 1 Guest(s)