litinoveweedle / hass-template-climate

❄️Templatable Climate Device for Home Assistant, Supports Running Actions On Service Calls.
MIT License
24 stars 1 forks source link

Cannot use numerical fan speed modes. ['auto', '1', '2', '3'] #8

Closed Arn0uDz closed 4 months ago

Arn0uDz commented 5 months ago

The problem

@litinoveweedle

The main reason i'm using your custom template is so I can use numbered fan speed modes instead of names.

I have no previous config so I can't compare. Tried your updated climate.py and having 2 issues.

  1. I'm unable to adjust the target temperature. I tried multiple things but getting an error when trying to adjust. I just don't know what to put in the config and there are no examples where I can copy from.

The error message is:

[140289070254272] 'TemplateClimate' object has no attribute '_round_temp_step'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 917, in async_service_temperature_set
    await entity.async_set_temperature(**kwargs)
  File "/config/custom_components/climate_template/climate.py", line 1147, in async_set_temperature
    self._round_temp_step(target_temperature),
    ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 328, in __getattribute__
    return super().__getattribute__(__name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'TemplateClimate' object has no attribute '_round_temp_step'
  1. The HVAC modes don't translate and format correctly. The fanspeed mode and swingmodes do translate and format correctly.

On the left your template and on the right the original in HA. image

My code:

climate:
  - platform: climate_template
    name: "Airco Zolder Template"
    unique_id: climate.airco_zolder_template
    hvac_modes:
      - "off"
      - "cool"
      - "heat"
      - "fan_only"
      - "dry"
    swing_modes:
      - "off"
      - "vertical"
    min_temp: 16
    max_temp: 31
    temp_step: 0.5
    fan_modes:
      - "auto"
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
    fan_mode_template: >
        {% if state_attr('climate.airco_zolder', 'fan_mode') == diffuse %}
          1
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == low %}
          2
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == medium %}
          3
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == middle %}
          4
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == high %}
          5
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == auto %}
          auto
        {% endif %}
    set_fan_mode:
      - service: climate.set_fan_mode
        target:
          entity_id: climate.airco_zolder
        data:
          fan_mode: >-
            {% if fan_mode == '1' %}
              diffuse
            {% elif fan_mode == '2' %}
              low
            {% elif fan_mode == '3' %}
              medium
            {% elif fan_mode == '4' %}
              middle
            {% elif fan_mode == '5' %}
              high
            {% elif fan_mode == 'auto' %}
              auto
            {% endif %}
    current_temperature_template: "{{ state_attr('climate.airco_zolder', 'current_temperature') }}"
    hvac_mode_template: "{{ states('climate.airco_zolder') }}"
    target_temperature_template: "{{ state_attr('climate.airco_zolder', 'temperature') }}"
    hvac_action_template: "{{ state_attr('climate.airco_zolder', 'hvac_action') }}"
    swing_mode_template: "{{ state_attr('climate.airco_zolder', 'swing_mode') }}"
    set_hvac_mode:
      - service: climate.set_hvac_mode
        data:
          entity_id: climate.airco_zolder
          hvac_mode: "{{ states('climate.airco_zolder_template') }}"
    set_swing_mode:
      - service: climate.set_swing_mode
        target:
          entity_id: climate.airco_zolder
        data:
          swing_mode: "{{ swing_mode }}"
    set_target_temperature:
      - service: climate.set_temperature
        target:
          entity_id: climate.airco_zolder
        data:
          temperature: "{{ states('climate.airco_zolder_template') }}"

Also note that your new readme file has the following 2 changed options that don't work, it gives an error message.

It still wants min_temp and max_temp.

What version of Template Climate has the issue?

0.6.4 (custom climate.py)

What version of Home Assistant are you running?

2024.4.2

What type of installation are you running?

Home Assistant OS

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

litinoveweedle commented 5 months ago

Hello, thank you very much for your testing.

AttributeError: 'TemplateClimate' object has no attribute '_round_temp_step'

This was obvious bug made during refactoring, it is fixed and I tested setting temperature both from UI and as well by calling service climate.set_target_temperature. Please check latest climate.py in the branch.

I do not see any obvious issue with your template - if there isn't any error on HA startup it shall be OK.

For the translation I will have to look deeper where is the issue as I am not aware toughing directly any translation related code.

