core: since 2022.8.6 release mobile_app senors fail to setup

The problem

I get a error message in my log that states the Following

Logger: homeassistant.components.sensor
Source: util/dt.py:185
Integration: Sensor (documentation, issues)
First occurred: 4:31:11 AM (2 occurrences)
Last logged: 4:31:11 AM

Error adding entities for domain sensor with platform mobile_app
Error while setting up mobile_app platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 428, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 673, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 776, in add_to_platform_finish
    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 388, in state
    value = self.native_value
  File "/usr/src/homeassistant/homeassistant/components/mobile_app/sensor.py", line 113, in native_value
    and (timestamp := dt_util.parse_datetime(state)) is not None
  File "/usr/src/homeassistant/homeassistant/util/dt.py", line 185, in parse_datetime
    return ciso8601.parse_datetime(dt_str)
TypeError: argument 1 must be str, not datetime.datetime

it seems to be having an issue parsing what should be a date string… but its not a string…

What version of Home Assistant Core has the issue?

2022.8.6

What was the last working version of Home Assistant Core?

2022.8.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Sensor

Link to integration documentation on our website

https://www.home-assistant.io/integrations/sensor

Diagnostics information

It says its related to mobile_app and I have both types… and neither has Diagnostic Data to download

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 25
  • Comments: 20

Most upvoted comments

I’m seeing the exact same thing once I updated to 2202.8.6.

@kobusdbr this issue has nothing to to with TTS

If your APP has been updated to v2202.8.0 you need to review the release notes. Several breaking changes this update, TTS included.

https://github.com/home-assistant/android/releases/tag/2022.8.0 https://companion.home-assistant.io/

@jazzyisj Thank you. Due to your message I was able to resolve my issue. How TTS is used has changed. Thank you

I can confirm that the latest Core release 2022.8.7 still experiences this issue.

Can confirm the issue - and that the error goes away after downgrading to 2022.8.5.

This issue seems to be related to the next_alarm sensor, it became unavailable after I updated to 2022.8.6. Same issue for all phones connected to my instance.