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.43k stars 30.67k forks source link

Gree Climate Temperature Units Incorrect #49768

Closed seantibor closed 3 years ago

seantibor commented 3 years ago

The problem

My new Gree Vireo+ is passing through the current temperature setting in C, even if the temperature units are set to F. Here is the output of the device info and properties. I believe the model number is VIR12HP115V1B.

If I set the units on the AC to celsius, it will pass through the temperature and convert it to the HA's system units of fairenheit.

Screen Shot 2021-04-27 at 9 57 18 AM

What is version of Home Assistant Core has the issue?

core-2021.4.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

gree

Link to integration documentation on our website

https://www.home-assistant.io/integrations/gree/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Tested using greeclimate module directly.
asyncio - DEBUG - Using selector: EpollSelector
libs.greeclimate.discovery - INFO - Scanning for Gree devices ...
libs.greeclimate.discovery - DEBUG - Listening for devices on 192.168.1.197
libs.greeclimate.discovery - DEBUG - Listening for devices on 172.18.0.1
libs.greeclimate.discovery - DEBUG - Listening for devices on 172.19.0.1
libs.greeclimate.discovery - DEBUG - Listening for devices on 172.17.0.1
greeclimate.network - DEBUG - Sending packet:
{"t": "scan"}
greeclimate.network - DEBUG - Sending packet:
{"t": "scan"}
greeclimate.network - DEBUG - Sending packet:
{"t": "scan"}
greeclimate.network - DEBUG - Sending packet:
{"t": "scan"}
greeclimate.network - DEBUG - Received packet from 192.168.1.122:
{"t": "pack", "i": 1, "uid": 0, "cid": "502cc62cc6ea", "tcid": "178a137c151d", "pack": {"t": "dev", "cid": "502cc62cc6ea", "bc": "", "brand": "gree", "catalog": "gree", "mac": "502cc62cc6ea", "mid": "10001", "model": "gree", "name": "c62cc6ea", "series": "gree", "vender": "1", "ver": "V1.2.1", "lock": 0}}
libs.greeclimate.discovery - INFO - Found gree device Device: c62cc6ea @ 192.168.1.122:7000 (mac: 502cc62cc6ea)
libs.greeclimate.device - INFO - Starting device binding to Device: c62cc6ea @ 192.168.1.122:7000 (mac: 502cc62cc6ea)
greeclimate.network - DEBUG - Sending packet:
{"cid": "app", "i": 1, "t": "pack", "uid": 0, "tcid": "502cc62cc6ea", "pack": {"mac": "502cc62cc6ea", "t": "bind", "uid": 0}}
greeclimate.network - DEBUG - Received packet:
{"t": "pack", "i": 1, "uid": 0, "cid": "502cc62cc6ea", "tcid": "178a137c151d", "pack": {"t": "bindok", "mac": "502cc62cc6ea", "key": "1Cd4Fg7Ij0Lm3Op6", "r": 200}}
libs.greeclimate.device - INFO - Bound to device using key 1Cd4Fg7Ij0Lm3Op6
root - DEBUG - Adding Gree device at 192.168.1.122:7000 (c62cc6ea)
libs.greeclimate.device - DEBUG - Updating device properties for (Device: c62cc6ea @ 192.168.1.122:7000 (mac: 502cc62cc6ea))
greeclimate.network - DEBUG - Sending packet:
{"cid": "app", "i": 0, "t": "pack", "uid": 0, "tcid": "502cc62cc6ea", "pack": {"mac": "502cc62cc6ea", "t": "status", "cols": ["hid"]}}
greeclimate.network - DEBUG - Received packet:
{"t": "pack", "i": 0, "uid": 0, "cid": "502cc62cc6ea", "tcid": "178a137c151d", "pack": {"t": "dat", "mac": "502cc62cc6ea", "r": 200, "cols": ["hid"], "dat": ["362001000762+U-CS532AE(LT)V3.31.bin"]}}
greeclimate.network - DEBUG - Sending packet:
{"cid": "app", "i": 0, "t": "pack", "uid": 0, "tcid": "502cc62cc6ea", "pack": {"mac": "502cc62cc6ea", "t": "status", "cols": ["Pow", "Mod", "SetTem", "TemSen", "TemUn", "TemRec", "WdSpd", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "StHt", "SvSt", "HeatCoolType"]}}
greeclimate.network - DEBUG - Received packet:
{"t": "pack", "i": 0, "uid": 0, "cid": "502cc62cc6ea", "tcid": "178a137c151d", "pack": {"t": "dat", "mac": "502cc62cc6ea", "r": 200, "cols": ["Pow", "Mod", "SetTem", "TemSen", "TemUn", "TemRec", "WdSpd", "Air", "Blo", "Health", "SwhSlp", "SlpMod", "Lig", "SwingLfRig", "SwUpDn", "Quiet", "Tur", "StHt", "SvSt", "HeatCoolType"], "dat": [1, 1, 23, 63, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0]}}
Props.POWER: 1
Props.MODE: 1
Props.TEMP_SET: 23
Props.TEMP_SENSOR: 63
Props.TEMP_UNIT: 1
Props.TEMP_BIT: 0
Props.FAN_SPEED: 0
Props.FRESH_AIR: 0
Props.XFAN: 0
Props.ANION: 1
Props.SLEEP: 0
Props.SLEEP_MODE: 0
Props.LIGHT: 1
Props.SWING_HORIZ: 0
Props.SWING_VERT: 0
Props.QUIET: 0
Props.TURBO: 1
Props.STEADY_HEAT: 0
Props.POWER_SAVE: 0
Props.UNKNOWN_HEATCOOLTYPE: 0

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

