-
Autor
Hi...
Use Shelly for a few years with a flow that make it possible to switch in Domoticz a dummy switch
With all older version of the firmware i get this working, only with the latest firmware and the shellyplus1 pm, i get not the flow with domoticz working.
The flow:
Code
var idx_shelly_table = [
//[ domoticz idx, shelly name topic, relay ],// syntax
//192.168.5.131
[15670, "shelly-plug-Dressoir-R-6EC6C7", 0], // Plug Kamer dressior rechts
// 192.168.5.132 Jongens
[12860, "Shelly-Jongens-25-C4D304", 0], // Dylan
[12861, "Shelly-Jongens-25-C4D304", 1], // Ryan
// 192.168.5.133 Garage
[12706, "Shelly-Garage-25-C49121", 0], // Werkbank
[12707, "Shelly-Garage-25-C49121", 1], // Garage
// 192.168.5.134 Keuken
[12635, "Shelly-Keuken-25-10521C0730A0", 0], // Nis
[12636, "Shelly-Keuken-25-10521C0730A0", 1], // Aanrecht
// 192.168.5.135 Slaapkamer
[12863, "Shelly-Slaapkamer-25-C47EAA", 0], // Kaptafel
[12862, "Shelly-Slaapkamer-25-C47EAA", 1], // Slaapkamer
// 192.168.5.136 Terras
[13217, "Shelly-Terras-25-84CCA89F6640", 0], // Terras keukenraam
[13218, "Shelly-Terras-25-84CCA89F6640", 1], // Terras Bamboe
// 192.168.5.137
[13219, "Shelly-Warmtepomp-25-C48DB3", 0], // Warmtepomp
[13220, "Shelly-Warmtepomp-25-C48DB3", 1], // Over
// 192.168.5.138
[16301, "Shelly-Over-98F4ABD0B793", 0], // Over
//192.168.5.139 Poortlampje tuinkast
[14363, "Shelly1pm-84CCA8A7FB2F", 0], // Sh Poort Lampje T [ tuinkast ]
//192.168.5.140
[14199, "Shelly-Badkamer-25-84CCA8B1760E", 0], // over
[14200, "Shelly-Badkamer-25-84CCA8B1760E", 1], // Spiegel
//192.168.5.141
[15665, "shelly-1pm-gar-sol-E09806A9FCF6", 0], // Garage solar
//192.168.5.142
[16307, "shelly-plus1-DakrandSolar-80646fe4555c", 0],// Dakrandsolar
// Geen IP
[13221, "1-1D929B", 0], // ], 98F4ABD0B793 Over shelly 1
];
if ( msg.src == 'shelly' ) {
//todo: support second relays
var matches = msg.topic.match( /shellies\/(.*)\/relay\/(\d)/ );
if ( matches.length == 3 ) {
var shelly_id = matches[1];
var shelly_relay = parseInt( matches[2] );
for ( var i = 0; i < idx_shelly_table.length; i++ ) {
if ( idx_shelly_table[i][1] == shelly_id && idx_shelly_table[i][2] == shelly_relay ) {
// convert to domoticz stuff
var val = msg.payload == "on" ? 1 : 0;
msg = {
payload:
{
nvalue: val,
command: "udevice",
idx: idx_shelly_table[i][0],
}
}
return [msg, null, null];
}
}
// shelly not found in table
msg.shelly_id = shelly_id;
msg.relay = shelly_relay;
return [null, null, msg];
}
}
if ( msg.src == 'domoticz' ) {
for ( var i = 0; i < idx_shelly_table.length; i++ ) {
if ( idx_shelly_table[i][0] == parseInt(msg.payload.idx) ) {
if ( msg.payload.nvalue == 1)
msg.payload = "on";
else
msg.payload = "off";
msg.topic = "shellies/" + idx_shelly_table[i][1] + "/relay/" + idx_shelly_table[i][2] + "/command";
return [null, msg, null ];
}
}
}
// dismiss
return [null, null, null];
Alles anzeigen
Where the problem is in:
[16307, "shelly-plus1-DakrandSolar-80646fe4555c", 0],// Dakrandsolar
Mqtt explorer:
Settings:
Did try some tls other options, cloud on and off.
I think there is someting in the mqtt settings
Only i am a windows noob..
So hope there is some help.
Thanks