RobHofmann / HomeAssistant-GreeClimateComponent

Custom Gree climate component written in Python3 for Home Assistant. Controls AC's supporting the Gree protocol.
GNU General Public License v3.0
286 stars 102 forks source link

Get current temperature from internal sensor #89

Open janmashat opened 3 years ago

janmashat commented 3 years ago

First off, great job on this project!

I've noticed this in your README:

Gree unfortunately doesnt support a "current temperature" on its own.

However I found:

some ACs report current room temperature with the TemSen property https://github.com/tomikaa87/gree-remote/issues/31

Have you considered adding support for this?


OFF-TOPIC: I needed to add another generic_thermostat (actually dualmode_generic in my case) to switch your component on/off because your thermostat doesn't seem to turn off the AC after reaching the desired temperature - but I guess that's because you designed your thermostat to work in the same manner as the official remote (which doesn't turn the unit on/off automatically) - and that's fine.

RobHofmann commented 3 years ago

I haven't seen/considered this, nor do I have the devices to test this with. But feel free to implement support for this and make a PR 👍 .

Regarding your offtopic: Correct. Climate control is made to set to a certain temperature and get & stay at that temperature by itself.

janmashat commented 3 years ago

When you say you don't have any devices to test this with, do you mean that you don't have a TEMP button on your physical remote (to let you see the current temp on the digital display)? Because otherwise (if you are able to see the current temp) it may be necessary to downgrade the firmware in order to get the TemSen property to return proper data: https://github.com/inwaar/gree-hvac-client/pull/11#issuecomment-652371700

I haven't yet attempted the firmware downgrade myself as I still have a couple sonoffs that include temp sensors.

Regarding the offtopic: I guess you mean that your component is only able to set a target temperature but it is the AC unit's job to maintain that temperature. So basically, if only your component is used, it's best to set the fan mode to Auto. Otherwise, setting a different fan mode over a longer duration remains efficient only if another thermostat component is added to maintain the temperature (by turning your component on/off).

RobHofmann commented 3 years ago

Ah, I dont want to do any downgrading or fiddling on those devices. They work fine right now as they do exactly what I want.

And yes, its the unit's job to maintain a certain temperature. Getting the room to a certain temperature takes a significant amount of energy, but keeping it at that temperature does not (or at least its more efficient). So on extreme hot or cold days I automatically turn the AC's on when we are home and let them run until the heat/cold period is gone or we leave the house.

This might different for each type of unit, but I always set my units to low fan speed. It will get colder/warmer anyway :).

feng1126 commented 2 years ago

you can modify this code ,add TemSen in code , them you can get current temperature from internal sensor like this optionsToFetch = ["Pow","Mod","SetTem","WdSpd","Air","Blo","Health","SwhSlp","Lig","SwingLfRig","SwUpDn","Quiet","Tur","StHt","TemUn","TemSen","HeatCoolType","TemRec","SvSt","SlpMod"] hvac_modes: auto, cool, dry, fan_only, heat, off min_temp: 16 max_temp: 30 target_temp_step: 1 fan_modes: Auto, Low, Medium-Low, Medium, Medium-High, High, Turbo, Quiet swing_modes: Default, Swing in full range, Fixed in the upmost position, Fixed in the middle-up position, Fixed in the middle position, Fixed in the middle-low position, Fixed in the lowest position, Swing in the downmost region, Swing in the middle-low region, Swing in the middle region, Swing in the middle-up region, Swing in the upmost region current_temperature: 30 temperature: 28 fan_mode: Auto swing_mode: Default friendly_name: air1 supported_features: 41

janmashat commented 2 years ago

@feng1126 can you please open a PR with your change?

BTW I got a new Gree A/C installed today and it returns the temp (with a +40 offset):

$ python gree.py get TemSen -c 192.168... -i ... -k ...
Getting parameters: TemSen
TemSen = 66
feng1126 commented 2 years ago

