mirror of
https://github.com/home-assistant/core.git
synced 2025-11-10 11:29:46 +00:00
Move temperature conversions to entity base class (2/8) (#54468)
This commit is contained in:
@@ -33,9 +33,9 @@ class DSMRSensor(SensorEntity):
|
||||
def message_received(message):
|
||||
"""Handle new MQTT messages."""
|
||||
if self.entity_description.state is not None:
|
||||
self._attr_state = self.entity_description.state(message.payload)
|
||||
self._attr_native_value = self.entity_description.state(message.payload)
|
||||
else:
|
||||
self._attr_state = message.payload
|
||||
self._attr_native_value = message.payload
|
||||
|
||||
self.async_write_ha_state()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user