emsesp / EMS-ESP32

ESP32 firmware to read and control EMS and Heatronic compatible equipment such as boilers, thermostats, solar modules, and heat pumps
https://emsesp.github.io/docs
GNU Lesser General Public License v3.0
548 stars 96 forks source link

no attribute 'hamode' when rendering '{{value_json.hc1.hamode}}' #100

Closed WouterKr closed 2 years ago

WouterKr commented 2 years ago

Hi,

Most of this kind of messages has been solved already but this one occurs in my setup. I am using the ems-esp with homeassisant integration set and the mqtt setting default:

Bug description After a restart or during operation the following messages appears in the core log of homeassistant (every 10 sec based on default value mqtt setting):

2021-08-19 19:24:11 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'dict object' has no attribute 'hamode' when rendering '{{value_json.hc1.hamode}}'
2021-08-19 19:24:11 ERROR (MainThread) [homeassistant.components.mqtt.climate] Invalid modes mode: 

Steps to reproduce A restart of the device triggers this messages but occurs during operation also.

Expected behavior No error message in the core log of homeassistant and a correct rendering of the variable

Device information { "System": { "version": "3.2.1", "uptime": "000+01:02:42.414", "uptime_sec": 3762, "freemem": 183 }, "Status": { "bus": "connected", "bus protocol": "Buderus", "telegrams received": 3335, "read requests sent": 524, "write requests sent": 0, "incomplete telegrams": 0, "tx fails": 0, "rx line quality": 100, "tx line quality": 100, "MQTT publishes": 1084, "MQTT publish fails": 0, "dallas sensors": 0, "dallas reads": 0, "dallas fails": 0 }, "Devices": [ { "type": "Boiler", "name": "Nefit GBx72/Trendline/Cerapur/Greenstar Si/27i (DeviceID:0x08 ProductID:123, Version:06.07)", "handlers": "0x10 0x11 0x14 0x15 0x1C 0x18 0x19 0x1A 0x35 0x16 0x33 0x34 0x26 0x2A 0xD1 0xE3 0xE4 0xE5 0xE6 0xE9 0xEA" }, { "type": "Thermostat", "name": "Logamatic TC100/Moduline Easy (DeviceID:0x18, ProductID:202, Version:02.22)", "handlers": "0xA3 0x06 0xA2 0x12 0x0A" }, { "type": "Controller", "name": "BC10 (DeviceID:0x09, ProductID:190, Version:01.04)", "handlers": "" } ] }

proddy commented 2 years ago

If you have MQTTExplorer installed could you fire it up and type in hamode in the search. Select the topic thermostat_data. You should see something like the below:

image

we're looking for hamode in the nested json hc1

WouterKr commented 2 years ago

"hamode" is only found once and not in the nested json hc1 as far as I can see:

Screenshot 2021-08-19 at 21 32 35 Screenshot 2021-08-19 at 21 30 03

Btw : I noticed the "retain" flag. This is not set in the config settings of the ems-esp.

proddy commented 2 years ago

the homeassistant MQTT discovery topics are all retained by EMS-ESP, that's normal. Otherwise everytime you restart HA it'll loose all EMS-ESP integrations.

So hamode is missing. What do you see when you run http://ems-esp/api/thermostat ? Mine is

{
  "id": 77,
  "errorcode": "(0)",
  "datetime": "22:12:21 19/08/2021",
  "hc1": {
    "seltemp": 20.5,
    "currtemp": 22.4,
    "hatemp": 22.4,
    "hamode": "auto",
    "mode": "auto"
  }
}
WouterKr commented 2 years ago

http://ems-esp/api/thermostat gives me:

{
  "id": 202,
  "hc1": {
    "seltemp": 21.4,
    "currtemp": 21.4,
    "hatemp": 21.4
  }
}

Seems like there is missing more than only the "hamode" ?

MichaelDvP commented 2 years ago

Logamatic TC100/Moduline Easy (DeviceID:0x18, ProductID:202, Version:02.22)

From this thermostat we know only a single monitor telegram and only two values out of 26. If there are other parameters to set/read you can help by starting a log-all from the webpage and change on the thermostat some values. Than download the log and post it here with a report what you have changed (e.g. set setpoint to 22, set mode to xy, set mode back to yz, ...) .

Seems like there is missing more than only the "hamode" ?

As far as i see the datetime is missing and should be there. For other values it depends on thermstat-type and what users help to identify. For instance the RC35 thermostat have a lot of identified values (with help of a lot of people): RC35_thermostat.txt

WouterKr commented 2 years ago

I hope i did the right thing by starting with a setpoint of 20 to 21,22,23 and back again and added the logfile. Please let me know I you need anything else. log.txt

WouterKr commented 2 years ago

Thank you for the quick fix! Just uploaded the firmware and now the hamode is set and no errors in HA core log anymore.

proddy commented 2 years ago

great, nice fix Michael.

MichaelDvP commented 2 years ago

log.txt

That's fine. But there are indeed no other data. Also there is no clock in that thermostat (because it does not have modes). 2021-08-20 10:20:55.431 TRACE 75: [emsesp] Thermostat(0x18) -> Me(0x0B), RCTime(0x06), data: <empty> The monitor telegram is long, but all values are zero, only setpoint and current temperature as already registered. 2021-08-20 10:20:56.653 TRACE 96: [emsesp] Thermostat(0x18) -> Me(0x0B), EasyMonitor(0x0A), data: 00 00 00 00 00 00 00 00 08 86 07 D0 00 00 00 00 00 00 00 00 00 00 00 00 00 00

@WouterKr Sorry, there are no more information from that thermostat.

@proddy The weblog sometimes creates double messages, I think i know what is the cause. I'll test and fix.

proddy commented 2 years ago

The weblog sometimes creates double messages, I think i know what is the cause. I'll test and fix.

@MichaelDvP thanks, and also I like what you did with the Level filter in the web UI so feel free to check in some of your other improvements too.

@WouterKr there are a few extensions to HA that work with the Easy-type thermostats, like https://github.com/bosch-thermostat/home-assistant-bosch-custom-component

WouterKr commented 2 years ago

Well if there is no more information to get then all is working then, thank you ;-) And thanks for the tip on the Bosch custom component in HA. Will look into it.

MichaelDvP commented 2 years ago

@proddy

@MichaelDvP thanks, and also I like what you did with the Level filter in the web UI so feel free to check in some of your other improvements too.

I'm not sure what you mean. For my personal preference i have completly removed all your filtering, show all messages that come from logger (up to set level). If changing the level in web-ui, all messages stay and only new messages come with new level. But i thought you prefer to show only messages with selected level. (this change in my build)

BTW: also offtopic here: do you think this can be a solution for km200 users? In normal operation polls come less than 10 sec, but in boiler-cold-start the master scans in order of id, 0x48 comes late and km sees no registered service-key before.

proddy commented 2 years ago

yes, I meant what you did in your own fork (I was being nosey). I like what you do by removing the filtering.

km200 - to be honest, I'm not sure what is causing the crash and what actually crashes. I don't like the Tx Delay so it's worth trying something different. Perhaps a few of us should put some cash together and buy a 2nd hand km200 unit? We'd learn a lot.

MichaelDvP commented 2 years ago

Ok, i'll merge. I wasn't sure this is the right way. Filtering messages and set log level seems double. My solution needs saving the loglevel to have the option to log from boot. Alternative solution is to keep filtering and always leave internal loglevel "all" for the buffer. Than it's possible to decide later which level should be displayed.