Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug(C3): Add current temperature in C3 - Heat Pump #387

Closed
fagallo opened this issue Nov 15, 2024 · 34 comments · Fixed by midea-lan/midea-local#340
Closed

Bug(C3): Add current temperature in C3 - Heat Pump #387

fagallo opened this issue Nov 15, 2024 · 34 comments · Fixed by midea-lan/midea-local#340
Labels
enhancement New feature or request
Milestone

Comments

@fagallo
Copy link

fagallo commented Nov 15, 2024

Device type and model (or SN)

Heat Pump Wi-Fi Controller 171H120F (0)

The detail description of new feature

This part of code in climate.py seems incomplete.

Line 566
@Property
def current_temperature(self) -> float | None:
"""Midea C3 Climate current temperature."""
return None

Current temperature value is present in HA and is "null" . The sensor is not present.
Current temperature is indoor temperature value in heat pump controller.

@fagallo fagallo added the enhancement New feature or request label Nov 15, 2024
@chemelli74
Copy link
Collaborator

Hi, please enable debug for Midea AC LAN integration, wait for this value to show up, disable debug and attach the log.

Note: it is better to drag the log into the comment (which will add it as an attachment) and not copy paste as it is hard to read logs in GitHub.

Thanks

@AndreasTUHU
Copy link

