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

topic `ems-esp/thermostat_data` does not get updated #268

Closed balk77 closed 2 years ago

balk77 commented 2 years ago

Bug description The topic ems-esp/thermostat_data does not get updated. Actually, new topics are being issued but with old values. When the EMS devices gets restarted new values are being read and published, but nothing new after that. I own a Nefit Easy thermostat; although I am aware of the limitations this reading used to work properly until I installed 3.3.0.

Is there anything I can do to track the issue down?

Steps to reproduce Reboot of the EMS device results in fresh values. No updates after that. I have a long list of identical MQTT topics in MQTT Explorer.

Expected behavior Updated temperatures every now and then. It used to work with same hardware with earlier versions of EMS-ESP32.

Screenshots The MQTT output on ems-esp/thermostat_data stayed like this all day.

{"id":202,
  "hc1":{
    "seltemp":20,"currtemp":18.9,"hatemp":18.9,"hamode":"heat"
  }
}

while at the same time: Screenshot_2021-12-27-19-32-07-032_nl nefit easy main Also the web frontend shows the old values:

Screenshot 2021-12-27 at 19 39 00

Device information

{
  "System": {
    "version": "3.3.0",
    "uptime": "000+09:52:00.262",
    "uptime (seconds)": 35520,
    "freemem": 160,
    "reset reason": "Software reset CPU / Software reset CPU",
    "Dallas sensors": 0
  },
  "Network": {
    "connection": "WiFi",
    "hostname": "ems-esp",
    "SSID": "xyz",
    "BSSID": "xyz",
    "RSSI": -60,
    "MAC": "xyz",
    "IPv4 address": "192.168.4.28/255.255.255.0",
    "IPv4 gateway": "192.168.4.1",
    "IPv4 nameserver": "192.168.4.1"
  },
  "Status": {
    "bus status": "connected",
    "bus protocol": "Buderus",
    "telegrams received": 25448,
    "read requests sent": 43,
    "write requests sent": 0,
    "incomplete telegrams": 2,
    "tx fails": 0,
    "rx line quality": 100,
    "tx line quality": 100,
    "MQTT": "connected",
    "MQTT publishes": 11422,
    "MQTT publish fails": 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 0xC2 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)"
    }
  ]
}
proddy commented 2 years ago

can you post your settings?

proddy commented 2 years ago

Is there anything I can do to track the issue down?

Which version did it work on so I can do a comparison?

Take a look at https://emsesp.github.io/docs/#/Troubleshooting?id=mqtt-is-not-always-working

balk77 commented 2 years ago

Is there a better way to post settings than just a screenshot?

Screenshot 2021-12-28 at 10 02 59

I believe I had 3.2.1 installed. I don't think it is an MQTT issue because the same (wrong) values are listed on the front end which (I believe) feeds the MQTT module. But I will take a look later today.

proddy commented 2 years ago

You can download both the settings and info JSON files from the Help tab. Or call it directly via the API using a URL. I'll update the doc here to explain a little better. https://emsesp.github.io/docs/#/Support

balk77 commented 2 years ago

Here it is

{
  "System": {
    "version": "3.3.0"
  },
  "Network": {
    "hostname": "ems-esp",
    "static_ip_config": false,
    "enableIPv6": false
  },
  "AP": {
    "provision_mode": 1,
    "ssid": "ems-esp",
    "local_ip": "192.168.4.1",
    "gateway_ip": "192.168.4.1",
    "subnet_mask": "255.255.255.0"
  },
  "MQTT": {
    "enabled": true,
    "host": "192.168.0.7",
    "port": 1883,
    "username": "",
    "client_id": "ems-esp32",
    "keep_alive": 60,
    "clean_session": false,
    "publish_time_boiler": 10,
    "publish_time_thermostat": 10,
    "publish_time_solar": 10,
    "publish_time_mixer": 10,
    "publish_time_other": 10,
    "publish_time_sensor": 10,
    "ha_climate_format": 1,
    "ha_enabled": true,
    "mqtt_qos": 0,
    "mqtt_retain": false,
    "send_response": false
  },
  "NTP": {
    "enabled": true,
    "server": "192.168.0.7",
    "tz_label": "Europe/Amsterdam",
    "tz_format": "CET-1CEST,M3.5.0,M10.5.0/3"
  },
  "OTA": {
    "enabled": true,
    "port": 8266
  },
  "Settings": {
    "board_profile": "S32",
    "tx_mode": 2,
    "ems_bus_id": 11,
    "syslog_enabled": false,
    "syslog_level": 3,
    "syslog_mark_interval": 0,
    "syslog_host": "",
    "syslog_port": 514,
    "master_thermostat": 0,
    "shower_timer": false,
    "shower_alert": false,
    "rx_gpio": 23,
    "tx_gpio": 22,
    "dallas_gpio": 18,
    "pbutton_gpio": 0,
    "led_gpio": 2,
    "phy_type": 0,
    "hide_led": true,
    "notoken_api": false,
    "dallas_parasite": false,
    "dallas_format": 1,
    "bool_format": 1,
    "enum_format": 1,
    "analog_enabled": false
  }
}

