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

Do not write state if payload is ''
pull/79423/head
Jan Bouwhuis 2022-10-01 18:00:54 +02:00 committed by GitHub
parent 31ddf6cc31
commit 9c9c8b324a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

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)