09-12-2017, 07:02 PM
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....)
the script to toggle (toggle.sh) is just one line of code (removed the password, you should add it for you mpd server):
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