HI,
I also have a C3 device (Midea Heatpump WiFi controller), so I downloaded the log.
By the way the controller has a lot of interesting values in the operation parameter menu. Is it possible to add some of these parameters to entities?
I see a discussion about it, but unfortunatelly this project seems to be abandoned:
[https://github.com/mill1000/midea-msmart/issues/107]

home-assistant_midea_ac_lan_2024-11-17T12-17-24.686Z.log
IMG_4965

@michalszym
Copy link

I am a user of a heat pump from the midea group (Polish brand Kaisai) and I am also very interested in adding additional entities for integration.
I don't know if it will help, but in one of the manuals for the Midea Heatpump WiFi controller that I found, the modbus parameters are described in detail.
The manual can be found here: https://kaisai.com/pl/files/page_files/464/kaisai-arctic-power-instrukcja-sterownika-pl-v02.pdf and information about modbus starts on page 48 (41).

@wuwentao
Copy link
Owner

sorry for the delay response.
I'm still on vacation and will check the details later.

@wuwentao
Copy link
Owner

@fagallo
just doing a quickly test as below:
could you help to manual edit the climate.py to confirm the result:

replace(for C3 device in your issue code example)

return None

with

return cast(float, self._device.get_attribute(C3Attributes.tank_actual_temperature))

in addition, there is still a outdoor_temperature like tank_actual_temperature
I'm not sure with this device and feature, maybe we can confirm it with me.

thanks.

@wuwentao
Copy link
Owner

@AndreasTUHU @michalszym we can add more entries for these devices.
but I'mt not sure with which entry you want to add.
or you can provide your device SN to me, then I can try to add some with it later.
maybe we can do it in another new issue/PR later.
as I think current issue focus on fix current temperature bug.
anyway, we still can discuss it and confirm the next plan later.

@wuwentao wuwentao changed the title Add current temperature in C3 - Heat Pump Bug(c3): Add current temperature in C3 - Heat Pump Nov 26, 2024
@wuwentao wuwentao changed the title Bug(c3): Add current temperature in C3 - Heat Pump Bug(C3): Add current temperature in C3 - Heat Pump Nov 26, 2024
@michalszym
Copy link

@wuwentao
For me, it doesn't matter whether it's in this thread or a separate one, but it's important to add the ability to display additional information from the heat pump to the integration.
I think that all parameters from @AndreasTUHU's photo should be added, and apart from them, the following items are interesting for me:

Operating Mode (heat/hot water)
Pump_I (on/off)
PUMP_0 (on/off)
Water flow (m3/h)
Heat pump power (kW)
T1S C1 curve Temp. Climate (degree C)
Compressor Speed ​​(Hz),
COMPRESSOR OPERATING TIME (min)
Total compressor running time (hours)
Expansion valve (P)
Fan speed (r/min)
T2 TEMP. DIMENSIONS F-INLET (degree C)
T2B TEMP DIM. F-POW (grade C)
Th TEMP. COMPRESSED CHOKE (degree C)
Tp TEMP. COMPRESSION STAMPING (degree C)
T3 TEMPERATURE OF EXTERNAL EXCHANGER (degree C)
TEMP. TF MODULE (level C)
P1 REFRIGERANT PRESSURE (kPa)

Unfortunately, I cannot change the language to English in my controller, so this is my poor translation.

I'm not a programmer and I'm just starting out with home assistant, but if I can help in any way, I'll be happy to do so.

@wuwentao
Copy link
Owner

@michalszym @AndreasTUHU please consider to report a new issue with this C3 device feature request.

  1. provide both of your C3 device SN (match your device feature).
  2. description the detail feature requrements that current C3 device missed.

then we can do it in a split issue and PR.

thanks.

@wuwentao
Copy link
Owner

@fagallo any update with the changes?

@michalszym @AndreasTUHU could you help to test with this curren temperature chagnes and confirm it ? thanks

@fagallo
Copy link
Author

fagallo commented Nov 28, 2024

@wuwentao What change ? There is a new version to test?

@wuwentao
Copy link
Owner

@fagallo just doing a quickly test as below: could you help to manual edit the climate.py to confirm the result:

replace(for C3 device in your issue code example)

return None

with

return cast(float, self._device.get_attribute(C3Attributes.tank_actual_temperature))

in addition, there is still a outdoor_temperature like tank_actual_temperature I'm not sure with this device and feature, maybe we can confirm it with me.

thanks.

@fagallo
just manual edit this climate.py source code, reboot HA and confirm it

@AndreasTUHU
Copy link

AndreasTUHU commented Nov 28, 2024

@fagallo just doing a quickly test as below: could you help to manual edit the climate.py to confirm the result:
replace(for C3 device in your issue code example)

return None

with

return cast(float, self._device.get_attribute(C3Attributes.tank_actual_temperature))

in addition, there is still a outdoor_temperature like tank_actual_temperature I'm not sure with this device and feature, maybe we can confirm it with me.
thanks.

@fagallo just manual edit this climate.py source code, reboot HA and confirm it

I've changed the line, in climate.py debug log attached. But to be honest, I don't know where can I find this temperature value.

hpaw_entities

home-assistant_midea_ac_lan_2024-11-28T07-04-19.965Z.log

@wuwentao
Copy link
Owner

@fagallo sorry, I'm also not check it, just follow what you have said and checked.
you also not confirm with your issue now?

Current temperature value is present in HA and is "null" . The sensor is not present.
Current temperature is indoor temperature value in heat pump controller.

if yes, you can just use tank_actual_temperature to instead of it. and we can close current issue and not change it.
if you found new issue, please post the details, thanks

@fagallo
Copy link
Author

fagallo commented Nov 28, 2024

@wuwentao Later I can try the modify. Now I'm not at home.

tank_actual_temperature I is a sensor that misure value of temperature of water tank for hot water. I'm not use it, in my case is not connected that sensor.

current_temperature is value of temperature indoor at home. It's very interesting for automation in HA.

Later try your code.

@fagallo
Copy link
Author

fagallo commented Nov 28, 2024

@wuwentao
I tried your code. Obviously the "tank" parameter is wrong, because it is not the value that should be output. But it actually appears as "Current Temperature" in the thermostat entity. t would be necessary to understand how to [find] the indoor temperature value.

EDIT:
If it helps you, these are the modbus codes found on another project:

code_modbus.pdf

@wuwentao
Copy link
Owner

wuwentao commented Nov 29, 2024

@wuwentao Later I can try the modify. Now I'm not at home.

tank_actual_temperature I is a sensor that misure value of temperature of water tank for hot water. I'm not use it, in my case is not connected that sensor.

current_temperature is value of temperature indoor at home. It's very interesting for automation in HA.

Later try your code.

what you expected is HA can show your C3 device root temperature, not tank temperature, also not current_temperature
and I don't think you have submit a expected github issue with detail description.
from current C3 device document, I don't think you can got it, it should be a new feature support and not a bug

https://github.com/wuwentao/midea_ac_lan/blob/master/doc/C3.md

in addition, from your upload modbus pdf, which one is the current temperature or indoor temerature as your expected ?

@fagallo
Copy link
Author

fagallo commented Nov 29, 2024

what you expected is HA can show your C3 device root temperature, not tank temperature, also not current_temperature
and I don't think you have submit a expected github issue with detail description. from current C3 device document, I don't think you can got it, it should be a new feature support and not a bug

I have reported that value of current temperature, that must be the temperature of room is null, and in the code is set to return "none". I don't know If is a new feature or a bug . I have reported this.

I think that a climate entity (thermostat) works that I have a current temperature (room temperature) and a target temperature. When room reach target , the controller is set to off.

Tank temperature it's something else. And it was already visible value in HA. I have not a tank because I not use for domestic hot water but only home heating (fancoil). Now with the modify code I have a thermostat in home assistant for heating that have a current temperature set to value of domestic hot water. it's completely wrong.
I think that georgezhao2010 whent write the code had some problems getting the value of current (room temperature) and set is to none.

I was hoping someone else would be able to get the value. I repeat a thermostat entity must have a target and current temperature and the latter is the room temperature and in the code Is set to none.

thank you all the same

@AndreasTUHU
Copy link

I have a thermostat in home assistant for heating that have a current temperature set to value of domestic hot water. it's completely wrong.

I can confim this. I have DHW tank, and the current temperature value on a thermostat card is the temperature of the DHW tank.
termostat

@wuwentao
Copy link
Owner

wuwentao commented Dec 2, 2024

@fagallo @AndreasTUHU thanks all for your info.

@fagallo just ignore the old code , as current_temperature can display as every temperature value from your device, in fact, there is more temperature values for it, so it can be room and also can be tank, and georgezhao2010 just ignore it and set it to none (per my understand)
so we can ignore current_temperature and only forcus to your feature requirement, it's enough.
and you just need to got a entry named room_temerature, it's enough, and you can't use current temperature, and we can always ignore it.

finaly, could you provide your device SN? if this is a midea device builtin feature, we can got it from your device SN, thanks.

and I only got a C3 device SN via #404
if these C3 device is different, we still need more device SN to confirm the feature, thanks.

from current code, we can found there is a room_target_temp attributes, if your device support to report room_current_temperature, then we can try to got it.
and please ignore current_temperature, it's not as your expected.

@fagallo
Copy link
Author

fagallo commented Dec 2, 2024

@wuwentao I think this is 0000C3310171H120F2626410155617NY.

if it helps you, the heat pump can work in two modes: Water_mode and Room_mode. In first mode, in the controller, you set the temperature of water; in the second you set desired room temperature. In my case I operate in second mode (room).

At #404 photo "page 3/9" Ta ROOM Temperature is "--". I think he have set water mode.

In my case at page 3/9 Ta ROOM Temperature in this moment is 22. This is the value that need in room temperature mode.
IMG_5530

@wuwentao
Copy link
Owner

wuwentao commented Dec 2, 2024

@wuwentao I think this is 0000C3310171H120F2626410155617NY.

if it helps you, the heat pump can work in two modes: Water_mode and Room_mode. In first mode, in the controller, you set the temperature of water; in the second you set desired room temperature. In my case I operate in second mode (room).

At #404 photo "page 3/9" Ta ROOM Temperature is "--". I think he have set water mode.

In my case at page 3/9 Ta ROOM Temperature in this moment is 22. This is the value that need in room temperature mode. IMG_5530

thanks, with this info and screenshot, I think I have fullly understand what you expecte: target room temperature.

in fact, this value is available in C3 device lib side, unfortunely, it not add to HA.

we need to add a new entry for it, below is the test method:

  1. edit this file :
    C3Attributes.tank_actual_temperature: {
  2. copy and paste below code before C3Attributes.tank_actual_temperature.
            C3Attributes.room_target_temp: {
                "type": Platform.SENSOR,
                "has_entity_name": True,
                "translation_key": "room_target_temp",
                "name": "Room Target Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": UnitOfTemperature.CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT,
            },
            C3Attributes.dhw_target_temp: {
                "type": Platform.SENSOR,
                "has_entity_name": True,
                "translation_key": "dhw_target_temp",
                "name": "DHW Target Temperature",
                "device_class": SensorDeviceClass.TEMPERATURE,
                "unit": UnitOfTemperature.CELSIUS,
                "state_class": SensorStateClass.MEASUREMENT,
            },
  1. save the file content and reboot HA to take effect, once HA reboot, add these two entry to your HA device, confirm it can works for you. (in addition, these two entries is only for test purpose, once got confirm , you can remove it when when upgrade to new version)

this code also add a dhw_target_temp for test purpose, as it's the same format as root_target_temp

@fagallo
Copy link
Author

fagallo commented Dec 2, 2024

@wuwentao No. I'm sorry, but I don't think you understand. Maybe it's because of my bad English.

"Room temperature" is actual temperature in the room (in my house).
"Target temperature" is temperatura that you can set on the thermostat (home assistant entity or physical controller) with the circular slide.

My control is set to room_temparture_mode.

Exapmple:
I desider tha are 25° in my home , I move slide to 25° (target). If in my home are 22° (actual / current temperature) the thermostat go ON and Heat Pump start .
The current or actual temperature is "Ta" parameter in controller ( see image of previous post). In Italian TEMP. AMBIENTE or in English ( post #404 ) ROOM TEMP.

This is the value necessary to do automation on thermostat ( example: if is cold that the target temp set Heat Pump On or if hot that target temp do nothing).

The value of you code is correctly load in home assistant but not are the value requested.

I can't test DHW because , how already said, I don't have domestic water with heat pump.

I hope I was clear in my explanation. Thanks

@wuwentao
Copy link
Owner

wuwentao commented Dec 3, 2024

@fagallo unfortunately, I don't think current C3 device have current root temperature.
as we only can found one Ta room temperature in your device and picture, and I also can't found two options with room temperature in C3 device, there is only one target room temperature, so I just simple think Ta room temperature should be Target root temperature and NOT Current root temperature.
if your device support both of this value, there should be two options and two args with different name, is this right ?
so the problem is how to got current rootm temperature from current C3 device ? I don't found it in current C3 device lua script or your device screenshot.
if this is error, please give me more info and detail info about current temperature from C3 device screenshot or any useful info.

maybe you have an addition extra sensor to got it? or any info to got this current room temperature?
as it required hardware support and software feature from midea C3 device, this is the root cause and why we can't got it.

for midea Meiju app(only in China local, and Smarthome for global maketing), like 0xAC device, it can provide current room temperature with hardware sensor, and can't provide outdoor temperature, and midea use wifi/internet and geolocation to got current outdoor temperature, and display this value in Meiju app, but can't show it in 0xAC device, like this outdoor temperature feature, just got it from internet and not from midea device.

@wuwentao
Copy link
Owner

@fagallo any updates?

@fagallo
Copy link
Author

fagallo commented Dec 13, 2024

Hi @wuwentao ,
I don't know how it works but in the "parameter" menu of the midea controller "Ta Room temperature" is the current (actual) temperature.
Also present in the "service information" menu are the items "room set temp" which is the target temperature and "room actual temp" which is the current temperature. View image below.
The midea controller works as a thermostat. If I set the target temperature e.g. 26°C will turn on the heat pump when the temperature drops below 25.5 and turn off above 26.5° (hysterisis set).
So there is a temperature sensor in the controller. It also has a temperature sensor mounted on the exetarnal machine , T4, which is the external temperature sensor and which is properly exposed in HA.
Both Ta Room actual temp and T4 are integers (they have no decimal places). While target temperature has a decimal place (0.5° step).
IMG_5585
IMG_5586
IMG_5587

@fagallo
Copy link
Author

fagallo commented Dec 13, 2024

@wuwentao
I don't Know how this code read parameter from controller. I found on other project based on modbus that [device]_water_tank_tempertature_T5 (that you correct read in this code) have addressed 0x73 , while [device]_room_temperature_ta has addressed 0x72.
I don't know if this can be useful to you.

@wuwentao
Copy link
Owner

wuwentao commented Dec 13, 2024

@fagallo

thanks for your info and screenshot.

I'm still have a new question:
if you use a room temperature mode,
mode 1: you should have a external room controller, and it connected with your c3 device or WIFI? and this room controller have temperature sensor? and C3 device can got a remote room temperature from external controller ?
mode 2: there is no any external room controller, this room temperature sensor is C3 device room temperature?

in addition, please check this link:
#399 (comment)

T_0000_C3_171H120F_2023062601.txt is C3 device Lua script.

refer to function dataToJson and function jsonToData

based on your modbus name, maybe we can check some attrs named t5* and not room*
we need to do more check and test and try to find out this attr.

@wuwentao
Copy link
Owner

based on your screenshot, there is a Water Flow attr with Ta room temp
and also refer to your modbus attr name have t5/ta

from the lua script, it maybe

        binToModel(streams, "tempT5", _bodyBytes[38], nil)
        binToModel(streams, "tempTa", _bodyBytes[39], nil)

I'm not sure, these args not support in current C3 device, as this should be c3 device temperature and may not a real room temperature.

per my understand, C3 device location temperature should not our living room, we can use external temperature sensor and got this value from HA, and use HA automation to control your C3 device start/stop.
this should be a real room temperature for your living room and NOT c3 device temperature.

for your reference, I'm using this mode for my vaillant gas water heater device, and I have multiple room, I'm using water distributor, easy room should have one controller,and I can control every room temperature with external temperature sensor.
just control the water distributor switch. if all the water distributor switchs are turn off, we can turn off water heater device.

@fagallo
Copy link
Author

fagallo commented Dec 13, 2024

I'm still have a new question:
if you use a room temperature mode,
mode 1: you should have a external room controller, and it connected with your c3 device or WIFI? and this room controller have temperature sensor? and C3 device can got a remote room temperature from external controller ?
mode 2: there is no any external room controller, this room temperature sensor is C3 device room temperature?

No. I haven't an external controller (such thermostat). Only Midea controller for C3 device. You can see this video https://www.youtube.com/watch?v=rBru56N9yAc .It's the same controller. You can notice that at the top right there are some small holes, presumably for the temperature sensor.
4f029b5a-a18f-4bf9-b036-d69c2e7a27d5

@fagallo
Copy link
Author

fagallo commented Dec 13, 2024

binToModel(streams, "tempT5", _bodyBytes[38], nil)
binToModel(streams, "tempTa", _bodyBytes[39], nil)

We can test ??

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


binToModel(streams, "tempT5", _bodyBytes[38], nil)
binToModel(streams, "tempTa", _bodyBytes[39], nil)

We can test ??

@wuwentao
Copy link
Owner

wuwentao commented Dec 18, 2024

@fagallo
add some debug code in this PR: midea-lan/midea-local#340
try with this draft PR.

  1. login to HAOS
  2. start homeassitant docker
  3. replace file for midealocal python pip package in homeassitant core(use wget to download github PR raw file and replace it)
  4. enable debug log for both midea_ac_lan and midealocal in configuration.yaml
  5. reboot HA.
  6. after your C3 device works well(start about 3-5 minutes), try to upload full debug log file to current github issue and I will check the detail.

in addition ,it should be the feature requirement for #404

how to change it, below is the detail steps:

  1. if you are using HAOS, you should install Add-on [Advanced SSH & Web Terminal] and disable [Protected Mode], once it done, you can ssh to your HAOS, and enter docker in HAOS docker exec -it homeassistant /bin/bash, contiune the step to check midea-local install path
  2. if you not using HAOS, just check midea-local install path as the next step
  3. get midea-local install path with command pip show midea-local, it will show info for you, for example, my location is Location: /usr/local/lib/python3.12/site-packages
  4. then we can edit the file /usr/local/lib/python3.12/site-packages/midealocal/devices/ed/message.py with the code changes, using vi command line tool or any method you can do it.
  5. reboot HA and test with it, confirm with the result or debug log.

finally, if you want to check debug log output with your device display name and value, especially for your current room temperature value(Ta room temp).
just search keyword UnitPara or C3UnitParaMessageBody, and you will find more value output , I'm not sure the real value, maybe tempT5 or tempTa?

you can check all your device params value with debug log output name and params value.
the name maybe not the same, and I'm also not sure the name in your device and current debug log.
you can select someone with the name in your device ,and give the result to me.
I will try to add it with what you expected.

@wuwentao wuwentao added this to the 0.6.6 milestone Dec 19, 2024
@wuwentao
Copy link
Owner

@fagallo any updates for latest changes?

@wuwentao
Copy link
Owner

latest v0.6.6 should include most of the debug info, you can use latest release to test with your device.
if we can't got which value is indorr_temperature, we can't use it in HA.

please share your debug log with your device, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants