Interesting thing happened to me overnight…
I have Xiaomi thermo/hygro sensor, connected via new BT proxy. This part works fine. Since temp value is sent with two decimals i created template sensor with only one decimal:
- platform: template
sensors:
stopnice_temperatura_bthome:
friendly_name: Stopnice temperatura
unique_id: stopnice_temperatura_bthome
value_template: "{{states('sensor.stopnice_7d43_temperature')| round(1)}}"
unit_of_measurement: "°C"
device_class: temperature
I also have SQL for MIN and MAX temp today:
SELECT ROUND(MIN(CAST(state as FLOAT)),1) as state FROM states WHERE entity_id = 'sensor.stopnice_temperatura_bthome' AND last_updated > CURRENT_DATE AND state not like 'unavailable' AND state not like 'unknown';
But, today in the morning when i woke up both SQL sensors was “unknown”, while current temp. was alive and 23.4 degrees.
After digging i found out that temperature from xiaomi didn’t change from yesterday - well, it changed, but within second decimal, so template sensor remained at 23.4 degrees.
It seems that template sensor doesn’t get recorded if remains unchanged. I proved that with this procedure:
- went to developer tools
- selected sensor “sensor.veranda_0b24_temperature”
- changed it manually to 23.1
- that moment both SQL’s show up and after above sensor “corrected” itself (received value 23.4 from xiaomi again) SQL’s now show MIN=23.1, MAX=23.4
Is this normal? I wouldn’ tbe too surprised, since efforts are being made to keep recorder size to a minimum…
If so, how can i “make” recorder to record value at least once a day?
Ok, one solution is to extract SQL from original value, not from template sensor… but still, it’s an interesting finding…