ThermIQ / thermiq_mqtt-ha

Home Assistant integration of ThermIQ-MQTT, providing control and logging of Thermia heatpumps
https://thermiq.net
MIT License
22 stars 19 forks source link

HA Intergration not sending MQTT #38

Closed saaerkk closed 1 year ago

saaerkk commented 1 year ago

Version of the custom_component

HACS 1.28.3 ThermIQ MQTT v1.3.5

Configuration

thermiq_mqtt: mqtt_node: ThermIQ/ThermIQ-room2 language: 'en' # Change friendly names of values. Implemented languages: en,se,fi,no,de thermiq_dbg: False

Describe the bug

After updating to HA 2022.11 I am not able to change variables via the HA intergration (example change Indoor temperature target -> 21C). The intergration does not send a MQTT message when I change the value in Lovelace The intergration does read the MQTT messages it gets from the ThermIQ-room2 and also via a HA automation to read in the indoor temperature sensor values also Node-Red messages are read by the intergration. I have checked that I am able to send messages via the HA MQTT broker and HA automations can send MQTT messages. I have been able to changes the variables before so the installation of ThermIQ MQTT intergration has been working. ThermIQ_MQTT Picture from MQTT Explorer, with data from the pump and 2 write one from Node-Red and the other from ThermIQ2 web

Dauzzen commented 1 year ago

I have the same issue. Home Assistant 2022.11.1.

ThermIQ commented 1 year ago

I will look into this the comming week together with the update for EVU function

DreamT80 commented 1 year ago

I have the same issue as well.

Dauzzen commented 1 year ago

75A8F4B5-94CC-4EA8-B00E-9170AB100190

ThermIQ commented 1 year ago

This is most likely due to some other input_select/input_number not being properly/fully configured. See this post in HA forum

DreamT80 commented 1 year ago

Unfortunately I still have problems. Have updated to v1.3.9 / core 2022.11.2 (in that order), and also uninstalled/reinstalled it from scratch. I see this in the logs:

2022-11-08 22:26:30.674 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/config/custom_components/thermiq_mqtt/__init__.py", line 177, in handle_home_assistant_started_event await create_entities_and_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 293, in create_entities_and_automations await create_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 308, in create_automations await add_automation(hass, OrderedDict(data), platform) File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 838, in _async_process_config automation_matches, config_matches = find_matches(automations, automation_configs) File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 826, in find_matches if automation_matches_config(automation, config): File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 805, in automation_matches_config return automation.name == name and automation.raw_config == config.raw_config AttributeError: 'str' object has no attribute 'name'

ThermIQ commented 1 year ago

Do you have any other intergrations or things configured?

I have run on a fresh installed HA 2022.11.2, +MQTT, +HACS, + required lovelace plugins without seeing this making it hard to debug further.

Can you post your configuration.yaml?

DreamT80 commented 1 year ago

I use several integrations. If I look at HACS i have Easee EV Charger, Blitzortung Lightning Detector, Xiaomi Cloud Map Extractor, Gardena Smart System, Node-RED Companion, Svensk Postutdelning, nordpool, and nordpool_diff. Kind of hard to know where to start...However I know that there were a Python version conflict between the Gardena and Easee a while ago, maybe this is a similar problem?

I'm not sure if I want to post my entire configuration.yaml, maybe it's enough with the TermIQ-specific config?

thermiq_mqtt: mqtt_node: ThermIQ/ThermIQ-room-bb language: 'se' # Change friendly names of values. Implemented languages: en,se,fi,no,de thermiq_dbg: False

barvidss commented 1 year ago

I'm having the same issue. Out of the integrations DreamT80 mentioned nordpool is the only one we have in common.

ThermIQ commented 1 year ago

Maybe try to disable them all and then enable one by one to see when it failing.

I will look into another way of implementing this in thermiq to make it more robust but I need help pinpointing on integration that fails so that I can debug myself

