ems-esp MQTT

Begonnen von moustic999, 01 November 2019, 23:23:52

Vorheriges Thema - Nächstes Thema

moustic999

today I'm already using WeekdayTimer for my knx devices, but With changing mode instead of temperature, is it foreseen also to work out-of-the box with a generic reading name ?


moustic999

I guess "desiredTemp" should be called  "desired" as per the default definition below


defmod Buderus_Timer WeekdayTimer thermostat !$we|06:45|22 $we|08:00|22.5 $we|10:30|22.0 56|11:15|18.0 56|23:30|18.0 0-4|22:00|18.5
attr Buderus_Timer commandTemplate set $NAME desired $EVENT

setstate Buderus_Timer 18.0
setstate Buderus_Timer 2019-11-29 11:15:00 currValue 18.0
setstate Buderus_Timer 2019-11-29 11:15:00 nextUpdate 2019-11-29 23:30:00
setstate Buderus_Timer 2019-11-29 11:15:00 nextValue 18.0
setstate Buderus_Timer 2019-11-29 11:15:00 state 18.0


Beta-User

Sorry, my fault.

Looking in the WDT code, it's one of: "desired-temp", "desiredTemperature", "desired", "thermostatSetpointSet"...
I'd tend to "desiredTemperature" as reading name.




For the KNX thing&ootb: It depends... It should be recognised as heating (and therefore switch in the past by default), if there exits one of the mentionned set options. But as you are using a different reading to be set, in any case you have to change commandTemplate accordingly, I assume.
If it's not automatically treated as heating, set the "swip"-Attribute to 1. This has the same effect...
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

moustic999

I changed to "desired" in my thermostat.It works fine, at schedule time, the proper "set thermostat desired 18.0" is sent.

but in my thermostat, the reading is updated correctly, the proper publish is sent, but the state does not change until it receive the thermostat_data.

I would expect that the set command update the status as well, but maybe I'm wrong ?


Beta-User

In your newer RAW, there's no more setStateList.
Therefore all set commands will be reflected in "state" reading. Imo, the "desired" reading isn't updated (and you missinterpreted what you've seen) and tend to use that attribute to some dummy values like "on off".

Then you should find "set " followed by the value in the reading as long as there's no confirmation from the receiving side.
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

moustic999

yup exact I was a bit confused ;-)
here is the latest RAW which work
defmod thermostat MQTT2_DEVICE ems-esp
attr thermostat IODev mqttBroker
attr thermostat devStateIcon auto:time_automatic manual:time_manual_mode
attr thermostat icon temp_control
attr thermostat jsonMap hc1_mode:mode hc1_seltemp:desired
attr thermostat readingList mqttBroker:home/ems-esp/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
attr thermostat room MQTT2_DEVICE
attr thermostat setList mode:uzsuSelectRadio,auto,manual home/ems-esp/thermostat_cmd_mode1 $EVTPART1\
desired:slider,15.0,0.5,30.0,1 home/ems-esp/thermostat_cmd_temp1 $EVTPART1
attr thermostat stateFormat mode\
desired °C
attr thermostat webCmd mode:desired

setstate thermostat manual\
22 °C
setstate thermostat 2019-11-29 12:28:40 desired 22
setstate thermostat 2019-11-29 12:28:40 hc1_daytemp 0
setstate thermostat 2019-11-29 12:28:40 hc1_nighttemp 0
setstate thermostat 2019-11-29 12:28:40 mode manual
setstate thermostat 2019-11-29 12:28:29 state mode


also the associated WeekdayTimer , attrs are default  :
defmod Buderus_Timer WeekdayTimer thermostat fr !$we|06:45|22.5 $we|08:00|22.5 $we|10:30|22.0 56|12:18|18.0 56|23:30|18.0 0-4|22:00|18.5
attr Buderus_Timer commandTemplate set $NAME desired $EVENT

