ioBroker / ioBroker.hass

Connects Home Assistant to ioBroker
https://www.home-assistant.io/
MIT License
24 stars 15 forks source link

Can't set temperature for climate control #68

Closed Hans5546 closed 1 year ago

Hans5546 commented 1 year ago

Hello!

I use HASS to control some climate devices. 3 "modded" Midea (remko) ACs with ESPHome and 2 Tuya thermostats.

I can control these devices from HASS without any problems. Setting the mode (heat/ cool/ auto) is working, setting a target temperature also.

From IOBroker I can set the mode (for example cool) or other values like "low fan". But one thing does not work on any of my climate devices: Setting the temperature. I tried different types for set temperature (mixed, number, ...), nothing.

I always get an error when setting the temperature to for example 22°C: "Cannot control hass.0.entities.climate.heidenfeld.set_temperature: true" I I already reinstalled the adapter from GIT (before I uses 1.0.3 from the IOBroker source), no change.

What else do you need? I already read, that there was a similar issue - but installing the GIT version did not help for me.

I have attached the objectdata for "set temperature" in my IOBroker.

Many thanks in advance!

set_temperature.txt

Apollon77 commented 1 year ago

Please enable debug log for the instance and do such a control try. Grab then the full log (from that debug start) from disk under /opt/iobroker/log/... and post here ort send witjh reference to this issue to me at iobroker@fischer-ka.de

Hans5546 commented 1 year ago

Many thanks for the quick response!

I sent you an email with the debug log.

Hans5546 commented 1 year ago

Hello Apollon,

did you get my email with the log? Otherwise I would send it again.

Many thanks!

Apollon77 commented 1 year ago

Yes I received it. just had no time to look into it

Apollon77 commented 1 year ago

@Hans5546 Ok with which value did youtried to control it?

The "field" of the climate control e.g. has several fields:

{"fields":{"temperature":{"name":"Temperature","description":"New target temperature for HVAC.","selector":{"number":{"min":0,"max":250,"step":0.1,"mode":"box"}}},"target_temp_high":{"name":"Target temperature high","description":"New target high temperature for HVAC.","advanced":true,"selector":{"number":{"min":0,"max":250,"step":0.1,"mode":"box"}}},"target_temp_low":{"name":"Target temperature low","description":"New target low temperature for HVAC.","advanced":true,"selector":{"number":{"min":0,"max":250,"step":0.1,"mode":"box"}}},"hvac_mode":{"name":"HVAC mode","description":"HVAC operation mode to set temperature to.","selector":{"select":{"options":[{"label":"Off","value":"off"},{"label":"Auto","value":"auto"},{"label":"Cool","value":"cool"},{"label":"Dry","value":"dry"},{"label":"Fan Only","value":"fan_only"},{"label":"Heat/Cool","value":"heat_cool"},{"label":"Heat","value":"heat"}]}}}},"entity_id":"climate.heidenfeld","attr":"set_temperature","type":"climate"}

This means it do not work to just set "22" as value, but you need to set a JSON string like '{"temperature":22}' and you can also set multiple of the fields at once .... Please try this.

Apollon77 commented 1 year ago

Please try GitHub version. I also added new logs to provide more guidance.Please try if that would have helped

Hans5546 commented 1 year ago

I tried to set the temperature to 22°C. I only set the value for "set temperature" in the HASS instance to 22°C and that's it. The same way works for for example "cool" or "heat" - I only set the value for "HVAC Mode" to "cool" and it works.

In HASS itself I can use a temperature slider and some buttons to control my AC, that's working.

I will try the new GIT version, maybe it will take some time, as I am not at home at the moment and have only a VPN connection in my phone.

Apollon77 commented 1 year ago

tried to set the temperature to 22°C

I expected that. It is a bit weird how this works "API Wise". it is a servcie and the dservice has fields. many services just have ONE Field and then the adapter already automatically use this one field. But in your case there are multiple fields; and multiple "number fields". so the adapter would not know what to set. That means you need to provide the JOSN string with the details what exactly you want to set.

When I find time somewhere maybe I find better ideas, but only usign the json it is possible to e.g. "set a new color for a lamp and also provide a fading time" and such (so parameter that belong together in one call

DcFamas commented 1 year ago

Same problem here. I also want to use my midea split device, but with the regular wlan stick. In HASS I can control this devices flawlessly. Is there anything I can support you Apollon to get this working? :)

Apollon77 commented 1 year ago

Did you read te above posts? Please try to install GitHiub version and try to control ... it should give you a better info now what you need to provide

DcFamas commented 1 year ago

Oh sorry, I've overseen the json example "{"temperature":22}". This works for me, thank you. :)

Apollon77 commented 1 year ago

But it would be still interesting to see a rreal logging when you try to trigger it witl "just 22" :-) Then I could add this to readme as reference :-)

DcFamas commented 1 year ago

I'll work on it and give you a full list. :)

Hans5546 commented 1 year ago

Hello,

sorry for the delay, I am back to home since yesterday. I updated to the new GIT-version and send you a new log.

