geoffdavis / esphome-mitsubishiheatpump

ESPHome Climate Component for Mitsubishi Heatpumps using direct serial connection
BSD 2-Clause "Simplified" License
560 stars 153 forks source link

external sensor reverts back after setting #31

Open IsaacBreuer opened 3 years ago

IsaacBreuer commented 3 years ago

I followed the new instructions to use external temperature sensor, works great, but i believe it extremely important to add to instructions that if you are using a HA sensor and your HA is set to use Fahrenheit as mine is, you have to convert the ha value before passing it to HeatPump as

 - lambda: 'id(hp).set_remote_temperature((x-32) * 5/9);'

instead of

      - lambda: 'id(hp).set_remote_temperature(x);'

however, even after conversation, I still ha r some issue, the current temperature reported, keeps switching back and forth from external to builtin, I suspect that the rounding may cuase it to get value that set it back, I am now sure though

IsaacBreuer commented 3 years ago

see here my log from esphome that current temperature get randomly set to different what the set_remote_temperature did

['sensor.kitbt_temperature': Got state 66.70
[D][sensor:099]: 'kitbt from homeassistant': 
Sending state 66.70000  with 1 decimals of accuracy
[D][MitsubishiHeatPump:410]: Setting remote temp: 19.3
[D][sensor:099]: 'kit ac Uptime': Sending state 6765.68115 s with 0 decimals of accuracy
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -60.00000 dBm with 0 decimals of accuracy
[D][homeassistant.sensor:019]: 'sensor.kitbt_temperature': Got state 66.70
[D][sensor:099]: 'kitbt from homeassistant': Sending state 66.70000  with 1 decimals of accuracy
**[D][MitsubishiHeatPump:410]: Setting remote temp: 19.3**
[D][sensor:099]: 'kit ac Uptime': Sending state 6825.68311 s with 0 decimals of accuracy
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -59.00000 dBm with 0 decimals of accuracy
[D][homeassistant.sensor:019]: 'sensor.kitbt_temperature': Got state 66.90
[D][sensor:099]: 'kitbt from homeassistant': Sending state 66.90000  with 1 decimals of accuracy
**[D][MitsubishiHeatPump:410]: Setting remote temp: 19.4**
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: IDLE
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 20.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][sensor:099]: 'kit ac Uptime': Sending state 6885.68311 s with 0 decimals of accuracy
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: COOLING
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 20.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: COOLING
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 19.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: IDLE
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 19.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -60.00000 dBm with 0 decimals of accuracy
[D][sensor:099]: 'kit ac Uptime': Sending state 6945.68701 s with 0 decimals of accuracy
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -59.00000 dBm with 0 decimals of accuracy
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: IDLE
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 20.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][homeassistant.sensor:019]: 'sensor.kitbt_temperature': Got state 67.10
[D][sensor:099]: 'kitbt from homeassistant': Sending state 67.10000  with 1 decimals of accuracy
**[D][MitsubishiHeatPump:410]: Setting remote temp: 19.5**
[D][sensor:099]: 'kit ac Uptime': Sending state 7005.68213 s with 0 decimals of accuracy
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -60.00000 dBm with 0 decimals of accuracy
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: IDLE
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 19.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][sensor:099]: 'kit ac Uptime': Sending state 7065.68701 s with 0 decimals of accuracy
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: IDLE
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
**[D][climate:276]:   Current Temperature: 20.50°C**
[D][climate:282]:   Target Temperature: 21.00°C
[D][climate:262]: 'Kit AC' - Sending state:
[D][climate:265]:   Mode: COOL
[D][climate:267]:   Action: COOLING
[D][climate:270]:   Fan Mode: HIGH
[D][climate:273]:   Swing Mode: OFF
[D][climate:276]:   Current Temperature: 20.50°C
[D][climate:282]:   Target Temperature: 21.00°C
[D][sensor:099]: 'kit ac WiFi Signal': Sending state -59.00000 dBm with 0 decimals of accuracy
[D][homeassistant.sensor:019]: 'sensor.kitbt_temperature': Got state 67.10
[D][sensor:099]: 'kitbt from homeassistant': Sending state 67.10000  with 1 decimals of accuracy
[D][MitsubishiHeatPump:410]: Setting remote temp: 19.5
geoffdavis commented 3 years ago

Try forcing the math to be floats all the way through the conversion process by using decimal numbers instead of integers:

- lambda: 'id(hp).set_remote_temperature((x-32.0) * 5.0/9.0);'

