ginkage / MHI-AC-Ctrl-ESPHome

ESPHome integration for MHI-AC-Ctrl project
MIT License
107 stars 38 forks source link

Adding wireless remote temperature reading #92

Open persistive opened 5 months ago

persistive commented 5 months ago

At this moment two possibilities for room temperature readings are possible: internal temperature and an external wired sensor. I would like to use a temperature reading connected wireless to HA as the room temperature. I presume this should be possible but before i damage something in the software i would appriciate some help with this. Thanks in advance,

Paul

scottg88 commented 5 months ago

Hey Paul, conveniently this is precisely the reason for the HA service call which is surfaced by the device in the ESPHome YAML called set_api_room_temperature:

https://github.com/ginkage/MHI-AC-Ctrl-ESPHome/blob/master/lr_mhi_ac_ctrl.yaml#L50

It shows up as esphome.<ac_name>_set_api_room_temperature in Home Assistant when calling a service in an automation.

Like the comment the YAML says, you need to ensure you publish the value (whether it's changed or not) at a higher frequency than room_temp_api_timeout seconds, which by default is 120 seconds. This means more often than every 2 minutes. I chose to do it every 1 minute. If you don't do it in time, the temperature will fall back to the internal sensor automatically (which would cause weird behaviour if the AC kept swapping temperatures between the two).

Here's an example HA automation for you using a temperature sensor state:

alias: Set Room Temps
description: ""
trigger:
  - platform: time_pattern
    seconds: "0"
condition: []
action:
  - service: esphome.example_ac_set_api_room_temperature
    data:
      value: "{{ states('sensor.example_temperature') }}"
mode: single
persistive commented 5 months ago

Thanks Scottg88,

I saw to late that Eddydordt also opened a likewise issue I have used his propasal and that worked great. Yours is a little more extended, not sure if this will prevent future issues. For now many thanks for your contribution, i'm glad so many talented guys are willing to help.

persistive commented 5 months ago

Another question if i may. The remote Troom reading is working fine now. The only issue that i have is the 2 deg. offset between the setpoint and the remote (via bluetooth) measured Troom. With an external mounted temp sensor this offset can be corrected. Is that also possible for the remote bluetooth reading, and if so, how should this be done? Thanks in advance.

scottg88 commented 5 months ago

Yeah you can do maths in the home assistant automation to add an offset. You probably need to do it conditionally based on mode. In practical experience there's not really a flat offset, the overshoot depends on a lot on how you have things set and where your temperature sensor is. You'd have to experiment and adjust throughout the seasons to find what makes sense for each room.