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

Tueftler1983

Habe die ReadingList mal von hand in mein Device übertragen ( Copy Past) doch leider werden die Readings von AIR FLT RED GRN nicht mehr von 1/0 auf on/off umgesetzt

define Wirlpool MQTT2_DEVICE Lay-Z-Spa
attr Wirlpool 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 Wirlpool jsonMap TGT:desired-temp TMP:temperature FLT:pump AIR:air RED:heater GRN:hot UNT:unit AMB:ambiant-temp
attr Wirlpool readingList Lay-Z-Spa-Module/button:.* button\
Lay-Z-Spa-Module/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) }\
Lay-Z-Spa-Module/message:.* { $EVENT =~ s/"(UNT)":1/"$1":"Celsius"/g;;;;;;;; $EVENT =~ s/"(UNT)":0/"$1":"Fahrenheit"/g;;;;;;;; json2nameValue($EVENT,'',$JSONMAP) }\
Lay-Z-Spa-Module/times:.* { json2nameValue($EVENT, 'times_', $JSONMAP) }\
Lay-Z-Spa-Module/other:.* { json2nameValue($EVENT, 'other_', $JSONMAP) }\
Lay-Z-Spa-Module/Status:.* { $EVENT eq 'Alive' ? {LWT=>'online'} : {LWT=>'offline'} }\
Lay-Z-Spa-Module/MAC_Address:.* MAC_Address\
Lay-Z-Spa-Module/MQTT_Connect_Count:.* MQTT_Connect_Count\
Lay-Z-Spa-Module/reboot_time:.* reboot_time\
Lay-Z-Spa-Module/reboot_reason:.* reboot_reason\