jessenclaus commented 1 year ago

Hi I also experince the same issue after update. I have also had the nordpool - tried to remove it but it dosen't help so even that this is a common thing between the posts it seems not to be the reason.

ThermIQ commented 1 year ago

Hi I've tried with HA 2022.11.2 and added the following integrations through HACS: Blitzortung Lightning Detector, Node-RED Companion, Svensk Post and nordpool

and ThermIQ still works. I couldn't find nordpool_diff in HACS.

Remains to be added: Easee EV Charger (but I have no account), Xiaomi Cloud Map Extractor, ,Gardena Smart System (is account needed?)

barvidss commented 1 year ago

I have neither of those integrations and still experience the same issue. Something must have happened with the 2022.11-update.

ThermIQ commented 1 year ago

Then try to disable integrations until till thermiq works. might be more than one other integration causing it

hillholder commented 1 year ago

Hi, same issue - have nordpool:

"2022-11-09 13:43:40.303 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration thermiq_mqtt which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-11-09 13:43:40.305 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-11-09 13:43:40.306 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration nordpool which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant 2022-11-09 13:44:04.005 WARNING (MainThread) [homeassistant.components.sensor] Setup of sensor platform nordpool is taking over 10 seconds. 2022-11-09 13:44:11.326 WARNING (MainThread) [homeassistant.helpers.service] Unable to find referenced entities input_number.thermiq_mqtt_indoor_requested_t or it is/they are currently not available" ... etc

BTW - if i remember right there were something Thermiq related automation(s) in /config/automation/dashboard before updates - now it/they seems to disappeared..

ThermIQ commented 1 year ago

The initial warnings can safely be ignored. They come before the first mqqt message is received.

ioT-enthusiast commented 1 year ago

75A8F4B5-94CC-4EA8-B00E-9170AB100190

I am havin the exact same issue (as describes in issue 37) and reference to components/automation/init.py:805 The lines in the thermiq-mqtt component are slightly shiftet, perhaps due to the latest update? I don't have the Nordpool integration installed. From HACS I only have "passive BLE monitor integration", "Deutscher Wetterdienst" and "ICS" installed.

Traceback (most recent call last): File "/config/custom_components/thermiq_mqtt/init.py", line 177, in handle_home_assistant_started_event await create_entities_and_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 293, in create_entities_and_automations await create_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 308, in create_automations await add_automation(hass, OrderedDict(data), platform) File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 838, in _async_process_config automation_matches, config_matches = find_matches(automations, automation_configs) File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 826, in find_matches if automation_matches_config(automation, config): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 805, in automation_matches_config return automation.name == name and automation.raw_config == config.raw_config AttributeError: 'str' object has no attribute 'name'

tgmos commented 1 year ago

75A8F4B5-94CC-4EA8-B00E-9170AB100190

I am havin the exact same issue (as describes in issue 37) and reference to components/automation/init.py:805 The lines in the thermiq-mqtt component are slightly shiftet, perhaps due to the latest update? I don't have the Nordpool integration installed. From HACS I only have "passive BLE monitor integration", "Deutscher Wetterdienst" and "ICS" installed.

Traceback (most recent call last): File "/config/custom_components/thermiq_mqtt/init.py", line 177, in handle_home_assistant_started_event await create_entities_and_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 293, in create_entities_and_automations await create_automations(hass) File "/config/custom_components/thermiq_mqtt/helper.py", line 308, in create_automations await add_automation(hass, OrderedDict(data), platform) File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 838, in _async_process_config automation_matches, config_matches = find_matches(automations, automation_configs) File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 826, in find_matches if automation_matches_config(automation, config): File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 805, in automation_matches_config return automation.name == name and automation.raw_config == config.raw_config AttributeError: 'str' object has no attribute 'name'

Same issue here

igalg99 commented 1 year ago