climate.txt

alamoudimoh commented 2 years ago

my a/c has a built in temp. if i understand this correctly, this would be very helpful, please consider @RobHofmann

janmashat commented 2 years ago

Consider what? I don't see a PR.

alamoudimoh commented 2 years ago

Consider what? I don't see a PR.

The current temperature from built-in sensor!!

janmashat commented 2 years ago

Yes that would be great...I'll try to test out @feng1126's file and create a PR.

janmashat commented 2 years ago

I've tested it and it works, so I created PR #129 - but the change in line 294 seems unnecessary/incorrect, can you confirm @RobHofmann?

janmashat commented 2 years ago

As I mentioned above my TemSen has a 40 degree offset so I tried to account for that adding

template:
  - sensor:
      - name: ac_temp
        state: '{{ state_attr('climate.ac', 'current_temperature')|float - 40 }}'
        unit_of_measurement: "°C"

and then adding this to the gree config:

    temp_sensor: sensor.ac_temp

but the gree current_temperature went crazy into the negative thousands and kept decreasing...looks like I created a loop 😄

edisonbar commented 4 months ago

Well I managed to display temperature from internal sensor but with offset of +40,how to modify code to display temperature with a offset ?My AC is Gree Clivia. edit: I also managed do display temperature with an offset of -40,If somebody needs any help I 'll be glad to help.

rapi3 commented 4 months ago

Well I managed to display temperature from internal sensor but with offset of +40,how to modify code to display temperature with a offset ?My AC is Gree Clivia. edit: I also managed do display temperature with an offset of -40,If somebody needs any help I 'll be glad to help.

Can you help with more details how/where to change ? Thank you.

edisonbar commented 4 months ago

Can you help with more details how/where to change ? Thank you.

What exactly do you need?

rapi3 commented 4 months ago

I'd like to have display of current temp from Gree AC internal sensor with this integration.

edisonbar commented 4 months ago

climate.txt

this is my config.Try with this one and give me a feedback.

rapi3 commented 4 months ago

Thank you, it work.

Target temp set depend of external sensor from config.yaml: temp_sensor To depend only of internal Gree AC ( no need of external sensor ) I think we need to disable external sensor from config.yaml

is this correct ?

p.s. I also patched here:

def SendStateToAc(self, timeout): _LOGGER.info('Start sending state to HVAC') statePackJson = '{' + '"opt":["Pow","Mod","SetTem","WdSpd","Air","Blo","Health","SwhSlp","Lig","SwingLfRig","SwUpDn","Quiet","Tur","StHt","TemUn"," TemSen"...

attached file climate2a.txt

WallK commented 2 months ago

My Gree Airy GWH09AVCXB reports current temperature in the default HA Gree integration

janmashat commented 2 months ago

My Gree Airy GWH09AVCXB reports current temperature in the default HA Gree integration

Good catch! I'll need to give that a try...

In the meantime this is how I solved it with this integration (utilizing gree-remote):

climate:
  - platform: gree
    name: downstairs_ac
    host: 192.168.90.28
    port: 7000
    mac: '50:XX:XX:XX:XX:9C'
    target_temp_step: 1
    temp_sensor: sensor.tempdown

sensor:
  - platform: command_line
    name: tempdown
    command: "python /config/submodules/gree-remote/PythonCLI/gree.py get TemSen -c 192.168.90.28 -i 50xxxxxxxx9c -k 5uxxxxxxxxxxxx6R | grep 'TemSen =' | awk '{print $3}'"
    unit_of_measurement: "°C"
    value_template: "{{ value | float - 42 }}"
fliespl commented 1 month ago

@edisonbar slightly offtopic, but do you recommend Clivia model for homeassistant integration? Do you mind sharing if you use it using local network or cloud?

edisonbar commented 1 month ago

@edisonbar slightly offtopic, but do you recommend Clivia model for homeassistant integration? Do you mind sharing if you use it using local network or cloud?