attr Wirlpool room Garten,Gast,MQTT2_DEVICE,Pool
attr Wirlpool setList pump:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;;;;;;;;;; qq(Lay-Z-Spa-Module/command  { "CMD":4, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
desired-temp:slider,20,1,40 Lay-Z-Spa-Module/command  {CMD:0,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}\
air:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;;;;;;;;;; qq(Lay-Z-Spa-Module/command { "CMD":2, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
unit:Celsius,Fahrenheit { my $Celsius = $EVTPART1 eq 'Celsius'?1:0;;;;;;;;;;;;;;;; qq(Lay-Z-Spa-Module/command  { "CMD":1, "VALUE":$Celsius, "XTIME":0, "INTERVAL":0 }) }\
heater:on,off { my $on = $EVTPART1 eq 'on'?1:0;;;;;;;;;;;;;;;; qq(Lay-Z-Spa-Module/command  { "CMD":3, "VALUE":$on, "XTIME":0, "INTERVAL":0 }) }\
ambiant-temp Lay-Z-Spa-Module/command  {CMD:15,VALUE:$EVTPART1,XTIME:0,INTERVAL:0}\
reset_chlorid Lay-Z-Spa-Module/command  {CMD:9,VALUE:,XTIME:0,INTERVAL:0}\
reset_filter Lay-Z-Spa-Module/command  {CMD:10,VALUE:,XTIME:0,INTERVAL:0}
attr Wirlpool 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 Wirlpool 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 Wirlpool webCmd desired-temp:reset_filter:reset_chlorid
#   CID        Lay-Z-Spa
#   DEF        Lay-Z-Spa
#   FUUID      6647a578-f33f-91a4-fb4a-87fd094bd03bdc1e
#   IODev      MQTT2_FHEM_Server
#   LASTInputDev MQTT2_FHEM_Server
#   MQTT2_FHEM_Server_CONN MQTT2_FHEM_Server_192.168.2.150_54650
#   MQTT2_FHEM_Server_MSGCNT 136
#   MQTT2_FHEM_Server_TIME 2024-05-23 12:41:16
#   MSGCNT     136
#   NAME       Wirlpool
#   NR         609
#   STATE      1:1
#2:0
#3:0
#4:0
#18 °C
#<br>
#Letzter Filter Wechsel 4 Tage
#<br>
#Letzte Chlorung 4 Tage
#   TYPE       MQTT2_DEVICE
#   eventCount 139
#   JSONMAP:
#     AIR        air
#     AMB        ambiant-temp
#     FLT        pump
#     GRN        hot
#     RED        heater
#     TGT        desired-temp
#     TMP        temperature
#     UNT        unit
#   OLDREADINGS:
#   READINGS:
#     2024-05-23 12:41:16   AMBC            18
#     2024-05-23 12:41:16   AMBF            64
#     2024-05-23 12:41:16   BRT             4
#     2024-05-23 12:41:16   CH1             32
#     2024-05-23 12:41:16   CH2             49
#     2024-05-23 12:41:16   CH3             56
#     2024-05-23 12:41:16   CONTENT         STATES
#     2024-05-23 12:41:16   ERR             0
#     2024-05-23 12:41:16   GOD             0
#     2024-05-23 12:41:16   HJT             0
#     2024-05-23 12:41:16   LCK             1
#     2024-05-23 12:41:16   PWR             1
#     2024-05-23 12:41:16   TGTC            33
#     2024-05-23 12:41:16   TGTF            91
#     2024-05-23 12:41:16   TIME            1716460876
#     2024-05-23 12:41:16   TMPC            18
#     2024-05-23 12:41:16   TMPF            64
#     2024-05-23 12:41:16   VTM             17.7349987
#     2024-05-23 12:41:16   VTMC            17.7349987
#     2024-05-23 12:41:16   VTMF            63.92299652
#     2024-05-23 12:41:16   air             0
#     2024-05-23 12:41:16   ambiant-temp    18
#     2024-05-23 12:41:16   desired-temp    33
#     2024-05-23 12:41:16   heater          0
#     2024-05-23 12:41:16   hot             0
#     2024-05-23 12:41:16   last_add_chlorid 4
#     2024-05-23 12:41:16   last_filter_change 4
#     2024-05-23 12:41:16   other_CONTENT   OTHER
#     2024-05-23 12:41:16   other_FW        2024-04-27-001
#     2024-05-23 12:41:16   other_HASGOD    false
#     2024-05-23 12:41:16   other_HASJETS   false
#     2024-05-23 12:41:16   other_IP        192.168.2.150
#     2024-05-23 12:41:16   other_MODEL     MIAMI2021
#     2024-05-23 12:41:16   other_MQTT      0
#     2024-05-23 12:41:16   other_RSSI      -69
#     2024-05-23 12:41:16   other_SSID      GartenAP
#     2024-05-23 12:41:16   other_loopfq    82
#     2024-05-23 12:41:16   pump            1
#     2024-05-23 12:33:30   state           pump
#     2024-05-23 12:41:16   temperature     18
#     2024-05-23 12:41:16   times_AIRTIME   5972
#     2024-05-23 12:41:16   times_CLINT     14
#     2024-05-23 12:41:16   times_CLTIME    1716073090
#     2024-05-23 12:41:16   times_CONTENT   TIMES
#     2024-05-23 12:41:16   times_COST      11.75545216
#     2024-05-23 12:41:16   times_DBG        192 1 254 13 254 255 254 9 255 247 255 good pkt:0
#     2024-05-23 12:41:16   times_FINT      30
#     2024-05-23 12:41:16   times_FTIME     1716066900
#     2024-05-23 12:41:16   times_HEATINGTIME 73993
#     2024-05-23 12:41:16   times_JETTIME   0
#     2024-05-23 12:41:16   times_KWH       43.53871155
#     2024-05-23 12:41:16   times_KWHD      43.55185257
#     2024-05-23 12:41:16   times_PUMPTIME  236256
#     2024-05-23 12:41:16   times_RS        Not ready
#     2024-05-23 12:41:16   times_T2R       15.577672
#     2024-05-23 12:41:16   times_TIME      1716460876
#     2024-05-23 12:41:16   times_UPTIME    962416
#     2024-05-23 12:41:16   times_WATT      42
#     2024-05-23 12:41:16   unit            Celsius
#
setstate Wirlpool 1:1\
2:0\
3:0\
4:0\
18 °C\
<br>\
Letzter Filter Wechsel 4 Tage\
<br>\
Letzte Chlorung 4 Tage
setstate Wirlpool 2024-05-23 12:41:16 AMBC 18
setstate Wirlpool 2024-05-23 12:41:16 AMBF 64
setstate Wirlpool 2024-05-23 12:41:16 BRT 4
setstate Wirlpool 2024-05-23 12:41:16 CH1 32
setstate Wirlpool 2024-05-23 12:41:16 CH2 49
setstate Wirlpool 2024-05-23 12:41:16 CH3 56
setstate Wirlpool 2024-05-23 12:41:16 CONTENT STATES
setstate Wirlpool 2024-05-23 12:41:16 ERR 0
setstate Wirlpool 2024-05-23 12:41:16 GOD 0
setstate Wirlpool 2024-05-23 12:41:16 HJT 0
setstate Wirlpool 2024-05-23 12:41:16 LCK 1
setstate Wirlpool 2024-05-23 12:41:16 PWR 1
setstate Wirlpool 2024-05-23 12:41:16 TGTC 33
setstate Wirlpool 2024-05-23 12:41:16 TGTF 91
setstate Wirlpool 2024-05-23 12:41:16 TIME 1716460876
setstate Wirlpool 2024-05-23 12:41:16 TMPC 18
setstate Wirlpool 2024-05-23 12:41:16 TMPF 64
setstate Wirlpool 2024-05-23 12:41:16 VTM 17.7349987
setstate Wirlpool 2024-05-23 12:41:16 VTMC 17.7349987
setstate Wirlpool 2024-05-23 12:41:16 VTMF 63.92299652
setstate Wirlpool 2024-05-23 12:41:16 air 0
setstate Wirlpool 2024-05-23 12:41:16 ambiant-temp 18
setstate Wirlpool 2024-05-23 12:41:16 desired-temp 33
setstate Wirlpool 2024-05-23 12:41:16 heater 0
setstate Wirlpool 2024-05-23 12:41:16 hot 0
setstate Wirlpool 2024-05-23 12:41:16 last_add_chlorid 4
setstate Wirlpool 2024-05-23 12:41:16 last_filter_change 4
setstate Wirlpool 2024-05-23 12:41:16 other_CONTENT OTHER
setstate Wirlpool 2024-05-23 12:41:16 other_FW 2024-04-27-001
setstate Wirlpool 2024-05-23 12:41:16 other_HASGOD false
setstate Wirlpool 2024-05-23 12:41:16 other_HASJETS false
setstate Wirlpool 2024-05-23 12:41:16 other_IP 192.168.2.150
setstate Wirlpool 2024-05-23 12:41:16 other_MODEL MIAMI2021
setstate Wirlpool 2024-05-23 12:41:16 other_MQTT 0
setstate Wirlpool 2024-05-23 12:41:16 other_RSSI -69
setstate Wirlpool 2024-05-23 12:41:16 other_SSID GartenAP
setstate Wirlpool 2024-05-23 12:41:16 other_loopfq 82
setstate Wirlpool 2024-05-23 12:41:16 pump 1
setstate Wirlpool 2024-05-23 12:33:30 state pump
setstate Wirlpool 2024-05-23 12:41:16 temperature 18
setstate Wirlpool 2024-05-23 12:41:16 times_AIRTIME 5972
setstate Wirlpool 2024-05-23 12:41:16 times_CLINT 14
setstate Wirlpool 2024-05-23 12:41:16 times_CLTIME 1716073090
setstate Wirlpool 2024-05-23 12:41:16 times_CONTENT TIMES
setstate Wirlpool 2024-05-23 12:41:16 times_COST 11.75545216
setstate Wirlpool 2024-05-23 12:41:16 times_DBG  192 1 254 13 254 255 254 9 255 247 255 good pkt:0
setstate Wirlpool 2024-05-23 12:41:16 times_FINT 30
setstate Wirlpool 2024-05-23 12:41:16 times_FTIME 1716066900
setstate Wirlpool 2024-05-23 12:41:16 times_HEATINGTIME 73993
setstate Wirlpool 2024-05-23 12:41:16 times_JETTIME 0
setstate Wirlpool 2024-05-23 12:41:16 times_KWH 43.53871155
setstate Wirlpool 2024-05-23 12:41:16 times_KWHD 43.55185257
setstate Wirlpool 2024-05-23 12:41:16 times_PUMPTIME 236256
setstate Wirlpool 2024-05-23 12:41:16 times_RS Not ready
setstate Wirlpool 2024-05-23 12:41:16 times_T2R 15.577672
setstate Wirlpool 2024-05-23 12:41:16 times_TIME 1716460876
setstate Wirlpool 2024-05-23 12:41:16 times_UPTIME 962416
setstate Wirlpool 2024-05-23 12:41:16 times_WATT 42
setstate Wirlpool 2024-05-23 12:41:16 unit Celsius


Beta-User

Zitat von: Tueftler1983 am 23 Mai 2024, 11:40:56Okay 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
Kommt drauf an, evtl. schlägt da auch die "filter"-Anweisung durch? Ggf. einfach etwas großzügiger fassen (nur auf TYPE).

Zitat von: Tueftler1983 am 23 Mai 2024, 12:41:55Habe die ReadingList mal von hand in mein Device übertragen ( Copy Past) doch leider werden die Readings von AIR FLT RED GRN nicht mehr von 1/0 auf on/off umgesetzt
Bitte lösche erst mal die 2. Zeile mit "message". Kann sonst sein, dass die 2. Zeile die Ergebnisse der ersten überschreibt, daher war da auch die vorgeschlagene Doppelung raus...
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

Hey also mit reduziertem filter funktioniert das Template.
Nur die Zuweisung in den Raum funktioniert nicht, es wird dann ein Raum angelegt mit dem Namen : MQTT2_Devicename

Eigentlich soll es ja in den Raum (MQTT2_DEVICE)

Und das "°" Zeichen wurde nicht dargestellt sondern ein anderes undefiniertes Zeichen deshalb habe ich es in den Text "Grad"


####################################
# 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
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 Grad 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

An dieser Stelle nochmal einen herzlichen Dank für die Hilfe.
Freue mich wenn das Template aufgenommen wird.

LG Holger

Beta-User

...ist drin...
Hab den room noch ganz rausgenommen (da will der user idR keine Änderung) und setStateList aus dem Vorschlag von @Gasmast3r übernommen.

Ist zwar immer noch "na ja" (schon alleine wegen des eingedeutschten stateFormats, kein icon), aber wer will, kann das ja verbessern...
 
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

Okay habe ein fhem Update gemacht aber in meinem MQTT2.template ist es nicht mit drin.

Was bewirkt das setStateList denn??
Sehe keinen Unterschied wenn ich es bei mir als attr eintrage.

LG holger

TomLee

ZitatOkay habe ein fhem Update gemacht aber in meinem MQTT2.template ist es nicht mit drin.

Nabend,

noch nie mitbekommen das Updates erst am nächsten Morgen verfügbar sind ?

So (oben in der Befehlszeile ausgeführt), siehst dein Template jetzt schon.
{Svn_GetFile("FHEM/lib/AttrTemplate/mqtt2.template","FHEM/lib/AttrTemplate/mqtt2.template",sub(){AttrTemplate_Initialize()})}
Zu setStateList: Übersetz dir mal die Hilfe zu dem Attribut und versuchs nachzuvollziehen, so ist es am einfachsten zu verstehen.