Skip to content

synology int object has no attribute tzinfo #169489

@Anto79-ops

Description

@Anto79-ops

The problem

Hello,

Updated to 2026.5.0b0 on HAOS/bare-metal NUC and received this log error:

Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:680
Integration: Sensor (documentation, issues)
First occurred: 11:08:06 AM (1 occurrence)
Last logged: 11:08:06 AM

Error adding entity sensor.synologyds923_last_boot for domain sensor with platform synology_dsm
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 644, in state
    if value.tzinfo is None:
       ^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'tzinfo'

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 680, in _async_add_entities
    await self._async_add_entity(
        entity, False, entity_registry, config_subentry_id
    )
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 1010, in _async_add_entity
    await entity.add_to_platform_finish()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1435, in add_to_platform_finish
    self.async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1054, in async_write_ha_state
    self._async_write_ha_state()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1203, in _async_write_ha_state
    ) = self.__async_calculate_state()
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in __async_calculate_state
    state = self._stringify_state(available)
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1060, in _stringify_state
    if (state := self.state) is None:
                 ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 658, in state
    raise ValueError(
    ...<2 lines>...
    ) from err
ValueError: Invalid datetime: sensor.synologyds923_last_boot has uptime device class but provides state 3490165:<class 'int'> resulting in ''int' object has no attribute 'tzinfo''

Integration appears to be working fine, hownever.

What version of Home Assistant Core has the issue?

2026.5.0b0

What was the last working version of Home Assistant Core?

2026.4.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Synology DSM

Link to integration documentation on our website

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

Diagnostics information

No response

Example YAML snippet

Anything in the logs that might be useful for us?

Additional information

No response

Metadata

Metadata

Type

No type

Priority

None yet

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions