question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

sensor AssertionError with 2022.4

See original GitHub issue

Hello I’m trying the last beta and I got an error. I added two lines to /usr/src/homeassistant/homeassistant/components/sensor/__init__.py to know which integration raise this error

            _LOGGER.warning(self.name)
            _LOGGER.warning(native_unit_of_measurement)

logs:

2022-04-06 09:21:34 WARNING (MainThread) [homeassistant.components.sensor] Pure Hot+Cool Temperature
2022-04-06 09:21:34 WARNING (MainThread) [homeassistant.components.sensor] None
2022-04-06 09:21:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 137, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 268, in _async_refresh
    update_callback()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 328, in _handle_coordinator_update
    self.async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 532, in async_write_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 456, in state
    assert native_unit_of_measurement
AssertionError
2022-04-06 09:21:34 WARNING (MainThread) [homeassistant.components.sensor] Pure Hot+Cool Temperature
2022-04-06 09:21:34 WARNING (MainThread) [homeassistant.components.sensor] None
2022-04-06 09:21:34 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 519, in async_update_ha_state
    self._async_write_ha_state()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 570, in _async_write_ha_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 538, in _stringify_state
    if (state := self.state) is None:
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 456, in state
    assert native_unit_of_measurement
AssertionError
/bin/sh: False: not found

Thank you

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jasperslitscommented, Apr 6, 2022

I had the same issue but I had to keep the _attr_device_class to the existing “DEVICE_CLASS_TEMPERATURE”, it didn’t like changing it to SensorDeviceClass.TEMPERATURE. I’ve got v0.16.2 installed through HACS and I was editing directly in the custom_components/dyson_local/ folder using Studio Code Server. Also like everything HACS, had to restart HA after making changes for them to show up.

As for the switches and other sensors, I was able to get them working by editing sensor.py and switch.py using this change from the Alexa Media Player.

I basically added from homeassistant.helpers.entity import EntityCategory to the top sections of the two files and then changed any instance of ENTITY_CATEGORY_DIAGNOSTIC to EntityCategory.DIAGNOSTIC and instances of ENTITY_CATEGORY_CONFIG to EntityCategory.CONFIG.

Don’t know how to do a pull request, but hopefully this might help.

The current brach - unreleased - already has these fixes. I think for users already upgraded to 2022.04 it makes sense that @shenxn creates a new release which includes my PR. I don’t have any Dyson errors / warnings in my HA with this.

1reaction
monsieurlattecommented, Apr 6, 2022

Glad to see I’m not the only one, so many entries that dont work that I use a lot (mostly the night mode toggle lol).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Still issue after update HA to core-2022.4.7 #743 - GitHub
I am running the latest integration and FW 1.5.0_0102 and everything works in 4.6 but stops when updating to 4.7 the issue I...
Read more >
Python | Assertion Error - GeeksforGeeks
Assertion Error Assertion is a programming concept used while writing a code where the user declares a condition to be true using assert ......
Read more >
AssertionError - Android Developers
Constructs an AssertionError with its detail message derived from the specified object, which is converted to a string as defined in section 15.18.1.1...
Read more >
AssertionError (Java Platform SE 7 ) - Oracle Help Center
Constructs an AssertionError with its detail message derived from the specified boolean , which is converted to a string as defined in section...
Read more >
How to change the message in a Python AssertionError?
I always get AssertionError: u'something' != 'something else' , which only shows the first line of the output. How can I change the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found