Shelly Pro - Serie anbinden

Begonnen von vic, 25 Januar 2023, 17:21:49

Vorheriges Thema - Nächstes Thema

stobor

Ich werde es ausprobieren.

Nun habe ich den Shelly Pro3 einmal zusammengebaut - nach bestem Amateurswissen:
define shellypro3_SchuppenWest_fce8c0dbded4_CH0 MQTT2_DEVICE shellypro3_SchuppenWest_fce8c0dbded4
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH0 681069e5-f33f-2cfb-ac82-8af1ad6d620e918c
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 alias shellypro3_SchuppenWest_CH0
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 event-on-update-reading switch_0_output.*,switch_0_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 jsonMap params_switch_0_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 readingList $DEVICETOPIC/status/switch_0:.* { json2nameValue($EVENT, 'switch_0_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* {  return if $EVENT !~ m{switch:0};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH0 setList off:noArg $DEVICETOPIC/rpc    {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":0,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":0}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}

define shellypro3_SchuppenWest_fce8c0dbded4_CH1 MQTT2_DEVICE
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH1 6810c700-f33f-2cfb-6495-254d99026f903623
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 alias shellypro3_SchuppenWest_CH1
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 event-on-update-reading switch_1_output.*,switch_1_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 jsonMap params_switch_1_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 readingList $DEVICETOPIC/status/switch_1:.* { json2nameValue($EVENT, 'switch_1_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* {  return if $EVENT !~ m{switch:1};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH1 setList off:noArg $DEVICETOPIC/rpc    {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":1,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":1,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":1}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":1,"on":false,"toggle_after":$EVTPART1}}

define shellypro3_SchuppenWest_fce8c0dbded4_CH2 MQTT2_DEVICE
setuuid shellypro3_SchuppenWest_fce8c0dbded4_CH2 6810c8e5-f33f-2cfb-7343-faf49eb556aa6a51
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 alias shellypro3_SchuppenWest_CH2
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 devicetopic shellypro3-SchuppenWest-fce8c0dbded4
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 event-on-update-reading switch_2_output.*,switch_2_temperature_tC.*
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 jsonMap params_switch_2_state:state
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 model shellypro3
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 readingList $DEVICETOPIC/status/switch_2:.* { json2nameValue($EVENT, 'switch_2_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* {  return if $EVENT !~ m{switch:2};;;; $EVENT =~ s/"output":true/"state":"on"/g;;;; $EVENT =~ s/"output":false/"state":"off"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 room NEW_Device
attr shellypro3_SchuppenWest_fce8c0dbded4_CH2 setList off:noArg $DEVICETOPIC/rpc    {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":2,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Switch.Set","params":    {"id":2,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Toggle","params": {"id":2}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Switch.Set","params": {"id":2,"on":false,"toggle_after":$EVTPART1}}

Ich sehe die Schalter in FHEM und kann sie bedienen, und sie zeigen Änderungen an, die von woanders getriggert werden:
Du darfst diesen Dateianhang nicht ansehen.

Habe ich da grundlegende Fehler gemacht?

Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

Beta-User

Zitat von: stobor am 29 April 2025, 15:07:08Habe ich da grundlegende Fehler gemacht?
Wenn das bedienbar ist und die updates da sind, wenn von woanders her geschaltet wird, würde ich erst mal sagen: nein.

Zitat von: stobor am 29 April 2025, 15:07:08Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Jein.

Vermutlich würde das für on/off gehen, aber dimmen ist da halt nicht vorgesehen.
Die bennante Änderungen in "shellyPlus_2pm_split" vorgenommen sollte zumindest die passende Anzahl Kanäle liefern. (Notiz an mich selbst: Das sind schon 2 von 3 mehrkanaligen...)

Welche Topic/Payload-Kombi jeweils für's Dimmen erforderlich ist, sollte in der Doku stehen.
Falls du das generisch in die attrTemplate-file einpflegen könntest (bzw. den passenden Schnippsel liefern), würde ich das ins svn übernehmen ;) .
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: ZigBee2mqtt, MiLight@ESP-GW, BT@OpenMQTTGw | ZWave | SIGNALduino | MapleCUN | RHASSPY
svn: u.a Weekday-&RandomTimer, Twilight,  div. attrTemplate-files, MySensors

Ralli

Zitat von: stobor am 29 April 2025, 15:07:08Nun habe ich den Shelly Pro3 einmal zusammengebaut - nach bestem Amateurswissen:

Dem, was ich dir am 26.04. auf deine PM hin geschickt habe, ist nichts hinzuzufügen.

Das klappt bei mir einwandfrei:

https://forum.fhem.de/index.php?topic=131836.msg1260078#msg1260078
Gruß,
Ralli

Proxmox 8.4 Cluster mit HP ED800G2i7, Intel NUC11TNHi7+NUC7i5BNH, virtualisiertes fhem 6.4 dev, virtualisierte RaspberryMatic (3.81.5.20250527) mit HB-RF-ETH 1.3.0 / RPI-RF-MOD, HM-LAN-GW (1.4.1) und HMW-GW, FRITZBOX 7490 (07.59), FBDECT, Siri und Alexa

stobor

Hallo Ralli,

ja, vielen Dank auch dafür, doch damit lief es bei mir nicht.
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus

stobor

Zitat von: Beta-User am 29 April 2025, 15:21:11
Zitat von: stobor am 29 April 2025, 15:07:08Habe ich da grundlegende Fehler gemacht?
Wenn das bedienbar ist und die updates da sind, wenn von woanders her geschaltet wird, würde ich erst mal sagen: nein.

Zitat von: stobor am 29 April 2025, 15:07:08Nun benötige ich noch eine Lösung für meinen Dimmer Shelly Pro 2PM. Soll der auch mit dem geänderten Template laufen (statt "shellyp(lus|ro4pm)" "shellyp(lus|ro.pm)" )?
Jein.

Vermutlich würde das für on/off gehen, aber dimmen ist da halt nicht vorgesehen.
Die bennante Änderungen in "shellyPlus_2pm_split" vorgenommen sollte zumindest die passende Anzahl Kanäle liefern. (Notiz an mich selbst: Das sind schon 2 von 3 mehrkanaligen...)

Welche Topic/Payload-Kombi jeweils für's Dimmen erforderlich ist, sollte in der Doku stehen.
Falls du das generisch in die attrTemplate-file einpflegen könntest (bzw. den passenden Schnippsel liefern), würde ich das ins svn übernehmen ;) .

Ich bin da vermutlich nicht so der Template- oder Schnipsel-Profi.
Aber den Dimmer Shelly Pro 2PM habe ich nun so zum Laufen bekommen:
define shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 MQTT2_DEVICE shellyprodm2pm_SchuppenWest_a0dd6c9f62d4
setuuid shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 68122d5f-f33f-2cfb-c8ab-6279b3912e3cb6c6
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 alias shellyprodm2pm_SchuppenWest_CH0
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 devStateIcon {my $light = ReadingsVal($name,"light_0_output","false") eq "true"?"on":"off";;;; my $cons = ReadingsVal($name,"light_0_apower","unknown");;;; my $pct = ReadingsNum($name,"pct",0);;;;my $temp = ReadingsNum($name,"light_0_temperature_tC",0);;;; "<a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Leistung: $cons W ($pct %), T: $temp C</div>"}
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 devicetopic shellyprodm2pm-SchuppenWest-a0dd6c9f62d4
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 event-on-change-reading light_0_apower,light_0_output,light_0_temperature_tC,light_0_brightness,light_0_voltage,pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 icon light_control
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 jsonMap light_0_brightness:pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 model shellydimmer
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/ble:.* ble\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/status/eth:.* { json2nameValue($EVENT, 'eth_', $JSONMAP) }\
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_0_', $JSONMAP) }\
$DEVICETOPIC/status/input_1:.* { json2nameValue($EVENT, 'input_1_', $JSONMAP) }\
$DEVICETOPIC/status/input_2:.* { json2nameValue($EVENT, 'input_2_', $JSONMAP) }\
$DEVICETOPIC/status/input_3:.* { json2nameValue($EVENT, 'input_3_', $JSONMAP) }\
$DEVICETOPIC/status/light_0:.* { json2nameValue($EVENT, 'light_0_', $JSONMAP) }\
$DEVICETOPIC/status/light_1:.* { json2nameValue($EVENT, 'light_1_', $JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/wifi:.* { json2nameValue($EVENT, 'wifi_', $JSONMAP) }\
$DEVICETOPIC/status/ws:.* { json2nameValue($EVENT, 'ws_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 room NEW_Device
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH0 setList off:noArg $DEVICETOPIC/rpc     {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":0,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":0,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Toggle","params": {"id":0}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":0,"on":false,"toggle_after":$EVTPART1}}\
pct:slider,0,1,100 $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":0,"brightness":$EVTPART1}}


define shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 MQTT2_DEVICE
setuuid shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 681241cd-f33f-2cfb-540c-2335c6779ffe1475
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 alias shellyprodm2pm_SchuppenWest_CH1
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 devStateIcon {my $light = ReadingsVal($name,"light_1_output","false") eq "true"?"on":"off";;;; my $cons = ReadingsVal($name,"light_1_apower","unknown");;;; my $pct = ReadingsNum($name,"pct",0);;;;my $temp = ReadingsNum($name,"light_1_temperature_tC",0);;;; "<a href=\"/fhem?cmd.dummy=set $name toggle&XHR=1\">".FW_makeImage($light)."</a><div>Leistung: $cons W ($pct %), T: $temp C</div>"}
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 devicetopic shellyprodm2pm-SchuppenWest-a0dd6c9f62d4
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 event-on-change-reading light_1_apower,light_1_output,light_1_temperature_tC,light_1_brightness,light_1_voltage,pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 icon light_control
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 jsonMap light_1_brightness:pct
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 model shellydimmer
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 readingList $DEVICETOPIC/online:.* online\
$DEVICETOPIC/status/ble:.* ble\
$DEVICETOPIC/status/cloud:.* { json2nameValue($EVENT, 'cloud_', $JSONMAP) }\
$DEVICETOPIC/status/eth:.* { json2nameValue($EVENT, 'eth_', $JSONMAP) }\
$DEVICETOPIC/status/input_0:.* { json2nameValue($EVENT, 'input_0_', $JSONMAP) }\
$DEVICETOPIC/status/input_1:.* { json2nameValue($EVENT, 'input_1_', $JSONMAP) }\
$DEVICETOPIC/status/input_2:.* { json2nameValue($EVENT, 'input_2_', $JSONMAP) }\
$DEVICETOPIC/status/input_3:.* { json2nameValue($EVENT, 'input_3_', $JSONMAP) }\
$DEVICETOPIC/status/light_0:.* { json2nameValue($EVENT, 'light_0_', $JSONMAP) }\
$DEVICETOPIC/status/light_1:.* { json2nameValue($EVENT, 'light_1_', $JSONMAP) }\
$DEVICETOPIC/status/mqtt:.* { json2nameValue($EVENT, 'mqtt_', $JSONMAP) }\
$DEVICETOPIC/status/sys:.* { json2nameValue($EVENT, 'sys_', $JSONMAP) }\
$DEVICETOPIC/status/wifi:.* { json2nameValue($EVENT, 'wifi_', $JSONMAP) }\
$DEVICETOPIC/status/ws:.* { json2nameValue($EVENT, 'ws_', $JSONMAP) }\
$DEVICETOPIC/events/rpc:.* { json2nameValue($EVENT, 'rpc_', $JSONMAP) }
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 room NEW_Device
attr shellyprodm2pm_SchuppenWest_a0dd6c9f62d4_CH1 setList off:noArg $DEVICETOPIC/rpc     {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":1,"on":false}}\
on:noArg $DEVICETOPIC/rpc      {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":1,"on":true}}\
toggle:noArg $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Toggle","params": {"id":1}}\
on-for-timer $DEVICETOPIC/rpc {"id":1,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":true,"toggle_after":$EVTPART1}}\
off-for-timer $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params": {"id":1,"on":false,"toggle_after":$EVTPART1}}\
pct:slider,0,1,100 $DEVICETOPIC/rpc {"id":0,"src":"fhem2shelly","method":"Light.Set","params":    {"id":1,"brightness":$EVTPART1}}
(hier auch ein Dank an gsbox, der mir mit seiner Lösung Inspirationen geliefert hat.)
Intel NUC (Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-113-generic x86_64))  mit CUL V3.2 (FW 1.57 CUL868) für FS20 und CCU3 für HM(IP) + Arduino Mega (Firmata) - FHEM Revision: 29534 - FS20, HM(IP), MQTT, Philips HUE, ModBus