setstate Buderus_Timer 18.0
setstate Buderus_Timer 2019-11-29 12:18:00 currValue 18.0
setstate Buderus_Timer 2019-11-29 12:18:00 nextUpdate 2019-11-29 23:30:00
setstate Buderus_Timer 2019-11-29 12:18:00 nextValue 18.0
setstate Buderus_Timer 2019-11-29 12:18:00 state 18.0

Beta-User

OK, so here's the suggestion to

- use setStateList and
- use desired-temp as reading (imo "desired" is somehow open for interpretation, and you seem to dislike desiredTemperature for whatever reason ;D ...)

defmod thermostat MQTT2_DEVICE ems-esp
attr thermostat IODev mqttBroker
attr thermostat devStateIcon auto:time_automatic manual:time_manual_mode
attr thermostat icon temp_control
attr thermostat jsonMap hc1_mode:mode hc1_seltemp:desired-temp
attr thermostat readingList mqttBroker:home/ems-esp/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
attr thermostat room MQTT2_DEVICE
attr thermostat setList mode:uzsuSelectRadio,auto,manual home/ems-esp/thermostat_cmd_mode1 $EVTPART1\
desired-temp:slider,15.0,0.5,30.0,1 home/ems-esp/thermostat_cmd_temp1 $EVTPART1
attr thermostat setStateList on off
attr thermostat stateFormat mode\
desired-temp °C
attr thermostat webCmd mode:desired-temp


Then change wdt also accordingly
attr Buderus_Timer commandTemplate set $NAME desired-temp $EVENT
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

moustic999

I change the desired to desired-temp ;-)

for the setStateList, I don' t understand pretty well it's use, but with the
attr thermostat setStateList on off

I have mode and desired-temp updated when the set command is issued, but in the state, I have also the 'set' keyword. How do we fix that ?

defmod thermostat MQTT2_DEVICE ems-esp
attr thermostat IODev mqttBroker
attr thermostat devStateIcon auto:time_automatic manual:time_manual_mode
attr thermostat icon temp_control
attr thermostat jsonMap hc1_mode:mode hc1_seltemp:desired-temp
attr thermostat readingList mqttBroker:home/ems-esp/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
attr thermostat room MQTT2_DEVICE
attr thermostat setList mode:uzsuSelectRadio,auto,manual home/ems-esp/thermostat_cmd_mode1 $EVTPART1\
desired-temp:slider,15.0,0.5,30.0,1 home/ems-esp/thermostat_cmd_temp1 $EVTPART1
attr thermostat setStateList on off
attr thermostat stateFormat mode\
desired-temp °C
attr thermostat webCmd mode:desired-temp

setstate thermostat auto\
22 °C
setstate thermostat 2019-11-29 13:04:28 desired-temp 22
setstate thermostat 2019-11-29 13:04:28 hc1_daytemp 0
setstate thermostat 2019-11-29 13:04:28 hc1_nighttemp 0
setstate thermostat 2019-11-29 13:04:28 mode auto



Beta-User

#23
Don't see any "set " in "state" (but you might see that in Internal STATE  ;) ).

This is why I asked here:
Zitat von: Beta-User am 28 November 2019, 12:23:33
Would showing a different icon (instead of text) when things are to be processed would also be an option? Then I'd suggest to show the "edit_settings"-icon, when "^set.*°C$".
So you might give a try to
attr thermostat devStateIcon set_(auto|manual):edit_settings auto:time_automatic:manual manual:time_manual_mode:auto  set.*°C:edit_settings

EDIT:
- added some commands
- Wrt. to the "useless" on/off in setStateList: this is just for forcing the module to write (other) changes to the readings not to state (lowercase=reading).
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

moustic999

Ok I better understand all magic of fhem ;-)

I adapted the devStateIcon, but it does not work as expected,
when I change the temp, it is OK, I have the editSetting icon apprearing
but not when changing the mode.

because in the reading 'mode', there is no '_' so 'set thermostat mode auto' will do mode 'set auto' and not 'set_auto' as expected in devStateIcon.


