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

Presence sensor error message when changing value of configuration entity #130218

Closed
pfh-47 opened this issue Nov 9, 2024 · 12 comments · Fixed by #131680
Closed

Presence sensor error message when changing value of configuration entity #130218

pfh-47 opened this issue Nov 9, 2024 · 12 comments · Fixed by #131680

Comments

@pfh-47
Copy link

pfh-47 commented Nov 9, 2024

The problem

Changing the value of a configuration entity (e.g. number.presence_bed1_number_sensitivity) for a presence sensor (TS0601
by _TZE204_qasjif9e) throws an error message: "Failed to convert attr_value=57000.0 from type <class 'zigpy.types.basic.Single'> to int | str". Either in YAML or manually, the requested change is implemented despite the error message. The execution of a script continues.

What version of Home Assistant Core has the issue?

core-2024.11.1

What was the last working version of Home Assistant Core?

core-2024.11.0

What type of installation are you running?

Home Assistant OS

Integration causing the issue

No response

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

alias: Set Presence bed1 Number Fading time to slower
action: number.set_value
metadata: {}
data:
  value: "57000"
target:
  entity_id: number.presence_bed1_number_fading_time

Anything in the logs that might be useful for us?

From the log ...
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/zigpy/types/struct.py", line 50, in _convert_type
    return field_type(value)
           ^^^^^^^^^^^^^^^^^
TypeError: 'types.UnionType' object is not callable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 245, in handle_call_service
    response = await hass.services.async_call(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/number/__init__.py", line 122, in async_set_value
    await entity.async_set_native_value(native_value)
  File "/usr/src/homeassistant/homeassistant/components/zha/helpers.py", line 1335, in handler
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/zha/number.py", line 88, in async_set_native_value
    await self.entity_data.entity.async_set_native_value(value=value)
  File "/usr/local/lib/python3.12/site-packages/zha/application/platforms/number/__init__.py", line 173, in async_set_native_value
    await self._analog_output_cluster_handler.async_set_present_value(float(value))
  File "/usr/local/lib/python3.12/site-packages/zha/zigbee/cluster_handlers/general.py", line 161, in async_set_present_value
    await self.write_attributes_safe(
  File "/usr/local/lib/python3.12/site-packages/zha/zigbee/cluster_handlers/__init__.py", line 614, in write_attributes_safe
    res = await self.write_attributes(attributes, manufacturer=manufacturer)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zha/zigbee/cluster_handlers/__init__.py", line 85, in wrapper
    return await RETRYABLE_REQUEST_DECORATOR(func)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/util.py", line 136, in retry
    return await func()
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zhaquirks/tuya/mcu/__init__.py", line 111, in write_attributes
    cluster_data = TuyaClusterData(
                   ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/types/struct.py", line 118, in __new__
    setattr(instance, name, field._convert_type(value, struct=instance))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/zigpy/types/struct.py", line 52, in _convert_type
    raise ValueError(
ValueError: Failed to convert attr_value=2.0 from type <class 'zigpy.types.basic.Single'> to int | str

Additional information

No response

@belyaev-ban
Copy link

belyaev-ban commented Nov 10, 2024

Same issue with TS0601 by _TZE204_ya4ft0w4.

I'm using quirk from this device support request to run it.

@patriciaboaventura
Copy link

I guess something happened after October update... same issue with _TZE204_ya4ft0w4 here

@flarestarwingz
Copy link

I am also running the TZE204_ya4ft0w4 with a custom quirk and the latest update has stopped the sensor for working with the same cast int issue documented above.

@pfh-47
Copy link
Author

pfh-47 commented Nov 20, 2024

Further investigation shows, in my case, that the value of the target configuration parameter is changed only momentarily, reverting to the previous value. Effectively I cannot control the configuration parameters of the presence sensor either manually or YAML.

@idumzaes
Copy link

same issue here with TZE204_qasjif9e :(

@mklimasz5
Copy link

Confirming same issue on TZE204_qasjif9e, quirked with ts601_motion.TuyaMmwRadarOccupancyVariant2, running HA on RPI4, issue cripples sensor configuration on: core_2024.11.1, core_2024.11.2 and core_2024.11.3...

@pfh-47
Copy link
Author

pfh-47 commented Nov 25, 2024

See zigpy/zha-device-handlers#3520 for progress on a solution

@TheJulianJES
Copy link
Member

When filling out the issue template in the future, please provide the "Link to integration documentation on our website". Otherwise, we aren’t notified of the issue until a maintainer manually adds the ZHA integration label.

@home-assistant
Copy link

Hey there @dmulcahey, @Adminiuga, @puddly, mind taking a look at this issue as it has been labeled with an integration (zha) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of zha can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign zha Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


zha documentation
zha source
(message by IssueLinks)

@puddly
Copy link
Contributor

puddly commented Nov 25, 2024

I believe this may be fixed by zigpy/zha#267.

@prairiesnpr
Copy link

I think zigpy/zha-device-handlers#3546 should resolve this.

@TheJulianJES
Copy link
Member

Yeah, it was a regression in zha-quirks and should be fixed with HA Core 2024.12.
It happens when actual config entities are used to change values (number entity in the logs), not the "Manage Zigbee device" dialog.

@TheJulianJES TheJulianJES mentioned this issue Nov 27, 2024
19 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Dec 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.