I have to admit I got lazy and just switched my US-based install to "degrees of Communism" instead of "degrees of Freedom" to avoid a bunch of the artifacting issues with temperature conversions. Wife acceptance factor was diminished, but she got used to it eventually.

IsaacBreuer commented 3 years ago

unfortunately forcing the decimal point in the conversion did not resolve the issue, and for me to change my house to Communists setting as a no no for WAF.

On Fri, May 28, 2021 at 11:39 AM Geoff Davis @.***> wrote:

Try forcing the math to be floats all the way through the conversion process by using decimal numbers instead of integers:

  • lambda: 'id(hp).set_remote_temperature((x-32.0) * 5.0/9.0);'

I have to admit I got lazy and just switched my US-based install to "degrees of Communism" instead of "degrees of Freedom" to avoid a bunch of the artifacting issues with temperature conversions. Wife acceptance factor was diminished, but she got used to it eventually.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffdavis/esphome-mitsubishiheatpump/issues/31#issuecomment-850505427, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNS2YV64WP7AIGLWOSCJZ3TP62MVANCNFSM45WKJIIQ .

IsaacBreuer commented 3 years ago

Changing the system to C did not solve it for me either. i have also tried the following , exposing a HA sensor that is rounded to .5 C just to rule out rounding when my sensor actually show 20.70 , and was not resolved

On Fri, May 28, 2021 at 1:36 PM Isaac Breuer @.***> wrote:

unfortunately forcing the decimal point in the conversion did not resolve the issue, and for me to change my house to Communists setting as a no no for WAF.

On Fri, May 28, 2021 at 11:39 AM Geoff Davis @.***> wrote:

Try forcing the math to be floats all the way through the conversion process by using decimal numbers instead of integers:

  • lambda: 'id(hp).set_remote_temperature((x-32.0) * 5.0/9.0);'

I have to admit I got lazy and just switched my US-based install to "degrees of Communism" instead of "degrees of Freedom" to avoid a bunch of the artifacting issues with temperature conversions. Wife acceptance factor was diminished, but she got used to it eventually.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffdavis/esphome-mitsubishiheatpump/issues/31#issuecomment-850505427, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNS2YV64WP7AIGLWOSCJZ3TP62MVANCNFSM45WKJIIQ .

sijk commented 3 years ago

This could possibly be something to do with your heat pump model. From upstream issues (e.g. SwiCago/HeatPump#69, SwiCago/HeatPump#144) it sounds like there are two methods used by different models to set the remote temperature, and who knows if that covers everything? Either way, the relevant code is at https://github.com/SwiCago/HeatPump/blob/master/src/HeatPump.cpp#L248 if that helps.

IsaacBreuer commented 3 years ago

The function gets through successfully, but then after like 30 seconds reverts back , so I added a automation in HA to update a attribute for that particular sensor every 25 seconds, so far this work, but is just a workaround

On Fri, May 28, 2021, 5:45 PM sijk @.***> wrote:

This could possibly be something to do with your heat pump model. From upstream issues (e.g. SwiCago/HeatPump#69 https://github.com/SwiCago/HeatPump/issues/69, SwiCago/HeatPump#144 https://github.com/SwiCago/HeatPump/pull/144) it sounds like there are two methods used by different models to set the remote temperature, and who knows if that covers everything? Either way, the relevant code is at https://github.com/SwiCago/HeatPump/blob/master/src/HeatPump.cpp#L248 if that helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/geoffdavis/esphome-mitsubishiheatpump/issues/31#issuecomment-850691624, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABNS2YURERXCKSDF5O2JLCTTQAFJFANCNFSM45WKJIIQ .

akifbayram commented 2 years ago

The function gets through successfully, but then after like 30 seconds reverts back , so I added a automation in HA to update a attribute for that particular sensor every 25 seconds, so far this work, but is just a workaround

Can you share the automation you used to update the sensor? My attempts aren't updating the whole sensor. I'm having the same issue with my MVZ air handler. Reverts to onboard temp sensor after ~3 minutes.

EDIT: Added a heartbeat to the sensor in esphome. Seems to have solved my issue.

  - platform: homeassistant
    name: "Temperature Sensor From Home Assistant"
    entity_id: sensor.temperature_living_airgradient_forced
    on_value:
      then:
        - lambda: 'id(heatpump_main).set_remote_temperature((x-32.0) * 5.0/9.0);'
    filters:
      - heartbeat: 10s