gree documentation gree source (message by IssueLinks)

probot-home-assistant[bot] commented 3 years ago

Hey there @cmroche, mind taking a look at this issue as its been labeled with an integration (gree) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

cmroche commented 3 years ago

Hey @seantibor thanks for the detailed info. It looks like Gree devices might be weirdly mixing use of F and C in the data, could I get you to capture a few more logs to help me understand this a bit better.

With debug logging enabled, could you change the temperature on the device (from within Home Assistant) then wait 5 minutes so I can see the result of polling state, and then send attach those logs please.

Thanks for your help.

seantibor commented 3 years ago

Sounds good -- do you want debug logging on just the gree component or the whole platform?

cmroche commented 3 years ago

I need debug info for components.gree and greeclimate please.

seantibor commented 3 years ago

home-assistant.log

let me know if this works. To me, it looks like it is always sending over C values regardless of the temperature units setting.

cmroche commented 3 years ago

Looking at the log, what I see is sending that the temperature was sent in celsius

021-04-27 11:06:36 DEBUG (MainThread) [greeclimate.device] Sending remote state update SetTem -> 24
2021-04-27 11:06:36 DEBUG (MainThread) [greeclimate.network] Sending packet:
{"cid": "app", "i": 0, "t": "pack", "uid": 0, "tcid": "502cc62cc6ea", "pack": {"opt": ["SetTem"], "p": [24], "t": "cmd"}}
2021-04-27 11:06:36 DEBUG (MainThread) [greeclimate.network] Received packet:
{"t": "pack", "i": 0, "uid": 0, "cid": "502cc62cc6ea", "tcid": "", "pack": {"t": "res", "mac": "502cc62cc6ea", "r": 200, "opt": ["SetTem"], "p": [24], "val": [24]}}

A couple of questions

What I am unsure of is if TemSen in fact should be in F, or it remains in C and TemUn is just there to let us know which unit the user has on the display (and is otherwise non-impacting on the integration side).

seantibor commented 3 years ago

here's what I know:

My sense is that TemUn is just letting us know what unit the user has on the display and at least for this firmware it's always reporting the TemSen in C regardless of the TemUn value.

cmroche commented 3 years ago

@seantibor This is great info! I need you to catch and report all my bugs :)

There is one other option, maybe the unit it being smart and falling back to C for TemSen because I didn't actually send TemUn when sending the new value, and fixing this would allow you to send 1 F increments to the unit as well. I'll investigate this... it's probably a better fix if true.

Would you be willing to help me test this once ready, I have a script here to install as a custom component easily and test more up to date features/bug fixes: https://github.com/cmroche/HA-GreeComponentInstaller

I could probably get something in place by the weekend.

seantibor commented 3 years ago

I'd be happy to test. I'm playing around with greeclimate in a local virtualenv to see if I can force TemUn to be added to the dirty list when the target temperature is set. Will let you know what I find...

cmroche commented 3 years ago

@seantibor No worries, I've already solved that problem locally to be honest and am trying to work out the correct formula for conversions from the reported temperatures in C from the device, so that I can report them correctly in F, such that setting something like 77F then returns a state update with 77F (and not 76F).

Largely I'm just time constrained, but this should be resolved by the weekend and I'll prep a version bump to test.

cmroche commented 3 years ago

@seantibor I pushed the fixes to the test repo, if you follow the instructions above. Please let me know how it goes.

seantibor commented 3 years ago

I tried the instructions in the repo and installed into my custom_components directory. I restarted the docker container for HASS and tried removing the existing gree installation config and re-adding. I'm now getting an error saying the config flow can't be loaded.

cmroche commented 3 years ago

@seantibor Ok, lets follow up over on the MR here: https://github.com/cmroche/greeclimate/pull/31 would you be able to post the error you are seeing.