and some telegrams from the console:

000+08:40:19.551 N 691: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 85 0A 00 01 01 40 40 01 5C 80 00 01 6B 00 00 12 30 45 01 09 00 00 00
000+08:40:29.747 N 692: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 84 0A 00 01 01 40 40 01 5B 80 00 01 6B 00 00 12 30 45 01 09 00 00 00
000+08:40:39.208 N 693: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 84 0A 00 01 01 40 40 01 5B 80 00 01 6B 00 00 12 30 45 01 09 00 00 00
000+08:40:49.955 N 694: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAMonitorFast(0x18), data: 18
000+08:40:50.025 N 695: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAMonitorFast(0x18), data: 41 01 83 0A 00 01 01 40 40 01 5B 80 00 01 6C 00 00 12 30 45 01 09 00 00
000+08:40:50.072 N 696: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 83 0A 00 01 01 40 40 01 5B 80 00 01 6C 00 00 12 30 45 01 09 00 00 00
000+08:40:59.788 N 697: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 82 0A 00 01 01 40 40 01 5B 80 00 01 6C 00 00 12 30 45 01 09 00 00 00
000+08:41:04.527 N 698: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAParameters(0x16), data: 02 (offset 1)
000+08:41:04.572 N 699: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAParameters(0x16), data: 41 49 (offset 1)
000+08:41:04.869 N 700: [emsesp] Thermostat(0x18) -> Boiler(0x08), RCTime(0x06), data: 15 0C 0B 1D 29 04 02 00
000+08:41:05.351 N 701: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAMaintenanceStatus(0x1C), data: 08
000+08:41:05.403 N 702: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAMaintenanceStatus(0x1C), data: 95 09 0D 13 1C 00 00 00
000+08:41:05.734 N 703: [emsesp] Thermostat(0x18) -> Boiler(0x08), UBASetPoints(0x1A), data: 41 0A
000+08:41:06.073 N 704: [emsesp] Thermostat(0x18) -> Boiler(0x08), UBAFlags(0x35), data: 01
000+08:41:06.500 N 705: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAParameterWW(0x33), data: 01 (offset 2)
000+08:41:06.545 N 706: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAParameterWW(0x33), data: 3C (offset 2)
000+08:41:09.260 N 707: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 82 0A 00 01 01 40 40 01 5A 80 00 01 6C 00 00 12 30 45 01 09 00 00 00
000+08:41:15.384 N 708: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 82 0A 00 01 01 04 40 01 5A 80 00 01 6C 00 00 12 2D 48 00 C8 00 02 00
000+08:41:15.736 N 709: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAMonitorFast(0x18), data: 18
000+08:41:15.789 N 710: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAMonitorFast(0x18), data: 41 01 82 0A 00 01 01 04 40 01 5A 80 00 01 6C 00 00 12 2D 48 00 C8 00 02
000+08:41:19.274 N 711: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 80 0A 00 01 01 24 40 01 5A 80 00 01 6C 00 00 12 30 4C 01 1C 00 02 00
000+08:41:20.231 N 712: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 80 0A 00 01 01 2D 40 01 5A 80 00 01 6C 00 00 12 2D 48 00 C8 00 02 00
000+08:41:21.240 N 713: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 82 0A 00 09 01 2D 40 01 5A 80 00 01 6C 00 CE 12 2D 48 00 C8 00 02 00
000+08:41:22.224 N 714: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 83 0A 00 09 01 25 40 01 5A 80 00 01 6C 00 EA 13 2D 48 00 C8 00 02 00
000+08:41:23.240 N 715: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 85 0A 31 09 01 25 40 01 5A 80 00 01 6C 01 07 14 2D 48 00 C8 00 02 00
000+08:41:24.230 N 716: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 88 0A 32 09 01 25 40 01 5A 80 00 01 68 01 14 14 2D 48 00 C8 00 02 00
000+08:41:26.247 N 717: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 90 0A 2D 09 01 25 40 01 5A 80 00 01 64 01 0E 14 2D 48 00 C8 00 02 00
000+08:41:28.236 N 718: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 A0 0A 28 09 01 25 40 01 5A 80 00 01 60 01 05 14 2D 48 00 C8 00 02 00
000+08:41:29.363 N 719: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 A8 0A 26 09 01 25 40 01 5A 80 00 01 60 01 06 14 2D 48 00 C8 00 02 00
000+08:41:30.287 N 720: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 B0 0A 26 09 01 25 40 01 5A 80 00 01 60 01 07 14 2D 48 00 C8 00 02 00
000+08:41:31.222 N 721: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 B8 0A 26 09 01 25 40 01 5A 80 00 01 5F 01 08 14 2D 48 00 C8 00 02 00
000+08:41:33.235 N 722: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 C8 0A 26 09 01 25 40 01 5A 80 00 01 5F 01 0A 14 2D 48 00 C8 00 02 00
000+08:41:34.345 N 723: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 CE 0A 26 09 01 25 40 01 5A 80 00 01 5E 01 0B 14 2D 48 00 C8 00 02 00
000+08:41:36.294 N 724: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 D9 0A 26 09 01 25 40 01 5A 80 00 01 5E 01 0C 14 2D 48 00 C8 00 02 00
000+08:41:38.226 N 725: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 E1 0A 26 09 01 25 40 01 5A 80 00 01 5E 01 0C 14 2D 48 00 C8 00 02 00
000+08:41:39.219 N 726: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 E4 0A 26 09 01 25 40 01 58 80 00 01 5D 01 0D 14 2D 48 00 C8 00 02 00
000+08:41:41.234 N 727: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 EA 0A 26 09 01 25 40 01 5A 80 00 01 5C 01 0E 14 2D 48 00 C8 00 02 00
000+08:41:46.354 N 728: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 F5 0A 26 09 01 25 40 01 5A 80 00 01 57 01 0E 14 2D 48 00 C8 00 02 00
000+08:41:49.216 N 729: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 FB 0A 26 09 01 25 40 01 5A 80 00 01 56 01 0F 14 2D 48 00 C8 00 02 00
000+08:41:49.440 N 730: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 FB 0A 26 09 01 25 40 01 58 80 00 01 56 01 11 14 2D 48 00 C8 00 02 00
000+08:41:51.327 N 731: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 01 FE 0A 26 09 01 25 40 01 58 80 00 01 56 01 10 14 2D 48 00 C8 00 02 00
000+08:41:59.288 N 732: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 02 08 0A 26 09 01 25 40 01 5A 80 00 01 51 01 0F 14 2D 48 00 C8 00 02 00
000+08:42:00.253 N 733: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 02 08 0A 26 09 01 25 40 01 5A 80 00 01 50 01 10 14 2D 48 00 C8 00 02 00
000+08:42:04.400 N 734: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAParameters(0x16), data: 02 (offset 1)
000+08:42:04.446 N 735: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAParameters(0x16), data: 41 49 (offset 1)
000+08:42:04.860 N 736: [emsesp] Thermostat(0x18) -> Boiler(0x08), RCTime(0x06), data: 15 0C 0B 1D 2A 04 02 00
000+08:42:05.175 N 737: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAMaintenanceStatus(0x1C), data: 08
000+08:42:05.227 N 738: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAMaintenanceStatus(0x1C), data: 95 09 0D 13 1C 00 00 00
000+08:42:05.636 N 739: [emsesp] Thermostat(0x18) -> Boiler(0x08), UBASetPoints(0x1A), data: 41 0A
000+08:42:05.921 N 740: [emsesp] Thermostat(0x18) -> Boiler(0x08), UBAFlags(0x35), data: 01
000+08:42:06.374 N 741: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAParameterWW(0x33), data: 01 (offset 2)
000+08:42:06.419 N 742: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAParameterWW(0x33), data: 3C (offset 2)
000+08:42:09.284 N 743: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 02 0C 0A 26 09 01 25 40 01 5A 80 00 01 4C 01 0F 14 2D 48 00 C8 00 02 00
000+08:42:15.622 N 744: [emsesp] Thermostat(0x18) <- Boiler(0x08), UBAMonitorFast(0x18), data: 18
000+08:42:15.691 N 745: [emsesp] Boiler(0x08) -> Thermostat(0x18), UBAMonitorFast(0x18), data: 41 02 0F 0A 26 09 01 25 40 01 5B 80 00 01 47 01 0E 14 2D 48 00 C8 00 02
000+08:42:19.547 N 746: [emsesp] Boiler(0x08) -> All(0x00), UBAMonitorFast(0x18), data: 41 02 0F 0A 26 09 01 25 40 01 5C 80 00 01 46 01 0F 14 2D 48 00 C8 00 02 00
proddy commented 2 years ago

