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
584 stars 100 forks source link

Support multiple EMS-ESP's in HA #1196

Closed proddy closed 1 year ago

proddy commented 1 year ago

Discussed in https://github.com/emsesp/EMS-ESP32/discussions/1195

Originally posted by **g6094199** June 23, 2023 Hi, i have to ems-esp (with different names an different heating systems) in the network and try to connect them to 1 HA instance. i can see both ems in the mosquitto broker and they update nicely but HA seems to get fucked up. i see a mixture of settings ob both ems in the HA mqtt plugin. so is there something wrong. has this ever been tested? is this a ems or HA problem? or both in combination? sash

@g6094199

proddy commented 1 year ago

I'll see if changing ids in the device entry for HA's discovery topic helps here

  "dev": {
    "ids": [
      "ems-esp32"
    ]
proddy commented 1 year ago

Ok implemented this and will continue testing. Then will merge into the dev build.

g6094199 commented 1 year ago

plz report when there is a testable beta :-)

proddy commented 1 year ago

@g6094199 you can pick up the build & firmware with this fix at https://github.com/emsesp/EMS-ESP32/releases/tag/test

g6094199 commented 1 year ago

hi

i think we are almost there...

i flashed both units. one gets displayed as indendet (junkers-heatronic-wdb) but the other gets displayed as "unknown" (should be buderus-heatronic-da)). btw vendor should be prody, in any case.

image

.

proddy commented 1 year ago

Strange, I'll see if I can reproduce. Do make sure you remove all the MQTT before flashing, either from within HA or using something like MQTTExplorer

g6094199 commented 1 year ago

in mosquitto i see:

image

proddy commented 1 year ago

It looks like you're missing the main device called 'junkers-heatronic-wdb' in HA.

Can you use MQTTExplorer and show me the payload for the topic homeassistant/binary_sensor/junkers-heatronic-wdb/system_status/config.

If that doesn't exist find the topic with the word proddy in it, using the search.

If also may be good to check the HA logs.

g6094199 commented 1 year ago

{"uniq_id":"system_status","obj_id":"system_status","stat_t":"junkers-heatronic-wdb/status","name":"EMS-ESP status","pl_on":"online","pl_off":"offline","stat_cla":"measurement","dev_cla":"connectivity","ent_cat":"diagnostic","dev":{"name":"junkers-heatronic-wdb","sw":"v3.6.0-dev.13b","mf":"proddy","mdl":"EMS-ESP","cu":"http://192.168.1.144","ids":["junkers-heatronic-wdb"]}}

proddy commented 1 year ago

Sorry, can't reproduce. If I use junkers-heatronic-wdb as a MQTT base it adds the EMS-ESP system device correctly. I would need to see the system settings for both EMS-ESP devices to recreate your environment and see what is happening.

Did the HA logs tell you anything?

g6094199 commented 1 year ago