Arn0uDz commented 5 months ago

With the new climate.py file, setting the hvac mode is no longer working.

Gives me the following error:

Logger: homeassistant.components.websocket_api.http.connection
Source: components/websocket_api/commands.py:239
integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 2:07:08 PM (3 occurrences)
Last logged: 2:08:14 PM

[140369143548096] TemplateClimate.async_set_hvac_mode() got an unexpected keyword argument 'hvac_mode'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1035, in _handle_entity_call
    task = hass.async_run_hass_job(job)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 840, in async_run_hass_job
    return self.async_add_hass_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 681, in async_add_hass_job
    hassjob.target(*args), name=hassjob.name, loop=self.loop
    ^^^^^^^^^^^^^^^^^^^^^
TypeError: TemplateClimate.async_set_hvac_mode() got an unexpected keyword argument 'hvac_mode'

And I have a new error with setting the temperature:

Logger: homeassistant.helpers.script.airco_zolder_template
Source: helpers/script.py:1918
First occurred: 2:04:41 PM (3 occurrences)
Last logged: 2:06:43 PM

Airco Zolder Template: Error executing script. Invalid data for call_service at pos 1: expected float for dictionary value @ data['temperature']

I changed a part of my config, that is why it says data temperature, but even with the old one it's gives the same error about a float.

litinoveweedle commented 5 months ago
    set_hvac_mode:
      - service: climate.set_hvac_mode
        data:
          entity_id: climate.airco_zolder
          hvac_mode: "{{ states('climate.airco_zolder_template') }}"
    set_swing_mode:
      - service: climate.set_swing_mode
        target:
          entity_id: climate.airco_zolder
        data:
          swing_mode: "{{ swing_mode }}"
    set_target_temperature:
      - service: climate.set_temperature
        target:
          entity_id: climate.airco_zolder
        data:
          temperature: "{{ states('climate.airco_zolder_template') }}"

shall be:

    set_hvac_mode:
      - service: climate.set_hvac_mode
        data:
          entity_id: climate.airco_zolder
          hvac_mode: "{{ hvac_mode }}"
    set_swing_mode:
      - service: climate.set_swing_mode
        target:
          entity_id: climate.airco_zolder
        data:
          swing_mode: "{{ swing_mode }}"
    set_target_temperature:
      - service: climate.set_temperature
        target:
          entity_id: climate.airco_zolder
        data:
          temperature: "{{ target_temperature }}"

as states('climate.airco_zolder_template') is never float ;-)

Arn0uDz commented 5 months ago

Well that fixes setting the temperature, that is working now.

But i'm still getting the HVAC mode error. The strange thing is, it was working before you changed it. So something happened to it while you were fixing the set temperature issue. For a test I reverted back to the old climate.py and the HVAC mode works again. So it is not my config.

Logger: homeassistant.components.websocket_api.http.connection
Bron: components/websocket_api/commands.py:239
integratie: Home Assistant WebSocket API (documentatie, problemen)
Eerst voorgekomen: 15:03:17 (3 gebeurtenissen)
Laatst gelogd: 15:03:32

[140126122634176] TemplateClimate.async_set_hvac_mode() got an unexpected keyword argument 'hvac_mode'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 239, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1035, in _handle_entity_call
    task = hass.async_run_hass_job(job)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 840, in async_run_hass_job
    return self.async_add_hass_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 681, in async_add_hass_job
    hassjob.target(*args), name=hassjob.name, loop=self.loop
    ^^^^^^^^^^^^^^^^^^^^^
TypeError: TemplateClimate.async_set_hvac_mode() got an unexpected keyword argument 'hvac_mode'
Arn0uDz commented 5 months ago

Okay I went messing with the climate.py file and replaced line 1124 from

This:

    async def async_set_hvac_mode(self, input: str) -> None:
        """Set new hvac mode."""
        if (
            hvac_mode := self._validate_value(
                "hvac_mode",
                input,
                self._attr_hvac_modes,
            )
        ) is not None:
            await self._async_set_attribute("hvac_mode", hvac_mode)

To this from the old file:

    async def async_set_hvac_mode(self, hvac_mode: str) -> None:
        """Set new hvac mode."""
        await self._async_set_attribute("hvac_mode", hvac_mode)