Beta-User

 ;D There's no magic, but wrt. to the UI some kind of layers influenceing each other in not always an obvious way ;D . But I agree, seems you are getting deeper in all these things.

However, there's at least one thing I missed.. Try:
attr thermostat devStateIcon set.(auto|manual):edit_settings auto:time_automatic:mode+manual manual:time_manual_mode:mode+auto  set.*°C:edit_settings

or (adding the option to toggle also the last mode not yet processed, don't know whether this makes sense or colouring would be helpful):attr thermostat devStateIcon set.auto:edit_settings:mode+manual set.manual:edit_settings:mode+auto auto:time_automatic:mode+manual manual:time_manual_mode:mode+auto  set.*°C:edit_settings(Could be, the "_" would work again, but using the dot is also ok...).
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

moustic999

just for my knowledge, the '.' means any char in perl regexp ? is that right ?

Beta-User

You got it  ;) .

This is why I personally try to avoid the dot in any naming I use within FHEM. The dot is always in danger to get misinterpreted... (Btw.: Rudi long time ago stated to not share my point of view on that, so I'm quite surprised to find my doubts verified with the renaming thing in one of his most recent modules and features (json2nameValue using JSONMAP@MQTT2_DEVICE)...)

For more info about most of the attributes we discussed, you might also review the commandref:
https://fhem.de/commandref_modular.html#FHEMWEB
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

Beta-User

Hi,

so here's the attempt to bring this to a level for publication:
name:ems-esp_thermostat
filter:TYPE=MQTT2_DEVICE
desc:To configure a thermostat for use with an <a href="https://github.com/proddy/EMS-ESP">EMS-ESP</a><br><a href="https://forum.fhem.de/index.php/topic,104968.0.html">Forum Thread</a><br>
order:E_02c
par:DEV_ID;base topic set in the ESP including "ems-esp";{ AttrVal("DEVICE","readingList","") =~ m,([^:]*ems-esp)/thermostat_data:, ? "$1" : undef }
par:ICON;ICON as set, defaults to temp_control;{ AttrVal("DEVICE","icon","temp_control") }
attr DEVICE icon ICON
attr DEVICE devStateIcon set.auto:edit_settings:mode+manual set.manual:edit_settings:mode+auto auto:time_automatic:mode+manual manual:time_manual_mode:mode+auto  set.*°C:edit_settings
attr DEVICE jsonMap hc1_mode:mode hc1_seltemp:desired-temp hc1_daytemp:daytemp hc1_nighttemp:nighttemp
attr DEVICE readingList DEV_ID/thermostat_data:.* { json2nameValue($EVENT, '', $JSONMAP) }
attr DEVICE setList mode:uzsuSelectRadio,auto,manual DEV_ID/thermostat_cmd_mode1 $EVTPART1\
  desired-temp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_temp1 $EVTPART1\
  daytemp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_daytemp1 $EVTPART1\
  nighttemp:slider,15.0,0.5,30.0,1 DEV_ID/thermostat_cmd_nighttemp1 $EVTPART1
attr DEVICE setStateList on off
attr DEVICE stateFormat mode\
desired-temp °C
attr DEVICE webCmd mode:desired-temp
attr DEVICE model ems-esp_thermostat

Hope, I guessed right with the day- and night-temp-setter?
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

moustic999

in EMS there are many kind of thermostat, and for a same thermostat many modes of using it ;-)

RC300 use mode as auto/manual and can set the target temp (seltemp).
if it is installed in a room, it will also report current temp (currtemp)
mine is installed inside the heater, so I don't have current temp.
on a RC300 night and day temp are not used.

RC35 use mode auto/day/night and can set many temp : seltemp , daytemp and nighttemp
it report also the current temp (currtemep )

most of others thermostat in compatible brands works as one f these  flavors.

I think it is quite complex to create template for this, knowing also that all sensors will have to be supported too, probably in a separate device.
I can provide a exhaustive list of all subscrptions , so we can decide how to setup these into fhem.