At 2022-12-20 11:24:42.022 I set the temperature to 22°C -> does not work. I use the value "set temperature" as shown in the attached screenshot.

At 2022-12-20 11:25:06.181 I set the hvac_mode from "auto" to "head" -> works!

Maybe this helps? I do not know how to send a JSON string with the temperature integrated, maybe there is a solution?

Thanks in advance!

set_temp

Apollon77 commented 1 year ago

As you tried to set 22 as value you got that warning in the log:

2022-12-20 11:24:42.031 - warn: hass.0 (13728) Please make sure to provide a stringified JSON as value to set relevant fields! Please refer to the Readme for details! 2022-12-20 11:24:42.031 - warn: hass.0 (13728) Allowed field keys are: temperature, target_temp_high, target_temp_low, hvac_mode

The idea was that this helps to see what needs/could to be done

DcFamas commented 1 year ago

@Apollon77 here you go:

.set_aux_heat set to: false Cannot control hass.0.entities.climate.midea_ac.set_aux_heat: true set to: true Cannot control hass.0.entities.climate.midea_ac.set_aux_heat: true

I guess this datapoint includes the auxillery heating unit, which defrost the outside unit? Maybe this shouldn't be a writeable datapoint.

.set_fan_mode set to: low Cannot control hass.0.entities.climate.midea_ac.set_fan_mode: true

Maybe add this in the object data:

[...]
    "fields": {
      "fan_mode": {
        "name": "Fan mode",
        "description": "New value of fan mode.",
        "required": true,
        "example": "**auto, full, high, medium,** low, **silent**",
        "selector": {
          "text": null
        }
      }
    },
[...]

{"Fan mode":low}, {"Fan_mode":low}, {"set_fan_mode":low} won't work. I'm to stupid to understand the json string I have to write?

.set_humidity On my device it isn't posible to set the humidity. Maybe also change this to only readable?

.set_hvac_mode {"HVAC mode":fan_only} Cannot control hass.0.entities.climate.midea_ac.set_hvac_mode: true in this case all functions works without the need to input the json.

.set_preset_mode

[...]
  "native": {
    "fields": {
      "preset_mode": {
        "name": "Preset mode",
        "description": "New value of preset mode.",
        "required": true,
        "example": "_away_",
        "selector": {
          "text": null
        }
      }
[...]

I think the example is wrong, it should be "Boost" or "Eco". My unit only is able to "Boost". Here you need to input for example: {"preset mode":boost} only "boost" won't work.

.set_swing_mode

[...]
    "swing_mode": {
        "name": "Swing mode",
        "description": "New value of swing mode.",
        "required": true,
        "example": "**horizontal**, vertical, **both**",
        "selector": 
[...]

Please add the two examples above. :)

Json and and "normal" isn't working: horizontal vertical both {"swing_mode":vertical} leads to Cannot control hass.0.entities.climate.midea_ac.set_swing_mode: true

.set_temperature as mentioned before, just with the json, the number alone isn't enough

Also it would be great to implement in "turn_off" and "turn_on" in one state as boolean. This would makes it mouch easier to use in for example iQontrol. Also there is no datapoint which shows if the device is turned on or off, in HASS you can see this. :/

Sorry for my englisch, when I sound to harsh, I doesn't mean to. If I can help you in any way, just tell me what to do. :)

Apollon77 commented 1 year ago

Please set the loglevel to debug and post a full debug log from start and also when trying such actions. Please post as log file attachement here.

DcFamas commented 1 year ago

Here you go: midea.txt

Apollon77 commented 1 year ago

@DcFamas Can you please send a complete debug log from adapterstart? I need to see how things are initialized in order to understand the errors. In fact all field infos are contained in the initial state synced stuff, so the details are coming from your Hass system and the adapter just processes that. So if it is writeable or not and which fields do exist. I can not "add/change/set fields or make stuff writeable ... if there is something then the meta data from your hass system "state it that way". This is also the reason that "turn_on/off as one combined boolean" state is not that easy because, as said, anything is generically mapped. So the adapter do not know that these two service names have anything to do with each other.

So there was a field definition for "set_aux_heat" that lead to -> {"aux_heat":"true","entity_id":"climate.midea_ac_MyID"} as call parameters ... the question is not why this is declined by Hass? Is the hass log giving any idea?

When a function works with a "non stringified JSON" it means that exactly ONE filed is defined, so the adapter simply uses the value and puts it into the one field and sends it. A stringified JSON is only needed if MORE fields are defined and so the adapter can not know which field you want to set now

BTW; {"swing_mode":vertical} is NOT valid json! --> {"swing_mode":"vertical"} it needs to be!

Apollon77 commented 1 year ago

BTW: I found a bug on github preventing updating all values ...please someone install github and checl that all works and no "State changed for unknown object ..." messges are in log anymore

Hans5546 commented 1 year ago

Hello again!

I did send you a log file via email with the new git version installed.

DcFamas commented 1 year ago

Hey @Apollon77, installed GitHub version and sent you the log via. mail. In the log I tried to set {"swing_mode":"vertical"} which leads to the same error message.

There is a error in HASS:

`Logger: homeassistant.components.websocket_api.http.connection Source: custom_components/midea_ac/climate.py:283 Integration: Home Assistant WebSocket API (documentation, issues) First occurred: December 27, 2022 at 11:26:59 (8 occurrences) Last logged: 08:25:02

[myID] 'horizontal'
[myID] 'horizontal'
[myID] '{"swing_mode":vertical}'
[myID] '{"swing mode":vertical}'
[myID] ' {"swing_mode":"vertical"}'

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 200, in handle_call_service await hass.services.async_call( File "/usr/src/homeassistant/homeassistant/core.py", line 1745, in async_call task.result() File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)( File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service await service.entity_service_call( File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call future.result() # pop exception if have File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call await coro File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call await result File "/config/custom_components/midea_ac/climate.py", line 283, in async_set_swing_mode self._device.swing_mode = ac.swing_mode_enum[swing_mode] File "/usr/local/lib/python3.10/enum.py", line 440, in getitem return cls._membermap[name] KeyError: 'vertical'`

Best regards :)

Apollon77 commented 1 year ago

@DcFamas Ok, log looks cleaner. For your issue:

When you see the log then the definition of that field is:

2023-01-02 08:24:01.073 - debug: hass.0 (501607) Found Entity service hass.0.entities.climate.midea_ac_16492674491898.set_swing_mode: {"desc":"Set swing operation for climate device.","read":false,"write":true,"type":"mixed"} / {"fields":{"swing_mode":{"name":"Swing mode","description":"New value of swing mode.","required":true,"example":"horizontal","selector":{"text":null}}},"entity_id":"climate.midea_ac_16492674491898","attr":"set_swing_mode","type":"climate"}

So this thing is exactly having one field with name "swing_mode", so normally just setting the value you want is compketely fine, no JSON needed here.

There is right now no logic that checks that "if it is just one field but a json is provided in this would be that field ... let me add that tomorrow ...

But in the meantime feel free to just enter "vertical" as value ...

Apollon77 commented 1 year ago

PS: sttoooopppp ... according to log you entered the json sith a leading "space" character and this make the current algorithm not detect the json :-) GitHub version updated.