That appears to have fixed the issue, but I have no clue if this gives any other problems. I'm not a coder and was just comparing the old file vs the new one.

The only problem i'm still having is the strange HVAC modes, even in english it's strange, so it's not a localization issue. It looks to be using the actual config names and not the official HA names, notice the all lower case text and what is up with the celcius behind it?

image

litinoveweedle commented 5 months ago

You are right, syntax validation broke it, as it seems HA is expected some of the async functions to have given input variable with hardcoded names. It shall be fixed (I check it in my setup). Also translation shall be working now. You can check latest climate.py.

In you will not discover any further issue I will in few days merge this branch into my repo a prepare new release, so anyone can use HACS for update.

Thank you very much for your help with testing.

Arn0uDz commented 5 months ago

I have 3 AC units and just set up all 3 of them using your template and all functions are available and working.

I won't be actively using them the next couple days, since it's not needed yet, but I will let HA run uninterrupted and check them every day to see if they keep working like they should.

Will let you know in a couple of days.

Arn0uDz commented 5 months ago

@litinoveweedle Tested them this weekend and all working without problems! You can merge this if you want.

For the record my template, if anyone in the future wants to convert fan speed names to numbers.

climate:
  - platform: climate_template
    name: "Airco Zolder Template"
    unique_id: climate.airco_zolder_template
    hvac_modes:
      - "off"
      - "cool"
      - "heat"
      - "fan_only"
      - "dry"
    swing_modes:
      - "off"
      - "vertical"
    min_temp: 16
    max_temp: 31
    temp_step: 0.5
    fan_modes:
      - "auto"
      - "1"
      - "2"
      - "3"
      - "4"
      - "5"
    fan_mode_template: >
        {% if state_attr('climate.airco_zolder', 'fan_mode') == diffuse %}
          1
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == low %}
          2
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == medium %}
          3
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == middle %}
          4
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == high %}
          5
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == auto %}
          auto
        {% endif %}
    set_fan_mode:
      - service: climate.set_fan_mode
        target:
          entity_id: climate.airco_zolder
        data:
          fan_mode: >-
            {% if fan_mode == '1' %}
              diffuse
            {% elif fan_mode == '2' %}
              low
            {% elif fan_mode == '3' %}
              medium
            {% elif fan_mode == '4' %}
              middle
            {% elif fan_mode == '5' %}
              high
            {% elif fan_mode == 'auto' %}
              auto
            {% endif %}
    current_temperature_template: "{{ state_attr('climate.airco_zolder', 'current_temperature') }}"
    hvac_mode_template: "{{ states('climate.airco_zolder') }}"
    target_temperature_template: "{{ state_attr('climate.airco_zolder', 'temperature') }}"
    hvac_action_template: "{{ state_attr('climate.airco_zolder', 'hvac_action') }}"
    swing_mode_template: "{{ state_attr('climate.airco_zolder', 'swing_mode') }}"
    set_hvac_mode:
      - service: climate.set_hvac_mode
        data:
          entity_id: climate.airco_zolder
          hvac_mode: "{{ hvac_mode }}"
    set_swing_mode:
      - service: climate.set_swing_mode
        target:
          entity_id: climate.airco_zolder
        data:
          swing_mode: "{{ swing_mode }}"
    set_target_temperature:
      - service: climate.set_temperature
        target:
          entity_id: climate.airco_zolder
        data:
          temperature: "{{ target_temperature }}"
litinoveweedle commented 5 months ago

Hello @Arn0uDz and @CV8R, thank you again both for testing. I would like to ask you, if you would be able to retest latest version once more as the changes kept pilling before release. As one of them I reverted changes related to configuration temperature names/syntax back:

set_target_temperature back to set_temperature

{{ target_temperature }} back to {{ temperature }}

I think it make sense to make as less breaking changes as possible. One of other/new changes is, that any modes (hvac, preset, fan, swing) are now not set by default. If required those have to be configured explicitly. This is mostly already used in this way - at least in the users configuration I saw, so this shouldn't have big impact.

I checked (hopefully this time better) functionality which I use in my own setup and I would really welcome if you can test it on yours as well. I pushed latest version to the same branch: climate.py I am running it for two days without issues, but you never know ;-) Thank you.

Arn0uDz commented 5 months ago

@litinoveweedle I'm using the new climate.py and changed my config and it seems to be working fine with all functions.

While you are fine tuning, another thing that I would like to mention is during startup the following errors show up in my log. Those messages were always there but didn't stop it from working, but if there is a way to clean them up, that would be nice.

First one:

This error originated from a custom integration.

Logger: custom_components.climate_template.climate
Source: custom_components/climate_template/climate.py:783
integration: climate_template (documentation, issues)
First occurred: 7:52:45 AM (3 occurrences)
Last logged: 7:52:45 AM

Entity Airco Zolder Template attribute fan_mode returned invalid value: . Expected one of: ['auto', '1', '2', '3', '4', '5'].
Entity Airco Woonkamer Template attribute fan_mode returned invalid value: . Expected one of: ['auto', '1', '2', '3', '4', '5'].

2nd one:

This error originated from a custom integration.

Logger: custom_components.climate_template.climate
Source: custom_components/climate_template/climate.py:1075
integration: climate_template (documentation, issues)
First occurred: 7:52:45 AM (3 occurrences)
Last logged: 7:52:45 AM

Entity Airco Zolder Template attribute fan_mode value is invalid.
Entity Airco Woonkamer Template attribute fan_mode value is invalid.
litinoveweedle commented 5 months ago

Hello, thank you for testing.

Regarding that messages, I am not sure, if those were present all the the time, but yes, I can confirm these are comming from my code. The isse seems to be, that for some reason, your templates are returning empty values. Not none, but empty string. Looking at your config posted above:

    fan_mode_template: >
        {% if state_attr('climate.airco_zolder', 'fan_mode') == diffuse %}
          1
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == low %}
          2
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == medium %}
          3
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == middle %}
          4
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == high %}
          5
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == auto %}
          auto
        {% endif %}

you miss else. :-) Root cause is, that for unknown reason state_attr('climate.airco_zolder') returns some other value than the one listed in conditions and you template not having else will return empty value, which is evaluated by the new code and claimed as invalid, because it is not valid fan_mode. If you like to catch what oter value state_attr('climate.airco_zolder') returns during startup, you can try:

    fan_mode_template: >
        {% if state_attr('climate.airco_zolder', 'fan_mode') == diffuse %}
          1
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == low %}
          2
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == medium %}
          3
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == middle %}
          4
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == high %}
          5
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == auto %}
          auto
        {% else %}
          state_attr('climate.airco_zolder', 'fan_mode')
        {% endif %}

It will not solve you issue, but you will see it.

Than If this is not valid mode value, I would propose:

    fan_mode_template: >
        {% if state_attr('climate.airco_zolder', 'fan_mode') == diffuse %}
          1
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == low %}
          2
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == medium %}
          3
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == middle %}
          4
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == high %}
          5
        {% elif state_attr('climate.airco_zolder', 'fan_mode') == auto %}
          auto
        {% else %}
          unknown
        {% endif %}

I will make some small changes in the logging and this should not generate messages in higher than debug level mode.

CV8R commented 5 months ago

Hi @litinoveweedle

Testing the latest version and so far looks okay.

One thing I have noticed with this integration and my biggest issue with it is that a status change triggers the service which causes loops, races and general hassles. I know this is a separate issue but thought I would mention it.

For example here is an example where the set point was changed on the AC units panel, resulting in triggering the setpoint service.

2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature triggered update with value: 21.0.
2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC updating attribute target_temperature to value: 21.0.
2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_temperature variables: {'temperature': 21.0}.
2024-04-17 21:48:18.463 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_temperature finished.

I believe this issue is related https://github.com/jcwillox/hass-template-climate/issues/14

Below is an example of trying to turn the unit off from heat mode using the template - note it triggers the "Already running"

Shall I create a new issue in your repo for this?

