Bestway LayZSpar Wirlpool

Begonnen von Tueftler1983, 11 Mai 2024, 23:53:16

Vorheriges Thema - Nächstes Thema

Gasmast3r

Hy hatte ne Benachrichtigung über deinen Beitrag bekommen, ich habe das schon seit gut 2 Jahren am laufen eventuell hilft es ja noch falz das was bei ist was noch nicht so will.

defmod Helsinki MQTT2_DEVICE TEST1
attr Helsinki group Spa
attr Helsinki jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater UNT:unit
attr Helsinki readingList layzspa/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }\
  layzspa/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }\
  layzspa/message:.* { $EVENT =~ s/"(FLT|AIR|RED)":1/"$1":"on"/g;;;; $EVENT =~ s/"(FLT|AIR|RED)":0/"$1":"off"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
  layzspa/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }\
  layzspa/MAC_Address:.* MAC_Address\
  layzspa/MQTT_Connect_Count:.* MQTT_Connect_Count\
  layzspa/reboot_time:.* reboot_time\
  layzspa/reboot_reason:.* reboot_reason\
  layzspa/button:.* button\
  layzspa/message:.* { $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g;;;; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g;;;; json2nameValue($EVENT,'',$JSONMAP) }\
  Helsinki:homeassistant/sensor/layzspa_temperature/config:.* { json2nameValue($EVENT, 'config_', $JSONMAP) }\
  Helsinki:homeassistant/sensor/layzspa_target_temperature/config:.* { json2nameValue($EVENT, 'config_', $JSONMAP) }\
  Helsinki:homeassistant/climate/layzspa_climate/config:.* { json2nameValue($EVENT, 'config_', $JSONMAP) }
