dzungpv / mitsubishi2MQTT

Mitsubishi to MQTT with ESP8266/ESP32 module
GNU General Public License v3.0
68 stars 13 forks source link

MQTT HomeAssistant payload for uptime sensor is wrong in last release #39

Closed ollo69 closed 2 weeks ago

ollo69 commented 3 weeks ago

In last release the payload for the sensor uptime is wrong because some informations are missing:

{
  "icon": "mdi:clock",
  "name": "upTime",
  "unique_id": "hvac_xxxxx_uptime",
  "device": {
    "ids": "hvac-split1-sala",
    "name": "hvac-split1-sala",
    "sw": "2024.07.16",
    "mdl": "HVAC MITSUBISHI",
    "mf": "MITSUBISHI ELECTRIC",
    "cu": "http://192.168.10.147"
  }

In detail the value stat_t and val_tpl are not provided and so the content cannot be read.

HA show this error in log:

Error 'required key not provided @ data['state_topic']' when processing MQTT discovery message topic: 'homeassistant/sensor/hvac_xxxxx_uptime/config', message: '{'icon': 'mdi:clock', 'unique_id': 'hvac_xxxxx_uptime', 'device': {'identifiers': 'hvac-split1-sala', 'model': 'HVAC MITSUBISHI', 'sw_version': '2024.07.16', 'manufacturer': 'MITSUBISHI ELECTRIC', 'configuration_url': 'http://192.168.10.147', 'name': 'hvac-split1-sala'}, 'name': 'upTime', 'platform': 'mqtt'}'
dzungpv commented 2 weeks ago

Can you try to delete the device and reboot the module? For the the 2024.07.16 still display fine:

icon: mdi:clock
unique_id: hvac_xxxx_upTime
device:
  manufacturer: MITSUBISHI ELECTRIC
  model: HVAC MITSUBISHI
  identifiers: hvac_bedroom_one
  name: hvac_bedroom_one
  sw_version: Mitsubishi2MQTT 2023.12.4
  configuration_url: http://192.168.1.51
name: upTime
state_topic: hvac-xxxx/hvac_bedroom_one/state
value_template: '{{value_json.upTime}}'
platform: mqtt
ollo69 commented 2 weeks ago

Hi, I identify the problem, I was working on a PR to fix this but on this day I'm out of office. I will be able to submit my changes on next w.e. Just to give you a direction, the problem is that the HA sensor initialization code is changing the topics (replacing " " with "_" and setting all lowercase) and for this reason the value template become not available.

I'm also working on some optimization because the memory for Wemos D1 is limited and in most case it fails on publish of all topics.

dzungpv commented 2 weeks ago

I try to delete mine and see the problem, It will be fix soon

dzungpv commented 2 weeks ago

@ollo69 Fixed in 2024.08.28, you can download in the release session.