2024-04-17 21:54:47.093 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute hvac_mode triggered update with value: off.
2024-04-17 21:54:47.093 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC updating attribute hvac_mode to value: off.
2024-04-17 21:54:47.093 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_hvac_mode variables: {'hvac_mode': 'off'}.
2024-04-17 21:54:48.106 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute hvac_mode triggered update with value: off.
2024-04-17 21:54:48.106 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute hvac_mode is already set to value: off.
2024-04-17 21:54:48.106 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_hvac_mode variables: {'hvac_mode': 'off'}.
2024-04-17 21:54:48.106 WARNING (MainThread) [homeassistant.helpers.script.panasonic_ducted_ac] Panasonic Ducted AC: Already running
2024-04-17 21:54:48.106 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_hvac_mode finished.
2024-04-17 21:54:48.107 ERROR (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature returned invalid value: 0.0, which is smaller than min setpoint: 16.0.
2024-04-17 21:54:48.107 ERROR (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature value 0.0 is invalid.
2024-04-17 21:54:48.113 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute hvac_mode triggered update with value: heat.
2024-04-17 21:54:48.113 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC updating attribute hvac_mode to value: heat.
2024-04-17 21:54:48.113 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_hvac_mode variables: {'hvac_mode': 'heat'}.
2024-04-17 21:54:48.114 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature triggered update with value: 21.0.
2024-04-17 21:54:48.114 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature is already set to value: 21.0.
2024-04-17 21:54:48.114 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_temperature variables: {'temperature': 21.0}.
2024-04-17 21:54:48.121 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_hvac_mode finished.
2024-04-17 21:54:48.647 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute hvac_mode triggered update with value: off.
2024-04-17 21:54:48.648 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC updating attribute hvac_mode to value: off.
2024-04-17 21:54:48.648 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_hvac_mode variables: {'hvac_mode': 'off'}.
2024-04-17 21:54:48.648 WARNING (MainThread) [homeassistant.helpers.script.panasonic_ducted_ac] Panasonic Ducted AC: Already running
2024-04-17 21:54:48.648 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_hvac_mode finished.
2024-04-17 21:54:48.648 ERROR (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature returned invalid value: 0.0, which is smaller than min setpoint: 16.0.
2024-04-17 21:54:48.648 ERROR (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature value 0.0 is invalid.
2024-04-17 21:54:49.130 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_temperature finished.
2024-04-17 21:54:51.138 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_hvac_mode finished.
Arn0uDz commented 5 months ago

@litinoveweedle I tried both your suggestions in my config but the warning remains. I'm not really bothered by it though, so changing the logging level should be enough.

litinoveweedle commented 5 months ago

@litinoveweedle I tried both your suggestions in my config but the warning remains. I'm not really bothered by it though, so changing the logging level should be enough.

Because you were too fast, I needed to push tweaked version first. :-) Now if passing literal unknown it shall trigger only debug level message. Just curious, what was the logged value when you used first step?

Arn0uDz commented 5 months ago

@litinoveweedle It was the same as this, but with the state_attr part in it and without the unknown.

2024-04-17 14:32:08.069 ERROR (MainThread) [custom_components.climate_template.climate] Entity Airco Zolder Template attribute fan_mode value unknown is invalid.

Tried your new climate.py file and your 2nd suggestion with the unknown in my config and the errors are now gone. Or atleast not visible to me anymore.

litinoveweedle commented 5 months ago

It was the same as this, but with the state_attr part in it and without the unknown.

Yep, that was expected. I am glad, that is is OK now.

litinoveweedle commented 5 months ago

Hi @litinoveweedle

Testing the latest version and so far looks okay.

One thing I have noticed with this integration and my biggest issue with it is that a status change triggers the service which causes loops, races and general hassles. I know this is a separate issue but thought I would mention it.

For example here is an example where the set point was changed on the AC units panel, resulting in triggering the setpoint service.

2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC attribute target_temperature triggered update with value: 21.0.
2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC updating attribute target_temperature to value: 21.0.
2024-04-17 21:48:17.457 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC executing script set_action_temperature variables: {'temperature': 21.0}.
2024-04-17 21:48:18.463 DEBUG (MainThread) [custom_components.climate_template.climate] Entity Panasonic Ducted AC execution of script set_action_temperature finished.

I believe this issue is related https://github.com/jcwillox/hass-template-climate/issues/14

Below is an example of trying to turn the unit off from heat mode using the template - note it triggers the "Already running"

Shall I create a new issue in your repo for this?

Hello, sorry for later reply, fighting issues one by one. :-) Can you please create new issue for this? But honestly there are some limitation of what can be logically done - but lets discuss it in the separate thread. Thank you.

Arn0uDz commented 4 months ago

@litinoveweedle Don't forget to update your repo with this.