Everything looks fine. I Can't think of what can be causing it. Try the ideas in https://emsesp.github.io/docs/#/Troubleshooting?id=mqtt-is-not-always-working and also look at the Mosquitto logs

MichaelDvP commented 2 years ago

I see some strange things:

"uptime": "000+09:52:00.262",
"telegrams received": 25448,
 "read requests sent": 43,

normaly emsesp send every minute, this much to low sendings, do you have set tx-mode 0 for a while?

Also the log does not show any telegram send to emsesp, it's 2 minutes but no request. And the log does not contain any 0x0A telegram from thermostat, but this telegram holds the roomtemp and seltemp.

Can you switch to tx-mode 1 and read the telegrams in telnet: read 18 0a

BTW: the 0x0A telegram should be 26 databytes, but we know only 4 of them, there is some more information from thermstat.

proddy commented 2 years ago

@balk77 any update on this? Do you still want us to look into it?

balk77 commented 2 years ago

I see some strange things:

"uptime": "000+09:52:00.262",
"telegrams received": 25448,
 "read requests sent": 43,

normaly emsesp send every minute, this much to low sendings, do you have set tx-mode 0 for a while?

Also the log does not show any telegram send to emsesp, it's 2 minutes but no request. And the log does not contain any 0x0A telegram from thermostat, but this telegram holds the roomtemp and seltemp.

