Adjusting HVAC temperature with remote changes dashboard card temperature to celsius
Closed this issue · 10 comments
Adjusting my device's temperature using this integration with "celsius_mode" set to off properly updates the lovelace card to display the new temperature in Fahrenheit, however, adjusting the temperature via my device's remote causes the card to display temperature in Celsius until I make another adjustment via the card.
I'm fairly certain this is happening because my remote sends commands with "Celsius":"On" even though its screen displays the temperature in Fahrenheit. Would it be possible to account for this behavior in some way? Maybe a setting to convert the temperature in "IrReceived" events back to Fahrenheit if "celsius_mode" is set to off and the event has Celsius set to on?
Here's my IR blaster's console output when making an adjustment via the integration:
stat/ir_blaster/RESULT = {"IRHVAC":{"Vendor":"DAIKIN152","Model":-1,"Mode":"Auto","Power":"On","Celsius":"Off","Temp":64,"FanSpeed":"Low","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}
Here's the output when my remote is used:
tele/ir_blaster/RESULT = {"IrReceived":{"Protocol":"DAIKIN152","Bits":152,"Data":"0x11DA27000031250070000000000000C500009D","Repeat":0,"IRHVAC":{"Vendor":"DAIKIN152","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":18,"FanSpeed":"Max","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
This behaviour is fully correct. This is how it was ment to do. You set the card the reflect the same data like the remote itself. We are nor recalculating Fahrenheit to Celsius and vice versa. We just display what the remote sends. If remote sends the temperature in Celsius - we display it in Celsius. I'm not sure if I correctly understood what you are trying to achieve. You want the remote to set and display the AC's temperature in celsius, but in the HA card to set and show the temp in Fahrenheit?
My remote actually displays temperature in Fahrenheit: https://i.imgur.com/3sqZN4R.jpg
The issue arises when it sends commands to the AC unit, as it sends them in Celsius. If my IR device receives the signal, the card on my dashboard switches from 65°F to 18°F (even though "min_temp" is set to 64): https://i.imgur.com/BUhoAmk.png
I've been able to workaround this behavior by using "stat/ir_blaster/RESULT" as the state_topic, but this obviously means the card never stays in sync with the remote.
I'd like to keep using the remote to set the temperature in Celsius, but always display the temperature in Fahrenheit on HA so it matches the remote's display.
If there is a real remote control with a different unit for temperature display and data to be sent, it seems that we need to convert the unit according to the setting value of “celsius_mode”.
Are there cases where doing this unit conversion will have a negative effect?
I also think using the hass config value is a good idea.
if self.hass.config.units.temperature_unit == UnitOfTemperature.CELSIUS:
If there is a real remote control with a different unit for temperature display and data to be sent, it seems that we need to convert the unit according to the setting value of “celsius_mode”.
Are there cases where doing this unit conversion will have a negative effect?
I don't think there might be negative effect. We can check our config's "celsius_mode" against the incoming json payload and its "Celsius", and if they are different, we recalculate to show in the config's needed temperature unit.
I also think using the hass config value is a good idea.
if self.hass.config.units.temperature_unit == UnitOfTemperature.CELSIUS:
This is a good idea. But I think the default value should use it. If later someone wants to change it, there should be a way to do that. What do you think?
I also think that only the default values are sufficient for applying HA settings.
The problem with unit conversion is that reconverting even in 0.5°C increments will result in inconsistent values. Look at the following spreadsheet.
We wonder how we should implement this.
For reference, here is the console output from turning my device on at 64°F and adjusting it to 65°F and 66°F:
18:40:58.332 MQT: tele/ir_blaster/RESULT = {"IrReceived":{"Protocol":"DAIKIN152","Bits":152,"Data":"0x11DA27000031240030000000000000C500005C","Repeat":0,"IRHVAC":{"Vendor":"DAIKIN152","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":18,"FanSpeed":"Low","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
18:41:03.484` MQT: tele/ir_blaster/RESULT = {"IrReceived":{"Protocol":"DAIKIN152","Bits":152,"Data":"0x11DA27000031250030000000000000C500005D","Repeat":0,"IRHVAC":{"Vendor":"DAIKIN152","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":18,"FanSpeed":"Low","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
18:41:05.033 MQT: tele/ir_blaster/RESULT = {"IrReceived":{"Protocol":"DAIKIN152","Bits":152,"Data":"0x11DA27000031260030000000000000C500005E","Repeat":0,"IRHVAC":{"Vendor":"DAIKIN152","Model":-1,"Mode":"Cool","Power":"On","Celsius":"On","Temp":19,"FanSpeed":"Low","SwingV":"Off","SwingH":"Off","Quiet":"Off","Turbo":"Off","Econo":"Off","Light":"Off","Filter":"Off","Clean":"Off","Beep":"Off","Sleep":-1}}}
The commands don't include the 0.5 degree temperature increments necessary for Fahrenheit accuracy, so the device is relying on the data value to change temperature. Rather than try to parse the data, maybe the displayed temperature could be rounded up or down based on the last received value?
For example:
Command is received for 18 degrees and the dashboard displays 64°F. The next command received is also 18 degrees with no changes to any other values, so the dashboard displays 65°F. Since the remote doesn't let you directly specify temperatures it shouldn't be possible to send the exact same temperature twice in a row (unless you intentionally adjust up and down quickly).
The main caveat I see with this approach is that non-sequential adjustments in temperature may be off by a degree. Adjusting from 64°F to 69°F, for example, would send the command with a temperature value of 20 which is assumed to be 68°F based off the last command.
@HotshotGT Daikin air conditioners may support half-degree transmission for correct mapping from Celsius to Fahrenheit. IRremoteESP8266 library may not detect it. There is a related thread in the library issues. By providing the raw data of your real remote, it's possible to add some support, so I'd suggest making a request to the IRremoteESP8266 library.
The automatic HA conversion function has been used.