From f86eab2269d096777879440bb0e7910066c731bb Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 24 Jun 2021 18:34:26 +0200 Subject: [PATCH] Correct information on how to generate a 0-timestamp (#979) --- blog/2021-05-25-sensor_attributes.md | 2 +- docs/core/entity/sensor.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/2021-05-25-sensor_attributes.md b/blog/2021-05-25-sensor_attributes.md index 5d840384..7316e19d 100644 --- a/blog/2021-05-25-sensor_attributes.md +++ b/blog/2021-05-25-sensor_attributes.md @@ -22,4 +22,4 @@ Note that _measurement in present time_ above does not imply that the state has ### last_reset -The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. was initialized. If the time of initialization is unknown and the meter will never reset, set to UNIX epoch 0: `datetime.fromtimestamp(0)`. Note that the `datetime.datetime` returned by the `last_reset` property will be converted to an ISO 8601-formatted string when the entity's state attributes are updated. When changing `last_reset`, the `state` must be a valid number. +The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. was initialized. If the time of initialization is unknown and the meter will never reset, set to UNIX epoch 0: `homeassistant.util.dt.utc_from_timestamp(0)`. Note that the `datetime.datetime` returned by the `last_reset` property will be converted to an ISO 8601-formatted string when the entity's state attributes are updated. When changing `last_reset`, the `state` must be a valid number. diff --git a/docs/core/entity/sensor.md b/docs/core/entity/sensor.md index dbd2bc8e..8e6091e2 100644 --- a/docs/core/entity/sensor.md +++ b/docs/core/entity/sensor.md @@ -15,7 +15,7 @@ Properties should always only return information from memory and not do I/O (lik | ---- | ---- | ------- | ----------- | state | string | **Required** | The value of the sensor. | device_class | string | `None` | Type of sensor. -| last_reset | `datetime.datetime` | `None` | The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. was initialized. If the time of initialization is unknown and the meter will never reset, set to UNIX epoch 0: `datetime.fromtimestamp(0)`. Note that the `datetime.datetime` returned by the `last_reset` property will be converted to an ISO 8601-formatted string when the entity's state attributes are updated. When changing `last_reset`, the `state` must be a valid number. +| last_reset | `datetime.datetime` | `None` | The time when an accumulating sensor such as an electricity usage meter, gas meter, water meter etc. was initialized. If the time of initialization is unknown and the meter will never reset, set to UNIX epoch 0: `homeassistant.util.dt.utc_from_timestamp(0)`. Note that the `datetime.datetime` returned by the `last_reset` property will be converted to an ISO 8601-formatted string when the entity's state attributes are updated. When changing `last_reset`, the `state` must be a valid number. | state_class | string | `None` | Type of state. | unit_of_measurement | string | `None` | The unit of measurement that the sensor is expressed in.