Dear community,
I am playing around with a D1_mini, mqtt, a DTH-sensor and DeepSleepMode. Everything works fine, except timestamp is shown as unknown. Over mqtt, I get a timestamp and I want to show this in dasboard, so that I know how old the data is.
data recieved via mqtt:
Nachricht 9 empfangen auf tele/D1mini_Wohnzimmer/SENSOR um 21:03:
{
"Time": "2022-03-23T21:02:59",
"ANALOG": {
"A0": 895
},
"AM2301": {
"Temperature": 22.8,
"Humidity": 40.6,
"DewPoint": 8.7
},
"TempUnit": "C"
}
QoS: 0 - Retain: false
My sensor config (see last sensor)
- platform: mqtt
name: "Wohnzimmer Temperatur"
state_topic: "tele/D1mini_Wohnzimmer/SENSOR"
device_class: "temperature"
unit_of_measurement: "°C"
value_template: "{{ value_json.AM2301.Temperature | float }}"
- platform: mqtt
name: "Wohnzimmer Feuchtigkeit"
state_topic: "tele/D1mini_Wohnzimmer/SENSOR"
device_class: "humidity"
unit_of_measurement: "%"
value_template: "{{ value_json.AM2301.Humidity | float}}"
- platform: mqtt
name: "Wohnzimmer Taupunkt"
state_topic: "tele/D1mini_Wohnzimmer/SENSOR"
device_class: "temperature"
unit_of_measurement: "°C"
value_template: "{{ value_json.AM2301.DewPoint | float}}"
- platform: mqtt
name: "Wohnzimmer Akku Ladung"
state_topic: "tele/D1mini_Wohnzimmer/SENSOR"
device_class: "voltage"
unit_of_measurement: "V"
value_template: "{{ ( value_json.ANALOG.A0|float * 4.5 / 1023 ) | round(2) }}"
- platform: mqtt
name: "Wohnzimmer last seen"
state_topic: "tele/D1mini_Wohnzimmer/SENSOR"
value_template: >
{% set s = value_json.Time | timestamp_custom('%Y-%m-%dT%H:%M:%S%z') %}
{{ s[:-2] ~ ':' ~ s[-2:] }}
# value_template: "{{ as_timestamp( value_json.Time ) | timestamp_custom('%Y-%m-%dT%H:%M:%S') }}"
device_class: "timestamp"
two questions:
- I see errors in log, that timezone is missing in timestamp.
- I don’t understand, what format the timestamp is provided in and how to parse it into a real timestamp
any help is very much appreciated,
Chris
EDIT: the D1 mini is running on Tasmota 10.0.0
EDIT2: current dashboard card