Can you switch to tx-mode 1 and read the telegrams in telnet: read 18 0a

BTW: the 0x0A telegram should be 26 databytes, but we know only 4 of them, there is some more information from thermstat.

Sorry, I was distracted by the year-end activities.... Issue is still present but worked around (I am reading through the Nefit Easy custom component instead of ems-esp). The tx-mode was set at 2, now set at 1 (after the below stats were produced).

ems-esp:$ show ems
EMS Bus is connected.

EMS Bus info:
  Tx mode: 2
  Bus protocol: Buderus
  #telegrams received: 40715
  #read requests sent: 93
  #write requests sent: 0
  #incomplete telegrams: 22
  #tx fails (after 3 retries): 8
  Rx line quality: 100%
  Tx line quality: 92%

Rx Queue is empty

Tx Queue is empty

Result of read 18 0a

000+19:12:46.332 N 4: [emsesp] Thermostat(0x18) -> Me(0x0B), EasyMonitor(0x0A), data: 00 00 00 00 00 00 00 00 08 07 08 02 00 0D 37 A5 10 0E 00 00 00 0D 00 00 00 00
MichaelDvP commented 2 years ago

I think this is the same as #282, the easy monitor needs to be fetched and this is stopped after a tx-error. In v3.4 this is fixed in PR#287. @balk77 Would you like to try with the alpha v3.4, compiled builds are published on discord and in #294, or wait for a fix in dev? @proddy Ill make a PR to dev to fix it before you release v3.3.1.

proddy commented 2 years ago

Ok I'll wait before releasing 331

balk77 commented 2 years ago

@MichaelDvP that works! Topics get updated after installing the alpha version listed in #294 . Thanks (and also @proddy !!!!!) for your help 👍 and for creating this fine piece of firmware 🥇