tetele / hvac_group

Group together `climate` components for easy control
MIT License
23 stars 5 forks source link

'HvacGroupClimateEntity' object has no attribute '_target_temperature' #50

Closed rk-nova closed 6 months ago

rk-nova commented 6 months ago

System Health details

System Information

version core-2024.1.5
installation_type Unknown
dev false
hassio false
docker false
user root
virtualenv false
python_version 3.11.6
os_name Linux
os_version 6.1.63-production+truenas
arch x86_64
timezone America/Los_Angeles
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4783 Installed Version | 1.34.0 Stage | running Available Repositories | 1383 Downloaded Repositories | 32
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | August 30, 2024 at 5:00 PM relayer_connected | true relayer_region | us-east-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | true remote_server | us-east-1-8.ui.nabu.casa certificate_status | ready instance_id | 8fb2c7ce6af84f0bb82af2f5afeecfef can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
keymaster zwave_integration | zwave_js -- | -- network_status | on
Dashboards dashboards | 19 -- | -- resources | 13 views | 21 mode | storage
Recorder oldest_recorder_run | January 21, 2024 at 10:31 PM -- | -- current_recorder_run | January 28, 2024 at 6:42 PM estimated_db_size | 462.57 MiB database_engine | postgresql database_version | 15.3
Spotify api_endpoint_reachable | ok -- | --

Checklist

Describe the issue

Working on setting up a group for the first time, and when I change the mode from Off to Heat/Cool, I get this error:

'HvacGroupClimateEntity' object has no attribute '_target_temperature'

The error shows up as a popup at the bottom of the HA web UI and in the logs.

Note that the AC thermostat in this case is using generic_thermostat to give me a virtual thermostat (which then triggers an IR blaster to change settings on the AC unit). I don't think this is related to the root cause, but wroth noting.