attr Helsinki room MQTT2_DEVICE
attr Helsinki setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;; qq(layzspa/command  { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
  desired-temp:slider,20,1,40 layzspa/command  {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}\
  air:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;; qq(layzspa/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
  unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0;;;; qq(layzspa/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }\
  heater:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;; qq(layzspa/command  { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
attr Helsinki setStateList on off
attr Helsinki stateFormat temperature config_unit_of_measurement
attr Helsinki webCmd pump:air:heater:unit:desired-temp



Tueftler1983

Guten morgen,
Gasmast3r ich habe mir tatsächlich ein wenig bei dir geklaut und zwar den teil um auf Fhem freundliche readings zu Mappen und um die zustände als on/off zu haben und zu schalten anstatt 1/2.

das Sollte die Fertige version sein, bis auf das Symbol für die heizung da hätte ich halt gerne 1 Symbol um (Aus/ Ein Aufheizen/ Ein Temp Erreicht) darzustellen

defmod Wirlpool MQTT2_DEVICE Lay_Z_Spa_Module
attr Wirlpool devStateIcon 2.on:water-heat@orange:heat+off\
2.off:water-heat@red:heat+on\
3.off:water-heat@red:heat+on\
3.on:water-heat@green:heat+off\
1.on:sani_domestic_waterworks@green:pump+off\
1.off:sani_domestic_waterworks@red:pump+on\
4.off:vent_ventilation_level_0@red:AIR+on\
4.on:vent_ventilation_level_3@green:AIR+off\

attr Wirlpool jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater GRN:hot UNT:unit
attr Wirlpool readingList Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/button:.* button\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/message:.* { $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g;;;;;;;; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/message:.* { $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g;;;;;;;; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/MAC_Address:.* MAC_Address\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/MQTT_Connect_Count:.* MQTT_Connect_Count\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/reboot_time:.* reboot_time\
Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/reboot_reason:.* reboot_reason
attr Wirlpool room MQTT2_DEVICE
attr Wirlpool setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(layzspa/command  { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
desired-temp:slider,20,1,40 layzspa/command  {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}\
air:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(layzspa/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0;;;;;;;; qq(layzspa/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }\
heater:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(layzspa/command  { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
attr Wirlpool stateFormat 1:pump\
2:heater\
3:hot\
4:air\
temperature °C\

attr Wirlpool webCmd desired-temp

setstate Wirlpool 1:off\
2:off\
3:off\
4:off\
25 °C\

Tueftler1983

habe mal einen versuch gewagt
####################################
# provided as mqtt2_layzspa.template by Tueftler1983
name:LayZSpa
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/message/{ $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g;;;;;;;; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }.*
par:BASE_TOPIC;base topic set in SmarAndRelax MQTT Konfiguration;{ AttrVal("DEVICE","devicetopic","") =~ m,[\b]?([^/:]+)(/.+)?, ? $1 : AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef }
defmod DEVICE MQTT2_DEVICE Lay_Z_Spa_Module
attr DEVICE devStateIcon 2.on:water-heat@orange:heat+off
2.off:water-heat@red:heat+on
3.off:water-heat@red:heat+on
3.on:water-heat@green:heat+off
1.on:sani_domestic_waterworks@green:pump+off
1.off:sani_domestic_waterworks@red:pump+on
4.off:vent_ventilation_level_0@red:AIR+on
4.on:vent_ventilation_level_3@green:AIR+off

attr DEVICE jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater GRN:hot UNT:unit
attr DEVICE readingList Lay_Z_Spa_Module:Lay-Z-Spa\x20Module/button:.* button
$:DEVICETOPIC/message:.* { $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g;;;;;;;; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }
$:DEVICETOPIC/message:.* { $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g;;;;;;;; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }
$:DEVICETOPIC/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }
$:DEVICETOPIC/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }
$:DEVICETOPIC/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }
$:DEVICETOPIC/MAC_Address:.* MAC_Address
$:DEVICETOPIC/MQTT_Connect_Count:.* MQTT_Connect_Count
$:DEVICETOPIC/reboot_time:.* reboot_time
$:DEVICETOPIC/reboot_reason:.* reboot_reason
attr DEVICE room MQTT2_DEVICE
attr DEVICE setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(DEVICETOPIC/command  { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
desired-temp:slider,20,1,40 DEVICETOPIC/command  {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}
air:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(DEVICETOPIC/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0;;;;;;;; qq(DEVICETOPIC/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }
heater:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq(DEVICETOPIC/command  { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
attr DEVICE stateFormat 1:pump
2:heater
3:hot
4:air
temperature °C\

rob

Hallo Holger.

Zitat von: Tueftler1983 am 12 Mai 2024, 08:42:28... Der Entwickler der Platine und der Firmware hat mir noch dieses Beispiel ...

Wo findet man eigentlich die Platine, die Firmware und Doku? Dann könnten ggf. auch andere vom Template profitieren :)

Danke und viele Grüße
rob

Tueftler1983

Das anschlussfertige Modul gibt es hier, wird einfach via Steckverbinder zwischen Bedienteil und Steuerung geklemmt.


Habe grade nur das problem das plötzlich das mapping von 0/1 zu off/on nicht mehr geht.

Es lief die ganze Zeit und jetzt steht in den Readings plötzlich wieder 0 bzw 1
www.mk-innovations.de

Tueftler1983

Hmm komisches Phänomen, nach einem shutdown restart von fhem funktioniert das Mapping auf on Off wieder...

Tueftler1983

versuch ein Template zu erstellen:

####################################
# provided as mqtt2_layzspa.template by Tueftler1983
#Use this for the WLAN Module RelaxAndSpa for Bestway Lay Z Spar Wirlpools. The Wlan module ist Selled and #Supportet from Michael Krenner https://www.mk-innovations.de/smartandrelax-modul/
name:LayZSpa
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/message/{ $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g;;;;;;;; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }.*
par:BASE_TOPIC;base topic set in SmarAndRelax MQTT Konfiguration;{ AttrVal("DEVICE","devicetopic","") =~ m,[\b]?([^/:]+)(/.+)?, ? $1 : AttrVal("DEVICE","readingList","") =~ m,[\b]?([^/:]+)[/].+, ? $1 : undef }
desc:Please befor use remove all SPACE in Client-ID and Basic-Tropic inside the Settings from Wlan module
defmod DEVICE MQTT2_DEVICE Lay_Z_Spa_Module
attr DEVICE devStateIcon 2.on:water-heat@orange:heater+off
2.off:water-heat@red:heater+on
3.off:water-heat@red:heater+on
3.on:water-heat@green:heater+off
1.on:sani_domestic_waterworks@green:pump+off
1.off:sani_domestic_waterworks@red:pump+on
4.off:vent_ventilation_level_0@red:air+on
4.on:vent_ventilation_level_3@green:air+off

attr DEVICE jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater GRN:hot UNT:unit AMB:ambiant-temp
attr DEVICE readingList $\DEVICETOPIC\x20Module/button:.* button
$\DEVICETOPIC/message:.* { $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g;;;;;;;; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }
$\DEVICETOPIC/message:.* { $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g;;;;;;;; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }
$\DEVICETOPIC/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }
$\DEVICETOPIC/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }
$\DEVICETOPIC/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }
$\DEVICETOPIC/MAC_Address:.* MAC_Address
$\DEVICETOPIC/MQTT_Connect_Count:.* MQTT_Connect_Count
$\DEVICETOPIC/reboot_time:.* reboot_time
$\DEVICETOPIC/reboot_reason:.* reboot_reason
attr DEVICE room MQTT2_DEVICE
attr DEVICE setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq($\DEVICETOPIC/command  { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
desired-temp:slider,20,1,40 $\DEVICETOPIC/command  {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}
air:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq($\DEVICETOPIC/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0;;;;;;;; qq($\DEVICETOPIC/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }
heater:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;; qq($\DEVICETOPIC/command  { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }
reset_chlorid $\DEVICETOPIC/command  {CMD:9,VALUE:,XTIME:0,INTERVAL:0}
reset_filter $\DEVICETOPIC/command  {CMD:10,VALUE:,XTIME:0,INTERVAL:0}
attr DEVICE stateFormat 1:pump
2:heater
3:hot
4:air
temperature °C
<br>
Letzter Filter Wechsel last_filter_change Tage
<br>
Letzte Chlorung last_add_chlorid Tage
attr DEVICE userReadings last_add_chlorid {my $zeitstamp = ReadingsVal("Wirlpool", "times_CLTIME", 0);;my $current_time = time();;my $diff_seconds = $current_time - $zeitstamp;;return int($diff_seconds / (24 * 60 * 60));;},
last_filter_change {my $zeitstamp = ReadingsVal("Wirlpool", "times_FTIME", 0);;my $current_time = time();;my $diff_seconds = $current_time - $zeitstamp;;return int($diff_seconds / (24 * 60 * 60));;}
attr DEVICE webCmd desired-temp:reset_filter:reset_chlorid

Beta-User

Kannst du das bitte mal testen:

####################################
# provided as mqtt2_layzspa.template by Tueftler1983
#Use this for the WLAN Module RelaxAndSpa for Bestway Lay Z Spar Wirlpools. The Wlan module ist Selled and #Supportet from Michael Krenner https://www.mk-innovations.de/smartandrelax-modul/
name:LayZSpa
filter:TYPE=MQTT2_DEVICE:FILTER=readingList=.*/message
par:BASE_TOPIC;base topic set in SmarAndRelax MQTT Konfiguration;{ AttrVal('DEVICE','readingList','') =~ m,([^:]+)/Status:, ? $1 : undef }
desc:Use this for the WiFi Module RelaxAndSpa for Bestway Lay Z Spar Wirlpools. The WiFi module ist selled and supportet by Michael Krenner https://www.mk-innovations.de/smartandrelax-modul/. Note: in case Client-ID and Basic-Topic include SPACE letters, you will have to change that fist in the settings of the WiFi module!
defmod DEVICE MQTT2_DEVICE Lay_Z_Spa_Module
attr DEVICE devStateIcon 2.on:water-heat@orange:heater+off\
2.off:water-heat@red:heater+on\
3.off:water-heat@red:heater+on\
3.on:water-heat@green:heater+off\
1.on:sani_domestic_waterworks@green:pump+off\
1.off:sani_domestic_waterworks@red:pump+on\
4.off:vent_ventilation_level_0@red:air+on\
4.on:vent_ventilation_level_3@green:air+off
attr DEVICE jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater GRN:hot UNT:unit AMB:ambiant-temp
attr DEVICE readingList BASE_TOPIC/button:.* button\
  BASE_TOPIC/message:.* { $EVENT =~ s/"(FLT|AIR|RED|GRN)":1/"$1":"on"/g; $EVENT =~ s/"(FLT|AIR|RED|GRN)":0/"$1":"off"/g; $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g; json2nameValue($EVENT,'',$JSONMAP) }\
  BASE_TOPIC/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }\
  BASE_TOPIC/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }\
  BASE_TOPIC/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }\
  BASE_TOPIC/MAC_Address:.* MAC_Address\
  BASE_TOPIC/MQTT_Connect_Count:.* MQTT_Connect_Count\
  BASE_TOPIC/reboot_time:.* reboot_time\
  BASE_TOPIC/reboot_reason:.* reboot_reason
attr DEVICE room MQTT2_DEVICE
attr DEVICE setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0; qq(BASE_TOPIC/command { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
  desired-temp:slider,20,1,40 BASE_TOPIC/command {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}\
  air:on,off { my $on = $EVTPART1 eq 'on'?1:0; qq(BASE_TOPIC/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
  unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0; qq(BASE_TOPIC/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }\
  heater:on,off { my $on = $EVTPART1 eq 'on'?1:0; qq(BASE_TOPIC/command { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
  reset_chlorid BASE_TOPIC/command {CMD:9,VALUE:,XTIME:0,INTERVAL:0}\
  reset_filter BASE_TOPIC/command {CMD:10,VALUE:,XTIME:0,INTERVAL:0}
attr DEVICE stateFormat 1:pump
2:heater
3:hot
4:air
temperature °C
<br>
Letzter Filter Wechsel last_filter_change Tage
<br>
Letzte Chlorung last_add_chlorid Tage
attr DEVICE userReadings last_add_chlorid:times_CLTIME.* {return int((time()-ReadingsVal($name, 'times_CLTIME', 0))/DAYSECONDS);}, last_filter_change:times_FTIME.* {return int((time()-ReadingsVal($name, 'times_FTIME', 0))/DAYSECONDS);}
attr DEVICE webCmd desired-temp:reset_filter:reset_chlorid

Anmerkungen:
Man könnte auch mit $DEVICETOPIC arbeiten, müßte es dann aber auch korrekt setzen; finde hier die einfache Klartext-Form ausreichend, und auch die Zahl der Strichpunkte dürfte so ausreichen.
Server: HP-elitedesk@Debian 12, aktuelles FHEM@ConfigDB | CUL_HM (VCCU) | MQTT2: MiLight@ESP-GW, BT@OpenMQTTGw | MySensors: seriell, v.a. 2.3.1@RS485 | ZWave | ZigBee@deCONZ | SIGNALduino | MapleCUN | RHASSPY
svn: u.a MySensors, Weekday-&RandomTimer, Twilight,  div. attrTemplate-files

Tueftler1983

#38
Okay Teste es gerne, diesen Quelltext muss ich doch jetzt in /opt/fhem/FHEM/lib/AttrTemplate ind die mqtt2.template am ende einfügen, dann Fhem Neustarten und ab da an sollte ich sie im device oben unter set DEVICE attr Template LayZSpa auswählen können oder?

Da steht es leider nicht zur auswahl.

Auch habe ich versucht eine Datei LayZSpa.template anzulegen und diese in den entsprechenden Ordner geschoben doch auch leider so kein Erfolg ein { AttrTemplate_Initialize() } habe ich auch gemacht