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

MQTT Home-Assistant Template variable error #576

Closed makuser closed 1 year ago

makuser commented 2 years ago

Bug description ~/boiler_data does not contain boiler data for all boilers, when cascade is used

Steps to reproduce

  1. Connect ems-esp to an EMS bus with for example: Cascade MC400 and 4x Logamax Plus/GB192/Condens GC9000
  2. Enable MQTT
  3. Look at for example homeassistant/sensor/ems-esp/boiler_hs13_burnworkmin/config, which references hs13.burnworkmin in ~/boiler_data

Expected behavior MQTT Home Assistant Discovery works ~/boiler_data contains one dict per boiler

Logs

2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs1' when rendering '{{value_json.hs1.burnworkmin}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs1' when rendering '{{value_json.hs1.selflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs1' when rendering '{{value_json.hs1.selburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs1' when rendering '{{value_json.hs1.curflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs1' when rendering '{{value_json.hs1.curburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs5' when rendering '{{value_json.hs5.burnworkmin}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs5' when rendering '{{value_json.hs5.selflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs5' when rendering '{{value_json.hs5.selburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs5' when rendering '{{value_json.hs5.curflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs5' when rendering '{{value_json.hs5.curburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs9' when rendering '{{value_json.hs9.burnworkmin}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs9' when rendering '{{value_json.hs9.selflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs9' when rendering '{{value_json.hs9.selburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs9' when rendering '{{value_json.hs9.curflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs9' when rendering '{{value_json.hs9.curburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs13' when rendering '{{value_json.hs13.burnworkmin}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs13' when rendering '{{value_json.hs13.selflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs13' when rendering '{{value_json.hs13.selburnpow}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs13' when rendering '{{value_json.hs13.curflowtemp}}'
2022-07-19 11:34:37 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'dict object' has no attribute 'hs13' when rendering '{{value_json.hs13.curburnpow}}'

Device information

{
  "System Status": {
    "version": "3.4.1",
    "uptime": "000+00:21:52.977",
    "freemem": 107,
    "reset reason": "Software reset CPU / Software reset CPU"
  },
  "Network Status": {
    "connection": "WiFi",
    "hostname": "ems-esp",
    "RSSI": -82,
    "IPv4 address": "10.60.10.131/255.255.255.0",
    "IPv4 gateway": "10.60.10.1",
    "IPv4 nameserver": "10.60.10.1",
    "static ip config": false,
    "enable IPv6": false,
    "low bandwidth": false,
    "disable sleep": true,
    "AP provision mode": "disconnected",
    "AP security": "wpa2",
    "AP ssid": "ems-esp"
  },
  "NTP Status": {
    "network time": "connected",
    "enabled": true,
    "server": "pool.ntp.org",
    "tz label": "Europe/Prague"
  },
  "OTA Status": {
    "enabled": false,
    "port": 8266
  },
  "MQTT Status": {
    "MQTT status": "connected",
    "MQTT publishes": 948,
    "MQTT publish fails": 0,
    "enabled": true,
    "client_id": "ems-esp",
    "keep alive": 60,
    "clean session": true,
    "base": "ems-esp",
    "discovery prefix": "homeassistant",
    "nested format": 1,
    "ha enabled": true,
    "mqtt qos": 0,
    "mqtt retain": 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,
    "publish single": false,
    "publish2command": false,
    "send response": false
  },
  "Syslog Status": {
    "enabled": false
  },
  "Sensor Status": {
    "temperature sensors": 0,
    "temperature sensor reads": 0,
    "temperature sensor fails": 0
  },
  "API Status": {
    "API calls": 0,
    "API fails": 0
  },
  "Bus Status": {
    "bus status": "connected",
    "bus protocol": "HT3",
    "bus telegrams received (rx)": 3459,
    "bus reads (tx)": 517,
    "bus writes (tx)": 0,
    "bus incomplete telegrams": 0,
    "bus reads failed": 0,
    "bus writes failed": 0,
    "bus rx line quality": 100,
    "bus tx line quality": 100
  },
  "Settings": {
    "board profile": "E32",
    "tx mode": 2,
    "ems bus id": 11,
    "shower timer": false,
    "shower alert": false,
    "rx gpio": 5,
    "tx gpio": 17,
    "dallas gpio": 4,
    "pbutton gpio": 33,
    "led gpio": 2,
    "hide led": false,
    "notoken api": false,
    "readonly mode": false,
    "fahrenheit": false,
    "dallas parasite": false,
    "bool format": 1,
    "bool dashboard": 1,
    "enum format": 1,
    "analog enabled": false,
    "telnet enabled": true
  },
  "Devices": [
    {
      "type": "Boiler",
      "name": "Cascade MC400",
      "device id": "0x08",
      "product id": 210,
      "version": "02.04",
      "entities": 23,
      "handlers received": "0xBF 0xC2 0xD1 0xE3 0xE4",
      "handlers fetched": "0xE6",
      "handlers pending": "0x10 0x11 0x14 0x15 0x1C 0x18 0x19 0x1A 0x35 0x16 0x33 0x34 0x26 0x2A 0xE5 0xE9 0xEA",
      "handlers ignored": "0x06E4 0x06E8 0x0705 0x0706 0x0707 0x06DC 0x06E0"
    },
    {
      "type": "Boiler",
      "name": "Logamax Plus/GB192/Condens GC9000",
      "device id": "0x70",
      "product id": 208,
      "version": "01.04",
      "entities": 5,
      "handlers received": "0x06DC 0xE4",
      "handlers ignored": "0xD2"
    },
    {
      "type": "Boiler",
      "name": "Logamax Plus/GB192/Condens GC9000",
      "device id": "0x74",
      "product id": 208,
      "version": "01.04",
      "entities": 5,
      "handlers received": "0x06E0 0xE4",
      "handlers ignored": "0xD2"
    },
    {
      "type": "Boiler",
      "name": "Logamax Plus/GB192/Condens GC9000",
      "device id": "0x78",
      "product id": 208,
      "version": "01.04",
      "entities": 5,
      "handlers received": "0x06E4 0xE4",
      "handlers ignored": "0xD2"
    },
    {
      "type": "Boiler",
      "name": "Logamax Plus/GB192/Condens GC9000",
      "device id": "0x7C",
      "product id": 208,
      "version": "01.04",
      "entities": 5,
      "handlers received": "0x06E8 0xE4",
      "handlers ignored": "0xD2"
    },
    {
      "type": "Thermostat",
      "name": "RC300/RC310/Moduline 3000/1010H/CW400/Sense II",
      "device id": "0x10",
      "product id": 158,
      "version": "18.05",
      "entities": 89,
      "handlers received": "0x06 0x02BC 0x02BD 0x02BE 0x02BF 0x02C0 0x031D 0x0267",
      "handlers fetched": "0x02A5 0x02B9 0x02AF 0x029B 0x02A6 0x02BA 0x02B0 0x029C 0x02A7 0x02BB 0x02B1 0x029D 0x02F5 0x023A 0x0240",
      "handlers pending": "0xA3 0xA2 0x12 0x0471 0x0472 0x0473 0x02A8 0x02B2 0x029E 0x0474 0x02A9 0x02B3 0x029F 0x0475 0x02AA 0x02B4 0x02A0 0x0476 0x02AB 0x02B5 0x02A1 0x0477 0x02AC 0x02B6 0x02A2 0x0478 0x031B 0x031E",
      "handlers ignored": "0x02E1 0x02E2 0x02E3 0x02EB 0x02EC 0x02ED 0x033B 0x0292 0x0293 0x0291 0xBF"
    },
    {
      "type": "Mixer",
      "name": "MM100",
      "device id": "0x21",
      "product id": 160,
      "version": "24.05",
      "entities": 4,
      "handlers received": "0x02D8",
      "handlers ignored": "0x0255 0xBF"
    },
    {
      "type": "Mixer",
      "name": "MM100",
      "device id": "0x22",
      "product id": 160,
      "version": "24.05",
      "entities": 4,
      "handlers received": "0x02D9",
      "handlers ignored": "0x0255 0xBF"
    },
    {
      "type": "Mixer",
      "name": "MM100",
      "device id": "0x28",
      "product id": 160,
      "version": "24.05",
      "entities": 8,
      "handlers received": "0x0331",
      "handlers fetched": "0x0313",
      "handlers ignored": "0x0255 0xBF"
    },
    {
      "type": "Mixer",
      "name": "MM100",
      "device id": "0x20",
      "product id": 160,
      "version": "24.05",
      "entities": 4,
      "handlers received": "0x02D7",
      "handlers ignored": "0x0255 0xBF"
    }
  ]
}

Additional context MQTT Data: homeassistant/sensor/ems-esp/boiler_hs13_burnworkmin/config

{"~":"ems-esp","uniq_id":"boiler_hs13_burnworkmin","stat_t":"~/boiler_data","name":"Boiler hs13 total burner operating time","val_tpl":"{{value_json.hs13.burnworkmin}}","unit_of_meas":"minutes","ic":"mdi:clock-outline","state_class":"total_increasing","dev":{"ids":["ems-esp-boiler"],"name":"EMS-ESP Boiler","mf":"","mdl":"Logamax Plus/GB192/Condens GC9000","via_device":"ems-esp"}}

ems-esp/boiler_data

{"heatingactive":"off","tapwateractive":"off","selflowtemp":0,"selburnpow":0,"heatingpump2mod":0,"outdoortemp":28.4,"curflowtemp":65.2,"syspress":0,"burngas":"off","flamecurr":0,"heatingactivated":"on","heatingtemp":80,"burnminperiod":0,"burnminpower":0,"burnmaxpower":100,"boilhyston":-2,"boilhystoff":0,"curburnpow":0,"lastcode":"A01(1901) @uptime 21 - 2 min","servicecodenumber":0,"emergencyops":"off","emergencytemp":30}
MichaelDvP commented 2 years ago

Could you check with the latest dev build 3.4.2b3. The mqtt handling of multiple devices of same type have changed in 3.4.2.

proddy commented 1 year ago

Please re-open if it's still an issue