2023-07-12 21:50:47.911 DEBUG (MainThread) [homeassistant.components.mqtt.client] Received message on buderus-heatronic-da/boiler_data_ww (qos=0): b'{"wwsettemp":10,"wwseltemp":55,"wwtype":"Speicher","wwcomfort":"Hei\xc3\x9f","wwflowtempoffset":40,"wwcircpump":"an","wwchargetype":"3-Wege Ventil","wwhyston":-5,"wwhystoff":0,"wwdisinfectiontemp":60,"wwcircmode":"1x3min","wwcirc":"aus","wwcurtemp":31.5,"wwcurtemp2":31.5,"wwcurflow":0.0,"wwstoragetemp2":31.5,"wwactivated":"an","wwonetime":"aus","wwdisinfecting":"aus","wwcharging":"aus","wwrecharging":"aus","wwtempok":"aus","wwactive":"aus","ww3wayvalve":"aus","wwstarts":2934,"wwworkm":80786.0}' 2023-07-12 21:50:47.912 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"wwsettemp":10,"wwseltemp":55,"wwtype":"Speicher","wwcomfort":"Heiß","wwflowtempoffset":40,"wwcircpump":"an","wwchargetype":"3-Wege Ventil","wwhyston":-5,"wwhystoff":0,"wwdisinfectiontemp":60,"wwcircmode":"1x3min","wwcirc":"aus","wwcurtemp":31.5,"wwcurtemp2":31.5,"wwcurflow":0.0,"wwstoragetemp2":31.5,"wwactivated":"an","wwonetime":"aus","wwdisinfecting":"aus","wwcharging":"aus","wwrecharging":"aus","wwtempok":"aus","wwactive":"aus","ww3wayvalve":"aus","wwstarts":2934,"wwworkm":80786.0}' with variables {'entity_id': 'sensor.boiler_dhw_storage_extern_temperature', 'name': 'WW Externer Speichertemperatur', 'this': <template TemplateStateFromEntityId(sensor.boiler_dhw_storage_extern_temperature)>} and Template<template=({{'online' if value_json.wwstoragetemp2 is defined else 'offline'}}) renders=91> 2023-07-12 21:50:47.913 DEBUG (MainThread) [homeassistant.components.mqtt.models] Rendering incoming payload '{"wwsettemp":10,"wwseltemp":55,"wwtype":"Speicher","wwcomfort":"Heiß","wwflowtempoffset":40,"wwcircpump":"an","wwchargetype":"3-Wege Ventil","wwhyston":-5,"wwhystoff":0,"wwdisinfectiontemp":60,"wwcircmode":"1x3min","wwcirc":"aus","wwcurtemp":31.5,"wwcurtemp2":31.5,"wwcurflow":0.0,"wwstoragetemp2":31.5,"wwactivated":"an","wwonetime":"aus","wwdisinfecting":"aus","wwcharging":"aus","wwrecharging":"aus","wwtempok":"aus","wwactive":"aus","ww3wayvalve":"aus","wwstarts":2934,"wwworkm":80786.0}' with variables {'entity_id': 'sensor.boiler_dhw_storage_extern_temperature', 'name': 'WW Externer Speichertemperatur', 'this': <template TemplateStateFromEntityId(sensor.boiler_dhw_storage_extern_temperature)>} with default value 'default' and Template<template=({{value_json.wwstoragetemp2 if value_json.wwstoragetemp2 is defined else 0}}) renders=91> .......

but the unit buderus-heatronic-da doesnt show in HA.

image

but the units "kesseltemperatur" and "temperatursensor 1" seems to be part of buderus-heatronic-da (temp values match with the visible temperatures at the unit").

proddy commented 1 year ago

sorry what is the kesseltemperatur ? Is that coming from EMS-ESP?

g6094199 commented 1 year ago

"kesseltemperatur" is german for boiler temperature.

image

it must come from ems cause where should it alternativly come from? there are no not EMS devices in the network.

the "temperatursensor 1" has many WW entries and seems to hold the rest of the stuff.

image

also it seems we have also some sort of instability with ems. both units crash after some hours. since both devices are in different wifi networks with at least 20db snr its no wifi problem.

proddy commented 1 year ago

I still think it's old retained messages in your MQTT Broker, that need to be removed manually. As I mentioned earlier:

"Do make sure you remove all the MQTT before flashing, either from within HA or using something like MQTTExplorer"

g6094199 commented 1 year ago

missed that info.....will try and report back

g6094199 commented 1 year ago

nope. there is still something wrong,

i did: -unpowered both ems-esp units -removed EVERY (also under HA topic) topic on mosquitto regardin one of the units. -removed both units in HA -rebootet HA -powered buderus-heatronic-da only -only buderus-heatronic-da showed up in HA (

everything fine so far.

but then:

-powerded junkers-heatronic-wdb

and instantly HA gets scrambled like so :

image

mqtt-ae1d8fb3e7846b8056f3cc976520beae-buderus-heatronic-da Thermostat-6a5ba23b82f457dd306a7ca52cce2e38.json.txt

proddy commented 1 year ago

Ok, that's not good. Thanks for taking the time to remove everything and test it again.

I'll need reproduce your setup to see what is happening. Can you send me the config for both EMS-ESPs please? This is the JSON output from http://<the DNS or IP address>/api/system. Don't worry, no passwords are saved in this file. Then I'll test today and try and see what is happening.

g6094199 commented 1 year ago

emsesp_settings.json.txt

emsesp_settings(1).json.txt

MichaelDvP commented 1 year ago

"entity_format": 0, makes the uniqu_id identical, because it does not contain the base. You need set to multiple.

proddy commented 1 year ago

"entity_format": 0, makes the uniqu_id identical, because it does not contain the base. You need set to multiple.

I think that's it! I was just about to configure 2 EMS-ESPs and test but believe this is the problem.

@g6094199 in MQTT settings set the Discovery setting to 'Multiple Instances'

g6094199 commented 1 year ago

ok,didnt know about this setting...

both ems are now set to "Multiple Instances, short name" and it seems to show correctly.

image

proddy commented 1 year ago

fantastic!

We'll update the documentation with 3.6.0 is released.

Enjoy the free software! :)