Full callstack: 2024-01-28 18:49:24.315 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140076596258112] 'HvacGroupClimateEntity' object has no attribute '_target_temperature' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service response = await hass.services.async_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service return await service.entity_service_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call single_response = await _handle_entity_call( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call result = await task ^^^^^^^^^^ File "/config/custom_components/hvac_group/climate.py", line 1218, in async_set_hvac_mode await self.async_defer_or_update_ha_state(update_actuators=True) File "/config/custom_components/hvac_group/climate.py", line 837, in async_defer_or_update_ha_state await self.async_run_hvac(update_actuators=update_actuators) File "/config/custom_components/hvac_group/climate.py", line 962, in async_run_hvac or self._target_temperature is not None ^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'HvacGroupClimateEntity' object has no attribute '_target_temperature'

The group has two items, one heat only and one cool only. Worth noting that in the details popup/card, I don't see the UI to set either the target high or low temp.

Any way, thanks for the help and the integration! I was looking for something just like this last fall. Don't actually need it to function right now as the AC units have been removed, just doing some testing before spring gets here.

Reproduction steps

  1. Create new group
  2. Open card from helpers list
  3. Change mode from Off

Debug logs

2024-01-28 18:59:22.014 DEBUG (MainThread) [custom_components.hvac_group] Actutator climate.bedroom_virtual changed state: {'state': 'off', 'attributes': {'hvac_modes': [<HVACMode.COOL: 'cool'>, <HVACMode.OFF: 'off'>], 'min_temp': 45, 'max_temp': 95, 'target_temp_step': 1, 'current_temperature': None, 'temperature': 72, 'hvac_action': <HVACAction.OFF: 'off'>, 'friendly_name': 'Bedroom_virtual', 'supported_features': <ClimateEntityFeature.TARGET_TEMPERATURE: 1>}} (context 01HN9JGERRGN3S2GQGR683A1RA)
2024-01-28 18:59:22.014 DEBUG (MainThread) [custom_components.hvac_group] New min/max temps received from actuator climate.bedroom_virtual: (45, 95). HVAC Group climate.upstairs_climate new min/max temps: 45.0, 45.0
2024-01-28 18:59:23.347 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform esphome does not generate unique IDs. ID C0:49:EF:6F:21:2C-binary_sensor-_mmwave already exists - ignoring binary_sensor.mmwave
2024-01-28 18:59:23.347 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform esphome does not generate unique IDs. ID C0:49:EF:6F:21:2C-binary_sensor-_pir already exists - ignoring binary_sensor.pir
2024-01-28 18:59:23.347 ERROR (MainThread) [homeassistant.components.binary_sensor] Platform esphome does not generate unique IDs. ID C0:49:EF:6F:21:2C-binary_sensor-_occupancy already exists - ignoring binary_sensor.occupancy
2024-01-28 18:59:25.477 DEBUG (MainThread) [custom_components.hvac_group] Actutator climate.upstairs_thermostat_thermostat changed state: {'state': 'unavailable', 'attributes': {'hvac_modes': [<HVACMode.OFF: 'off'>, <HVACMode.HEAT: 'heat'>], 'min_temp': 41, 'max_temp': 86, 'friendly_name': 'Upstairs Thermostat Thermostat', 'supported_features': <ClimateEntityFeature.TARGET_TEMPERATURE: 1>}} (context 01HN9JGJ53F15F214Y1B80FAQF)
2024-01-28 18:59:25.477 DEBUG (MainThread) [custom_components.hvac_group] New min/max temps received from actuator climate.upstairs_thermostat_thermostat: (41, 86). HVAC Group climate.upstairs_climate new min/max temps: 45.0, 45.0
2024-01-28 18:59:25.477 DEBUG (MainThread) [custom_components.hvac_group] Setting temperature (None-None) on HVAC group climate.upstairs_climate
2024-01-28 18:59:25.477 DEBUG (MainThread) [custom_components.hvac_group] Setting mode heat_cool on HVAC group climate.upstairs_climate
2024-01-28 18:59:25.477 DEBUG (MainThread) [custom_components.hvac_group] New temperature received from temp sensor sensor.upstairs_thermostat_current_temperature: unavailable. Setting on HVAC Group climate.upstairs_climate
2024-01-28 18:59:25.478 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/hvac_group/climate.py", line 800, in async_sensor_state_changed_listener
    await self.async_update_temperature_sensor(
  File "/config/custom_components/hvac_group/climate.py", line 935, in async_update_temperature_sensor
    float(new_temperature) if new_temperature is not None else new_temperature
    ^^^^^^^^^^^^^^^^^^^^^^
ValueError: could not convert string to float: 'unavailable'
2024-01-28 18:59:25.484 DEBUG (MainThread) [custom_components.hvac_group] New temperature received from temp sensor sensor.upstairs_thermostat_current_temperature: 72.5. Setting on HVAC Group climate.upstairs_climate
2024-01-28 18:59:25.484 DEBUG (MainThread) [custom_components.hvac_group] Actutator climate.upstairs_thermostat_thermostat changed state: {'attributes': {'current_temperature': (72, None), 'temperature': (72, None), 'current_humidity': (48, None), 'hvac_action': (<HVACAction.IDLE: 'idle'>, None)}, 'state': ('heat', 'unavailable')} (context 01HN9JGJ5B8CCQDSX6P2H3TM66)
2024-01-28 18:59:25.485 DEBUG (MainThread) [custom_components.hvac_group] Actutator climate.bedroom_virtual changed state: {'attributes': {'current_temperature': (72, None)}} (context 01HN9JGJ5CFSGFF6RYN3F22FS4)
2024-01-28 18:59:35.119 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/config/custom_components/hvac_group/climate.py", line 825, in _update_at_start
    await self.async_defer_or_update_ha_state(update_actuators=True)
  File "/config/custom_components/hvac_group/climate.py", line 837, in async_defer_or_update_ha_state
    await self.async_run_hvac(update_actuators=update_actuators)
  File "/config/custom_components/hvac_group/climate.py", line 962, in async_run_hvac
    or self._target_temperature is not None
       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HvacGroupClimateEntity' object has no attribute '_target_temperature'
2024-01-28 19:00:21.290 DEBUG (MainThread) [custom_components.hvac_group] Setting mode heat_cool on HVAC group climate.upstairs_climate
2024-01-28 19:00:21.290 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [139921429107904] 'HvacGroupClimateEntity' object has no attribute '_target_temperature'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 238, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2149, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2186, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 272, in handle_service
    return await service.entity_service_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 882, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 952, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/hvac_group/climate.py", line 1218, in async_set_hvac_mode
    await self.async_defer_or_update_ha_state(update_actuators=True)
  File "/config/custom_components/hvac_group/climate.py", line 837, in async_defer_or_update_ha_state
    await self.async_run_hvac(update_actuators=update_actuators)
  File "/config/custom_components/hvac_group/climate.py", line 962, in async_run_hvac
    or self._target_temperature is not None
       ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'HvacGroupClimateEntity' object has no attribute '_target_temperature'

Diagnostics dump

No response

rk-nova commented 6 months ago

I tried creating a new group with just two heaters in it (so single mode, no use of generic_thermostat ), and it does not get the same error. Still no way to set the target temp in the card though.

tetele commented 6 months ago

I've found an edge case and i've added a fix that may address your issue. Could you please let me know if it's working well after updating to 0.1.1?

rk-nova commented 6 months ago

Confirmed, that fixed the error, thanks for the fast fix! I am still not able to set the target temp. but I will create a new issue with more info on that.