homebridge-edomoticz
homebridge-edomoticz copied to clipboard
Add support for Sprinklers, Faucets, Doorbell, Security, etc...
Maybe we can simplify by determining in the JSON configuration the type of switch ?
Sample...
"platforms": [
{
"platform": "eDomoticz",
"name": "eDomoticz",
"server": "127.0.0.1",
"port": "8080",
"ssl": 0,
"roomid": 0,
"mqtt": 1,
"excludedDevices": [],
"doorbellDevices": [],
"faucetDevices": ["idxDevice1", "idxDevice2"],
"sprinklersDevices": ["idxDevice3", "idxDevice4"]
}
+1
+1
+1 I would like to be able to do this as well. I saw in the code that for MQTT there is some device type handling depending on the selected image in Domoticz.
You can use the Homebridge plugin "MQTTthing" for those device types. Check the example config for use with Domoticz devices;
"accessories": [
{
"accessory": "mqttthing",
"type": "valve",
"valveType": "sprinkler",
"name": "Garden Sprinkler",
"topics": {
"setActive": {
"topic": "domoticz/in",
"apply": "return JSON.stringify({command: 'switchlight', idx: 1234, switchcmd: message})"
},
"getActive": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == 1234 ? JSON.parse(message).nvalue > 0 ? 'On' : 'Off' : ''"
},
"getInUse": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == 1234 ? JSON.parse(message).nvalue > 0 ? 'On' : 'Off' : ''"
},
"getStatusActive": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == 1234 ? JSON.parse(message).nvalue > 0 ? 'On' : 'Off' : ''"
}
},
"startPub": [
{
"topic": "domoticz/in",
"message": "{\"command\": \"getdeviceinfo\", \"idx\": 1234 }"
}
],
"integerValue": "true",
"onValue": "On",
"offValue": "Off",
"durationTimer": true,
"manufacturer": "Superjunky",
"model": "Garden Sprinkler",
"serialNumber": "Sprinkler 1.0"
},
{
"accessory": "mqttthing",
"type": "securitySystem",
"name": "Home Security",
"topics": {
"setTargetState": {
"topic": "domoticz/in",
"apply": "return JSON.stringify({command: 'switchlight', idx: 9876, switchcmd: 'Set Level', level: message})"
},
"getTargetState": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == 9876 ? JSON.parse(message).svalue1 : ''"
},
"getCurrentState": {
"topic": "domoticz/out/mqtt/MQTTthing",
"apply": "return JSON.parse(message).idx == 9876 ? JSON.parse(message).svalue1 : ''"
}
},
"targetStateValues": [
"10",
"20",
"30",
"0"
],
"currentStateValues": [
"10",
"20",
"30",
"0",
"40"
],
"restrictTargetState": [
1,
2,
3
],
"startPub": [
{
"topic": "domoticz/in",
"message": "{\"command\": \"getdeviceinfo\", \"idx\": 9876 }"
}
],
"manufacturer": "Superjunky",
"model": "ProGuard800",
"serialNumber": "Alarm 1.0"
}
]