I read in the value from an oid using Paessler SNMP Tester. That value is expressed as a ASN_TIMETICKS.
Not sure if this helps but here is the HA error using modified code
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:580
integration: Sensor (documentation, issues)
First occurred: 8:34:22 PM (1 occurrences)
Last logged: 8:34:22 PM
Error adding entity sensor.ups_uptime for domain sensor with platform snmp
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 663, in state
numerical_value = float(value) # type:ignore[arg-type]
^^^^^^^^^^^^
ValueError: could not convert string to float: ‘11500 days, 5 hours, 3 minutes, 20 seconds’
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 580, in _async_add_entities
await coro
File “/usr/src/homeassistant/homeassistant/helpers/entity_platform.py”, line 892, in _async_add_entity
await entity.add_to_platform_finish()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1358, in add_to_platform_finish
await self.async_added_to_hass()
File “/usr/src/homeassistant/homeassistant/components/snmp/sensor.py”, line 214, in async_added_to_hass
await self.async_update()
File “/usr/src/homeassistant/homeassistant/components/snmp/sensor.py”, line 230, in async_update
self._process_manual_data(raw_value)
File “/usr/src/homeassistant/homeassistant/helpers/trigger_template_entity.py”, line 239, in _process_manual_data
self.async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1009, in async_write_ha_state
self._async_write_ha_state()
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1132, in _async_write_ha_state
state, attr, capabilities, shadowed_attr = self.__async_calculate_state()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1067, in __async_calculate_state
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/helpers/entity.py”, line 1015, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File “/usr/src/homeassistant/homeassistant/components/sensor/init.py”, line 665, in state
raise ValueError(
ValueError: Sensor sensor.ups_uptime has device class ‘None’, state class ‘None’ unit ‘time’ and suggested precision ‘None’ thus indicating it has a numeric value; however, it has the non-numeric value: ‘11500 days, 5 hours, 3 minutes, 20 seconds’ (<class ‘str’>)