So it should work now with "just" the value "vertical" or with the json you provided before

DcFamas commented 1 year ago

Hey @Apollon77, updatet to github version. Just "vertical" doesn't work:

`

hass.0 2023-01-22 11:48:03.719 error Cannot control hass.0.entities.climate.midea_ac_myID.set_swing_mode: true
hass.0 2023-01-22 11:48:03.718 debug got answer for call_service success = false, result = undefined
hass.0 2023-01-22 11:48:03.684 debug Send to HASS for service set_swing_mode with climate and data {"swing_mode":"vertical","entity_id":"climate.midea_ac_myID"}
hass.0 2023-01-22 11:48:03.684 debug Prepare service call for hass.0.entities.climate.midea_ac_myID.set_swing_mode with (mapped) request parameters {"swing_mode":"vertical"} from value: "vertical"

`

But this is fine for me, I can deal with the JSON value. :)

Still I need the value, if the climate is on or off. Is it possible for you to build a new value for the object based on the log?

Turned from off to on: hass.0 2023-01-22 11:47:03.620 debug HASS-Message: State Changed: {"entity_id":"climate.midea_ac_myID","state":"heat","attributes":{"hvac_modes":["auto","cool","dry","heat","fan_only","off"],"min_temp":17,"max_temp":30,"target_temp_step":1,"fan_modes":["Auto","Full","High","Medium","Low","Silent"],"preset_modes":["none","eco","boost"],"swing_modes":["Off","Vertical","Horizontal","Both"],"current_temperature":20,"temperature":25,"fan_mode":"Auto","preset_mode":"none","swing_mode":"Both","outdoor_temperature":3.5,"icon":"mdi:air-conditioner","friendly_name":"Klimaanlage","supported_features":57},"last_changed":"2023-01-22T10:47:03.611198+00:00","last_updated":"2023-01-22T10:47:03.611198+00:00","context":{"id":"anID","parent_id":null,"user_id":null}} -> state:heat -> climate is on

Turned from on to off: hass.0 2023-01-22 11:46:48.458 debug HASS-Message: State Changed: {"entity_id":"climate.midea_ac_myID","state":"off","attributes":{"hvac_modes":["auto","cool","dry","heat","fan_only","off"],"min_temp":17,"max_temp":30,"target_temp_step":1,"fan_modes":["Auto","Full","High","Medium","Low","Silent"],"preset_modes":["none","eco","boost"],"swing_modes":["Off","Vertical","Horizontal","Both"],"current_temperature":20,"temperature":25,"fan_mode":"Auto","preset_mode":"none","swing_mode":"Both","outdoor_temperature":10,"icon":"mdi:air-conditioner","friendly_name":"Klimaanlage","supported_features":57},"last_changed":"2023-01-22T10:46:48.452510+00:00","last_updated":"2023-01-22T10:46:48.452510+00:00","context":{"id":"anID","parent_id":null,"user_id":null}} -> state:off -> climate is off

Best regards :)

DcFamas commented 1 year ago

I'm stupid, the value exists already. :D