I have same issue. Glad to see it is not only me and it's more global problem I don't have any of the integrations mentioned above. It worked fine last time I tried to change something. But it was few weeks ago. Now everything I change via the integration and the dashboard is reverted. But if I change it on the heat pump it reads it fine. Basically it acts now as "read only"

ThermIQ commented 1 year ago

Please revert back to 1.3.5 for a known working setup.

ThermIQ commented 1 year ago

I need your help with the ha 2022.11 issue as I have a fully working setup. In order to debug it I need your help to set up a configuration that fails so please pinpoint to one specific config that fails.

igalg99 commented 1 year ago

Please revert back to 1.3.5 for a known working setup.

It actually didn't work from 1.3.5 When I noticed it doesn't work, I updated to latest version since I thought it would fix it. It didn't. I honestly cannot say when it appeared since only today I have noticed it. I am on HA 2022.11.1 . I was on 1.3.5 and it didn't work and then on latest. Hope it helps to get to the bottom of this.

Anything I try (for example the main room temperature) to change that should send a change to the heat pump, reverts back to same values. It's like changing but after few seconds it reads the info from the heat pump and updates back to the value that is in the heat pump. If I change value in heat pump directly, it does update in HA right away

tgmos commented 1 year ago

Reverted to 1.3.5 script and love_lace. Same issue, same error message. Animations works in 1.3.5.

ThermIQ commented 1 year ago

Then help me figure out why it breaks for you and works for.me with plain 2022.11.2

igalg99 commented 1 year ago

I am sorry for the silly question or claim . But are you positive it works for you ? When you change the parameter in the dashboard. Does it change in the heat pump itself? I honestly don't know how to recreate or trace back to a working state since it just appeared . The only changes I have done lately were updating HA. So I suspect it is related to that. I have now update to 2022.11.2 to see if it fixes it. But no. Still same issue. It changes, seems to be working but then changes back. Tried to restart already everything including the thermiq -mqtt module which connected to the heat-pump. Still works as "read only" , won't make changes in the heat pump.

And I seen mentioned above, about animations. They don't work on 1.3.9. but it's a different issue and not critical IMO

ThermIQ commented 1 year ago

Yes, it works in both read and write. Regardless of 1.3.5 or 1.3.9. The later does have other issues that will be fixed though...

The "connection/automation " btw input_number (what you can get Iin the ui) and the service of sending an mqtt message is broken by some other integration not being complete in its definition of input_number or input_select

Again, if you disable all integrations except thermiq will it work?

Give me ONE integration that makes thermiq fail so that I can debug why......

igalg99 commented 1 year ago

I have now tried that. Disabled all integrations except home assistant supervisor and HACS. Did a complete hard restart of the HA. Still not working. I don't know what else I can do.

DreamT80 commented 1 year ago

I haven't tried disabling the other integrations (I'm afraid it will mess upp a lot in my HA install), but instead i did a clean install of HassOS 9.3/core 2022.11.2 (a virtual machine), installed ThermIQ (v1.3.5, v1.3.9 didn't seem available right now?) and added the integrations one after another. This didn't break the the ThermIQ installation.

Could this be an upgrade related issue, where a configuration is created in a certain way, and gets broken when doing updates? Due to changes made in the HA core? I think that maybe HA is changed regarding how to match/add automations, which maybe affects automations that were added earlier.

Maybe the problem can be recreated in the following way?

ThermIQ commented 1 year ago

Thanks, I'll try that

tgmos commented 1 year ago

So this i what i got so far. Tried to downgrade both MQTT addon and Thermiq = No luck. Tried to downgrade HA Core without luck all the way down to -> 2022.10.0 = this version seams to work fine for me.

Working setup: CLI downgrade 2022.10.0 Thermiq 1.3.5 MQTT 6.1.3

Note sure if this is related to the issue but in HA 2022.10.5 "Add missed write state request for MQTT cover (@jbouwh - #80540) (mqtt docs)"

ThermIQ commented 1 year ago

@tgmos : Do you have aný other automations? The error message above comes when init:ing an automation.

I will try to run a Dev Container of 2022.10.0 and upgrade it to 2022.11.2 and see if that breaks stuff.

The debug in a virtual machine on a pc is actually quite good even for a beginner like me

tgmos commented 1 year ago

I have a lot of automations and addons. So i upgraded from 22.10 to 22.11.2 and it broke. Downgraded to 22.10 and still broken. So im not sure its version related. What i did to fix the issue now was to delete the mqtt thermiq information in mqtt explorer.

The above mentioned was not an error produced, just information from release notes for HA 22.10.5

ThermIQ commented 1 year ago

"What i did to fix the issue now was to delete the mqtt thermiq information in mqtt explorer."

Can you elaborate, i.e what steps where taken to brake, and fix, and what has MQTT Eplorer to do with it?

ThermIQ commented 1 year ago

Looking at the error message:

File "/usr/src/homeassistant/homeassistant/components/automation/init.py", line 805, in automation_matches_config return automation.name == name and automation.raw_config == config.raw_config AttributeError: 'str' object has no attribute 'name'

This is now functionality added to HA during autumn

tgmos commented 1 year ago

In HA, i tried to change targeted indoor temp and/or setting heatpump mode to off or auto. It looks like it works but reverts back to old state after some time. There is no mqtt write produced then changing. So after i confirmed that its not working i deleted the topics "ThermIQ -> ThermIQ-room-bb" and the announce topic in MQTT Explorer, then tried changing mode/temp again and it produces a write command, and iv confirmed it on the heatpump.

ThermIQ commented 1 year ago

HA: When changing an input_number it displays it's new value trigger an automation that sends an MQTT wite message. The heatpump changes it's value and confirms back with a complete register log which is used, again with an automation, to update the input_number.

When the write automation fails (or isn't installed or ...) you get the behaviour you describe

MQTT Explorer I don't understand how this can affect HA all

tgmos commented 1 year ago

You are right, disregard the above. The only thing i can say for sure is that 2022.10.5 works for me without disabling any addons or automations, but in 11.0 ThermIQ is broken for some reason.

HA Core 2022.10.5 Thermiq 1.3.5 MQTT 6.1.3

Started from HA 10.0, upgraded to 10.1, 10.2, 10.3, 10.4, 10.5 = ThermIQ functions as expected.. Tried to upgrade from 10.5 to 11.0 and then to 11.1 = broken. Tried from 10.5 directly to 11.2 still not working.

ThermIQ commented 1 year ago

I have now been able to reproduce the issue:

Restart and ThermIQ will now fail. I need to review the whole concept of "built in automations"

Dauzzen commented 1 year ago

Is it possible to manually adjust the value for the indoor room temperature? I mean - it's never possible to adjust that value directly on the heat pump manually - you have to go through the ThermIQ-module and it "sends" a value for the temperature, just as it was a real temperature sensor attached to the heat pump. Is there a way to temporarily do this manually from HA or through MQTT Explorer for example? As it is now, the indoor temperature defaults to 20.5 degrees.

DreamT80 commented 1 year ago

Is it possible to manually adjust the value for the indoor room temperature? I mean - it's never possible to adjust that value directly on the heat pump manually - you have to go through the ThermIQ-module and it "sends" a value for the temperature, just as it was a real temperature sensor attached to the heat pump. Is there a way to temporarily do this manually from HA or through MQTT Explorer for example? As it is now, the indoor temperature defaults to 20.5 degrees.

@Dauzzen , you can publish MQTT messages directly in HA, for example via an automation (the action MQTT: Publish is a way to go). I haven't used it myself (yet), but in theory this could work. There is also possible to publish MQTT commands in Node-Red if you're using that.

DreamT80 commented 1 year ago

@ThermIQ Anders, are you making any progress in this? I don't want to stress you or anything ("no cow on the ice" as we say in Sweden ;) ), but it would be nice to know if you see a solution in the near future? Else I might upgrade anyway and set values via home built automations instead.

ThermIQ commented 1 year ago

I believe the services are still working: thermiq_mqtt.write_id thermiq_mqtt.write_reg thermiq_mqtt.write_mode thermiq_mqtt.set_indr_t thermiq_mqtt.set_evu

You could give that a try. Then of course sending "raw" mqtt messages are possible with ha, nodeRed, MQTT-Explorer etc

ThermIQ commented 1 year ago

I'm halfway through a major restruct of the code to remove the need for manual entry into configuration.yaml and to alllow more than on heatpump. And of course, finding a way through for updating inputs and sending mqtt messages that is now broken.

It won't happen this week but likely ready in November (Year is intentionally left out)

DreamT80 commented 1 year ago

I believe the services are still working: thermiq_mqtt.write_id thermiq_mqtt.write_reg thermiq_mqtt.write_mode thermiq_mqtt.set_indr_t thermiq_mqtt.set_evu

You could give that a try. Then of course sending "raw" mqtt messages are possible with ha, nodeRed, MQTT-Explorer etc

Great! Can you give examples on how to use the services? Couldn't find it in the documentation. For the moment i'd like to set the requested indoor temp (which i guess I use thermiq_mqtt.set_indr_t with a value of 1?), and I'd also want to set the hotter starting temperature (.thermiq_mqtt_hotwater_start_t).

kheikola commented 1 year ago

@DreamT80 sending messages with Node-RED extension at least works nicely. To test setting indoor target temperature (d50) to 20 C, you could create an inject node with msg.payload = {"d50":20} And then have MQTT out node with your MQTT broker selected and with write topic: ThermIQ/ThermIQ-room2/write image Hotwater start temp would be d58, you can find the register list from the install guide: https://thermiq.net/ThermIQ_MQTT_Installation.pdf

@ThermIQ while restructuring the code, may I propose to include also HA entity for 'rssi' (wifi signal strength)?

DreamT80 commented 1 year ago

@DreamT80 sending messages with Node-RED extension at least works nicely. To test setting indoor target temperature (d50) to 20 C, you could create an inject node with msg.payload = {"d50":20} And then have MQTT out node with your MQTT broker selected and with write topic: ThermIQ/ThermIQ-room2/write image Hotwater start temp would be d58, you can find the register list from the install guide: https://thermiq.net/ThermIQ_MQTT_Installation.pdf

@ThermIQ while restructuring the code, may I propose to include also HA entity for 'rssi' (wifi signal strength)?

Thanks, @kheikola! I think I will use HA for sending messages, but the principle should the same when using MQTT.

It would however be nice to know how to use the thermiq_mqtt-service. The data should be the same (sending data to dXX), but I guess the payload should be formatted differently.

ThermIQ commented 1 year ago

Isn't there some info if you go to developer tools services and select it?

DreamT80 commented 1 year ago

Isn't there some info if you go to developer tools services and select it?

Yes, as soon as I understood how it worked.. :). Works fine. Thank you!

DreamT80 commented 1 year ago

I have some trouble setting a dynamic value, i.e. from a HA entity.

A static value works fine

service: thermiq_mqtt.write_id
data: {"register_id":"sensor.thermiq_mqtt_indoor_requested_t", "value":21.0}

But, I can't manage it to work with a dynamic value:

service: thermiq_mqtt.write_id
data: {"register_id":"sensor.thermiq_mqtt_indoor_requested_t", "value":{{ states('sensor.heat_capacitor_evaluated_heat') | float }} }

I get No MQTT message sent due to missing value:[21.0] in the log, hinting that the syntax probably isn't correct. But I don't know how to correct it..

ThermIQ commented 1 year ago

The brave can now try out the v2.0.0 release where this should be solved. Please note that the setup is now done through a graphical flow when adding the integration. Please remove all entries from configuration.yaml