home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.3k stars 30.62k forks source link

Issue with mqtt climate after #94832 modification #96208

Closed SeeeeebDe closed 1 year ago

SeeeeebDe commented 1 year ago

The problem

Hello all,

I just started having troubles after the last core update 2023.7 with the climate object.

I searched a while about what could have changed and just discovered this change : if I understand well the power_command_topic is no more used and the mode_command_topic must be used instead.

I try different configurations with no satisfying results.

In HA, now the flame button of the climate widget turns the heater on and the power buttons turns it off. With some change on the mode_command_template, it could also behave inversely (flame turns off and power turn on).

But in both case none of these two buttons could turns on and then off by it self.

The main issue is that this breaks the HomeKit integration that works with one button only, that is now frozen.

Anyone you knows of a fix could be brought ? Any update to connect it again correctly with HomeKit ?

What version of Home Assistant Core has the issue?

2023.7.1

What was the last working version of Home Assistant Core?

2023.6

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Mosquito Mqtt

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

# Mqtt
mqtt:

# JACUZZI
    climate:
       - name: "Jacuzzi"
         max_temp: 37
         min_temp: 18
         precision: 1.0
         temperature_unit: "C"
         modes:
            - "off"
            - "heat"
         mode_state_topic: "spa/message"
         mode_state_template: >-
          {% if value_json.RED == 1 %}
            heat
          {% elif value_json.GRN == 1 %}
            heat
          {% else %}
            off
          {% endif %}  
         action_topic: "spa/message"
         action_template: >-
          {% if value_json.RED == 1 %}
            heating
          {% elif value_json.GRN == 1 %}
            idle
          {% else %}
            off
          {% endif %}          
         temperature_state_topic: "spa/message"
         temperature_state_template: "{{ value_json.TGT }}"
         current_temperature_topic: "spa/message"
         current_temperature_template: "{{ value_json.TMP }}"
         temperature_command_topic : "spa/command"
         temperature_command_template: '{"CMD":0,"VALUE":{{ value|int }},"XTIME":0,"INTERVAL":0}'
         mode_command_topic: "spa/command"
         mode_command_template: '{"CMD":3,"VALUE":{{ 0 if value=="heat" else 1 }},"XTIME":0,"INTERVAL":0}'
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"

    sensor:
       - name: "Temperature jacuzzi"
         state_topic: "spa/message"
         value_template: "{{ value_json.TMP }}"
         unit_of_measurement: '°C'
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"
       - name: "Temperature consigne jacuzzi"
         state_topic: "spa/message"
         value_template: "{{ value_json.TGT }}"    
         unit_of_measurement: '°C'
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"

    switch:
       - name: "Filtre jacuzzi"
         state_topic: "spa/message"
         command_topic: "spa/command"
         value_template: "{{ value_json.FLT }}"
         payload_on: '{"CMD":4,"VALUE":1,"XTIME":0,"INTERVAL":0}'
         payload_off: '{"CMD":4,"VALUE":0,"XTIME":0,"INTERVAL":0}'
         state_on: 1
         state_off: 0
       - name: "Chauffage jacuzzi"
         state_topic: "spa/message"
         command_topic: "spa/command"
         value_template: >-
            {% if value_json.RED == 1 %}
                1
            {% elif value_json.GRN == 1 %}
                1
            {% else %}
                0
            {% endif %}  
         payload_on: '{"CMD":3,"VALUE":1,"XTIME":0,"INTERVAL":0}'
         payload_off: '{"CMD":3,"VALUE":0,"XTIME":0,"INTERVAL":0}'
         state_on: 1
         state_off: 0
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"
       - name: "Bulles jacuzzi"
         state_topic: "spa/message"
         command_topic: "spa/command"
         value_template: "{{ value_json.AIR }}"
         payload_on: '{"CMD":2,"VALUE":1,"XTIME":0,"INTERVAL":0}'
         payload_off: '{"CMD":2,"VALUE":0,"XTIME":0,"INTERVAL":0}'
         state_on: 1
         state_off: 0
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"

    binary_sensor:
       - name: "Chauffage jacuzzi"
         state_topic: "spa/message"
         value_template: "{{ value_json.RED }}"
         payload_on: 1
         payload_off: 0
         availability_topic: "spa/Status"
         payload_available: "Alive"
         payload_not_available: "Dead"

Anything in the logs that might be useful for us?

No response

Additional information

No response

home-assistant[bot] commented 1 year ago

Hey there @emontnemery, @jbouwh, mind taking a look at this issue as it has been labeled with an integration (mqtt) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `mqtt` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign mqtt` Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


mqtt documentation mqtt source (message by IssueLinks)

jbouwh commented 1 year ago

@SeeeeebDe Not sure what your problem is, I tried your config, and from that it seems possible to turn on and off the climate using mode_command_topic. Also if the state is received correctly via mode_state_topic. So I do not quite see what your problem is. At least this does not seems an issue with MQTT.

jbouwh commented 1 year ago

94832 should effect the behavior for your MQTT climate. May be an other change is.

SeeeeebDe commented 1 year ago

Hello Jan,

Thank you for helping.

I manage to operate some state changes using the widget buttons, but the issue is that the two buttons « flame » and « power » used to be reversible and to work independently one from each other, but it seems now to be linked : one turns off and the other turns on. Each button is no more reversible. And this is not compliant with HomeKit.

jbouwh commented 1 year ago

The state is set by the mode_state_stopic, what payload indicate an off or heat state? Are these sent after the mode command heat or off are sent?

jbouwh commented 1 year ago

If the state is correctly set, it also should work with HomeKit

jbouwh commented 1 year ago

Let me know if MQTT is working okay for you. I cannot discover an issue. Is this only an issue with HomeKit?

SeeeeebDe commented 1 year ago

Sorry I’ve not been really available. Yes mqtt works fine. I still manage turning heating on and off with the « chauffage jacuzzi » switch (both ok in HA and HomeKit)

This is the Climate entity that doesn’t work properly (both in the card in my HA dashboard and in HomeKit).

jbouwh commented 1 year ago

Okay, i am going to close this one as it seems I cannot do much here. At least it does not seem that there is an issue with MQTT.

SeeeeebDe commented 1 year ago

But Climate entity is part of mosquito mqtt integration, right ? When I said mqtt works fine, I was talking about mqtt communication (every other commands still works). only the climate entity has been affected

jbouwh commented 1 year ago

Not sure what you mean. There is nothing wrong with the climate entity. I suggest you have a look at the power_command_topic option. I assume Homekit will call service climate.turn_on or climate.turn_offf. Awake your MQTT climate using the power command topic, after that the climate should report back it's current mode. See also the MQTT release notes on the breaking changes. https://www.home-assistant.io/blog/2023/07/05/release-20237/#breaking-changes