Ignore an '' value_template result for MQTT sensor (#79417)

Do not write state if payload is ''
This commit is contained in:
Jan Bouwhuis
2022-10-01 18:00:54 +02:00
committed by GitHub
parent 31ddf6cc31
commit 9c9c8b324a

View File

@@ -271,8 +271,8 @@ class MqttSensor(MqttEntity, RestoreSensor):
)
elif self.device_class == SensorDeviceClass.DATE:
payload = payload.date()
self._state = payload
if payload != "":
self._state = payload
def _update_last_reset(msg):
payload = self._last_reset_template(msg.payload)