February 8, 20242 yr Running the following versions on my NUC Core - 2024.2.0 Supervisor - 2024.01.1 Operating System - 11.5 Frontend - 20240207.0 I have a node function that looks like this //var fulltopic msg.topic = "homeassistant/sensor/SunSynk" + "/" + "/" + msg.shorttopic + "/" + "config"; msg.topic = msg.topic.replace("//", "/"); msg.payload = { "unit_of_measurement": msg.unit, "state_topic": "homeassistant/sensor/SunSynk" + "/" + msg.shorttopic + "/" + "value", "name": "SunSynk_" + msg.shorttopic, "unique_id": msg.shorttopic, //"state_class": msg.state_class, //"last_reset_topic": "SunSynk/lastreset", //"last_reset_value_template": "1970-01-01T00:00:00+00:00", "device": { "identifiers": [ "SunSynk" ], "name": "SunSynk", "model": "SynSynk", "manufacturer": "SunSynk" } } if ((msg.deviceclass != "") && (msg.deviceclass != "none")) { msg.payload.device_class = msg.deviceclass } return msg; But I'm getting the following errors in the log. Logger: homeassistant.components.mqtt.models Source: components/mqtt/models.py:305 Integration: MQTT (documentation, issues) First occurred: 12:39:41 PM (6 occurrences) Last logged: 12:39:43 PM Exception raised when updating state of sensor.sunsynk_total_load, topic: 'homeassistant/sensor/SunSynk/total_load/value' with payload: b'1600' Exception raised when updating state of sensor.sunsynk_load_grid_inverter, topic: 'homeassistant/sensor/SunSynk/load_grid_inverter/value' with payload: b'89' Exception raised when updating state of sensor.sunsynk_grid_load_calc, topic: 'homeassistant/sensor/SunSynk/grid_load_calc/value' with payload: b'-63' Exception raised when updating state of sensor.sunsynk_grid_ct, topic: 'homeassistant/sensor/SunSynk/grid_ct/value' with payload: b'15' Exception raised when updating state of sensor.sunsynk_grid_load_calc, topic: 'homeassistant/sensor/SunSynk/grid_load_calc/value' with payload: b'-74' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/mqtt/models.py", line 305, in process_write_state_requests entity.async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 989, in async_write_ha_state self._async_write_ha_state() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1110, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1049, in __async_calculate_state attr.update(self.state_attributes or {}) ^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 453, in state_attributes raise ValueError( ValueError: Entity sensor.sunsynk_solar_pv2_volts (<class 'homeassistant.components.mqtt.sensor.MqttSensor'>) with state_class None has set last_reset. Setting last_reset for entities with state_class other than 'total' is not supported. Please update your configuration if state_class is manually configured. Any ideas?
March 29, 20242 yr Fixed this by changing "state_class" value to "total" (as shown bellow). It was and issue related to this. https://github.com/home-assistant/core/issues/112723
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.