esphome-panasonic-ac icon indicating copy to clipboard operation
esphome-panasonic-ac copied to clipboard

MQTT

Open autoSteve opened this issue 2 years ago • 7 comments

A question.

I've successfully set up ESPHome with this Panasonic code, which is brilliant by the way. But I can't wrap my head around how to get it talking via MQTT, though. (I've got HomeAssistant integrated with CBus via MQTT, and also want to trigger A/C messages to this code from a CBus automation controller via MQTT.)

Got any pointers / tips / examples / doco to read?

autoSteve avatar Jun 25 '22 06:06 autoSteve

hello.

i use mqtt with node-red flow. and domoticz for the topic's you need.

ac/climate/panasonic_sala/mode/command ac/climate/panasonic_sala/mode/state ac/climate/panasonic_sala/target_temperature/command ac/climate/panasonic_sala/fan_mode/command

everything works only presets-mode doesn't work. i don't now why.

redbullterror avatar Jun 25 '22 12:06 redbullterror

Looks like I'm on the right path now.

Added this to my yaml and esphome began populating status topics via mqtt. (Or it was, before I blew up the board... LOLs.) Presumably the commands work, based on your hint @redbullterror, although I've not tried those yet.

mqtt:
  broker: 192.168.xxx.xxx
  username: mqtt
  password: password
  
climate:
  - platform: panasonic_ac
    type: cnt
    name: Store AC

    mode_command_topic: storeac/climate/store_ac/mode/command
    swing_mode_command_topic: storeac/climate/store_ac/swing_mode/command
    fan_mode_command_topic: storeac/climate/store_ac/fan_mode/command
    target_temperature_command_topic: storeac/climate/store_ac/target_temperature/command

autoSteve avatar Jun 26 '22 13:06 autoSteve

As mentioned, the AC unit and all sensors/switches will automatically be exposed over MQTT as soon as you enable MQTT, you shouldn't have to define any topics manually unless you need to somehow redirect them somewhere else.

DomiStyle avatar Jun 27 '22 07:06 DomiStyle

I can see all topics through mqtt explorer. everything works with mqtt too. only preset doesn't work, only with home assistant it works to change preset. looks like he doesn't make topic for preset

redbullterror avatar Jun 30 '22 17:06 redbullterror

Looking at the ESPHome source it seems like the MQTT climate has no support for custom presets, so there's nothing I can do for now.

DomiStyle avatar Jul 01 '22 08:07 DomiStyle

@DomiStyle it strikes me as inefficent that every climate status update received from the Panasonic results in an MQTT publish. This appears to occur every five seconds, regardless of previous state, and only for the 'climate' topics ('select' topics are not). Is it possible to prevent climate status publish where the value is already known to the ESPHome code?

My CBus SHAC will be responding to every status update, and running code consuming CPU but doing nothing as there is almost always no status change for the A/C (except if something is genuinely changed). Persistent messages means I get current status on topic subscribe, so frequent updates are irrelevant.

autoSteve avatar Jul 03 '22 12:07 autoSteve

@ss4344 The integration currently does not save the previous state or compare to it when a new one arrives.

The polling interval is 5s for the CZ-TACG1 and 30s for the DNSK-P11. This mimics the behavior of the original wifi units.

Is it possible to prevent climate status publish where the value is already known to the ESPHome code?

Sure it is, but is has to be implemented here before parsing the packet.

I'm not planning to do that right now but feel free to open a separate issue for it so it can be tracked.

DomiStyle avatar Jul 26 '22 08:07 DomiStyle