Climate error after update to 0.103.3

Hello,

I have hass.io running on proxmox/debian x86, with the “Mosquitto Broker” add-on on the same virtual machine providing MQTTS on port 8883. Last night I updated to 0.103.3 and now I get errors in my log and my climate.mitsubishi_mqtt entries are “unavailable”.
They are also unsupported and locally modified by me, so I’m not expecting much help. I guess I’m just going to paste this here to help anyone else wandering into the same issue.
I reverted to 0.103.0 and now things are working again: with only the “custom integration”/“stability problems” warning and no errors. For now it is Christmas, I expect I will have more time to review this after 3 Jan.

In the log I see:

2019-12-23 01:45:59 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for mitsubishi_mqtt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-12-23 01:46:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 406, in _async_add_entity
    await entity.async_added_to_hass()
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 103, in async_added_to_hass
    await self._subscribe_topics()
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 164, in _subscribe_topics
    self.hass, self._sub_state, topics)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 83, in async_subscribe_topics
    await requested.resubscribe_if_necessary(hass, current)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 40, in resubscribe_if_necessary
    hass, self.topic, self.message_callback, self.qos, self.encoding
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 433, in async_subscribe
    async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'
2019-12-23 01:46:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 406, in _async_add_entity
    await entity.async_added_to_hass()
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 103, in async_added_to_hass
    await self._subscribe_topics()
  File "/config/custom_components/mitsubishi_mqtt/climate.py", line 164, in _subscribe_topics
    self.hass, self._sub_state, topics)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 83, in async_subscribe_topics
    await requested.resubscribe_if_necessary(hass, current)
  File "/usr/src/homeassistant/homeassistant/components/mqtt/subscription.py", line 40, in resubscribe_if_necessary
    hass, self.topic, self.message_callback, self.qos, self.encoding
  File "/usr/src/homeassistant/homeassistant/components/mqtt/__init__.py", line 433, in async_subscribe
    async_remove = await hass.data[DATA_MQTT].async_subscribe(
KeyError: 'mqtt'

This suggests to me that either the method of manipulating mqtt in the python has changed, or I walked into a corner in the latest version.

My relevant configuration.yaml lines are:

mqtt:
  broker: core-mosquitto
  username: !secret mqtt_core_user
  password: !secret mqtt_core_password
  discovery: true

climate:
  - platform: mitsubishi_mqtt
    name: "Lounge Heatpump"
    command_topic: "hp/lohp/set"
    temperature_state_topic: "hp/lohp/status"
    state_topic: "hp/lohp/status"

(and a second one very similar). Probably why there are two errors logged.

Outside Home Assistant, I can interact with the heatpump by mosquitto_sub and mosquitto_pub to the topics; it’s only the custom_component that is not happy.

The custom component is from https://github.com/SittingDuc/HeatPump/blob/bb4a4a37d682b61e197b0ccd6893f6c846c37f5e/integrations/home-assistant.io/custom_components/mitsubishi_mqtt/climate.py (all thanks to SwiCago for the original code). I see liberal use of MQTT calls, but no mention of “async” and that may be what I fell afoul of.

TL;DR

Updating hass.io x86 to 0.103.3 broke climate.mitsubishi_mqtt, an unsupported custom_component forked from github. Log messages suggest an issue with MQTT and an asynchronous call. Workaround is to roll back to 0.103.0

Cheers!

I am having same issue with same custom component.
Still cannot understand the problem.

Same issue here aswell, no solution so far.

Yes , Same issue

0.103.5 also fails in the same way. Time to see what I can see

While investigating, I have news good and bad.

The good is, someone has worked out how to make SwiCago’s MQTT topics work with the “climate” integration, without the custom component. configuration.yaml example

The bad news is, this means I no longer need to work out why my custom component fails when it attempts to add itself to hass:

async def async_added_to_hass(self):
        """Handle being added to home assistant."""
        await super().async_added_to_hass()
        await self._subscribe_topics()

Even more interesting, someone else has forked SwiCago’s code and made it work with Hass AutoDiscovery. But that will require me to change the topics I publish on. Hmm…
https://github.com/unixko/MitsuCon

i’m using https://github.com/dzungpv/mitsubishi2MQTT with mosquitto in the last week and it working good beside one problem.
when the AC is set to on, the first few minutes the current temperature is reported wrong

looks like there is newer version

1 Like

Native code working fine with 0.103.5

I got it working on Home Assistant 0.104.3 by editing custom_components/mitsubishi_mqtt/manifest.json

"dependencies": ["mqtt"]

I found the solution here
https://github.com/home-assistant/home-assistant/issues/30540

New version 0.4.9 will fix your problem include more feature:

1 Like

Thanks a lot.
i installed it and its working fine