I use it on both, but app is pretty slow remotely, HA works great, no problem so far.Only missing humidity from built in sensor

Machaeon commented 3 weeks ago

Greetings, I seem to have gotten the internal sensor processing correct. I would like to create a PR, could you tell me how to do it? Thanks!

RobHofmann commented 3 weeks ago

PR can be found here https://github.com/RobHofmann/HomeAssistant-GreeClimateComponent/pull/175

Can you guys please test this?

rapi3 commented 3 weeks ago

I ported original HA Gree Climate integration with patch from kspearrin to HA - OS as custom integration, It use temp sensor from AC unit and AC can be located in another LAN segment than HA; have a look: https://github.com/rapi3/HA-OS-Gree

edit: now can be installed from HACS - custom repository - integration

toughvj commented 1 week ago

@RobHofmann this can be closed, solved in #188

Saxin commented 4 days ago

I have x3 gree units, currently using HA Gree component, how can I check if my units support reporting current temp - TemSen property ? thanks guys

jodewee commented 4 days ago

I have x3 gree units, currently using HA Gree component, how can I check if my units support reporting current temp - TemSen property ? thanks guys

just remove this line from you config, reboot ha, and check in you climate entity if you see an attribute for the current temp. image

toughvj commented 4 days ago

climate.txt @jodewee not exactly ;) v2.13 does not have this feature first of all use attached file, then remove this line from your config and restart HA

jodewee commented 4 days ago

@toughvj idd correct, i already have the latest version of the py-file.

toughvj commented 4 days ago

it looks like @RobHofmann is a bit slow with PR :)

janmashat commented 4 days ago

My first question would be if "HA Gree component" is the core component - because that one displays the current temp (if the unit supports it, it shows the real temp - otherwise it just shows the set temp twice).

Saxin commented 4 days ago

thanks all, much appreciated. @janmashat - yes I currently have the Gree core component (not this repo, HACS) installed. So if I see the same temp double - my unit doesn't support it ?

janmashat commented 4 days ago

That is my experience, yes.

eimirae commented 2 days ago

It seems my unit is reporting the temp in F instead of C :/. 78.80000000000001F being 26C.

24-07-12 10:33:37.637 INFO (MainThread) [custom_components.gree.climate] swing_modes(): ['Default', 'Swing in full range', 'Fixed in the upmost position', 'Fixed in the middle-up position', 'Fixed in the middle position', 'Fixed in the middle-low position', 'Fixed in the lowest position', 'Swing in the downmost region', 'Swing in the middle-low region', 'Swing in the middle region', 'Swing in the middle-up region', 'Swing in the upmost region']
2024-07-12 10:33:37.637 INFO (MainThread) [custom_components.gree.climate] available(): Device is online
2024-07-12 10:33:37.637 INFO (MainThread) [custom_components.gree.climate] hvac_mode(): cool
2024-07-12 10:33:37.637 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2024-07-12 10:33:37.638 INFO (MainThread) [custom_components.gree.climate] temperature_unit(): °C
2024-07-12 10:33:37.638 INFO (MainThread) [custom_components.gree.climate] current_temperature(): 78.80000000000001
2024-07-12 10:33:37.638 INFO (MainThread) [custom_components.gree.climate] target_temperature(): 27
2024-07-12 10:33:37.638 INFO (MainThread) [custom_components.gree.climate] fan_mode(): Low
2024-07-12 10:33:37.638 INFO (MainThread) [custom_components.gree.climate] swing_mode(): Fixed in the lowest position
2024-07-12 10:33:37.639 INFO (MainThread) [custom_components.gree.climate] name(): Split
2024-07-12 10:33:37.639 INFO (MainThread) [custom_components.gree.climate] supported_features(): 425
2024-07-12 10:33:37.639 INFO (MainThread) [custom_components.gree.climate] should_poll()