Still got an error initializing Timestamp variables.
sermayoral opened this issue · comments
#102 still persists in v3.3.8.
The problem occurs when you fill out this window:
Getting the following error and the variable unavailable:
Logger: homeassistant.components.sensor
Source: helpers/entity_platform.py:507
Integration: Sensor (documentation, issues)
First occurred: 22:23:26 (1 occurrences)
Last logged: 22:23:26
Error adding entities for domain sensor with platform variable
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 507, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 752, in _async_add_entity
await entity.add_to_platform_finish()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1023, in add_to_platform_finish
self.async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 743, in async_write_ha_state
self._async_write_ha_state()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 843, in _async_write_ha_state
state, attr = self._async_generate_attributes()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 784, in _async_generate_attributes
state = self._stringify_state(available)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 749, in _stringify_state
if (state := self.state) is None:
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 554, in state
raise ValueError(
ValueError: Invalid datetime: sensor.date_mto_descalcificacion_cafetera provides state '2023-11-23 09:00:00', which is missing timezone information
If you leave "initial value" empty, it works.
Not sure if it's because you're in a different region so not sure if that may be the issue, but I cannot reproduce. First, are you sure you're running v3.3.8?
Can you please enable debug logging and post the logs when creating a new timestamp variable to see if they show anything that may help.
![2023-11-24_18-27-05 908](https://private-user-images.githubusercontent.com/6526076/285554100-b9ef6a84-e7fc-4cc6-b5bc-d8bb70537518.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiY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mYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.q7D4T2yX0bEYXZH9yMzAI4XDyrYxGWbeuFryO4U04kU)
You are completely right. I wasn't running v3.3.8. I thought i was. Very strange. Sorry :-(
An important fact. In my screenshots, the date format is dd/MM/yyyy instead of MM/dd/yyyy. It can be very confusing
Setting a value creating a new timestamp sensor doesn't crash anymore :-). Although the date you enter is in UTC, and then it is converted to your time zone:
My timezone is GMT+1:
It also happened in your screenshots, So I guess it's done on purpose.
Also, updating a timestamp sensor seems to have no effect
Last change and last update attributes change, but the state doesn't it:
Thanks
I just noticed that I think you are trying to update the value of an existing variable using the Configuration page. In general, that won't work. You need to call one of the Variable Services to update (variable.update_sensor
). When I update a timestamp Variable Sensor using variable.update_sensor
it updates for me.
![2023-11-30_17-16-38 211](https://private-user-images.githubusercontent.com/6526076/287086461-84f3a40c-f0b2-498b-b5ad-16dcd763877c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1ODE2NDIsIm5iZiI6MTcyMDU4MTM0MiwicGF0aCI6Ii82NTI2MDc2LzI4NzA4NjQ2MS04NGYzYTQwYy1mMGIyLTQ5OGItYjVhZC0xNmRjZDc2Mzg3N2MucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTBUMDMxNTQyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9MThlZGFhM2Q4NDA2MjA2MDJmOThkZjcyM2RlZGI1MDNhMmM5NWQ2MjMzYjc0MjE3YzZkNGQyYTE1Mjc1YTNjZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.cMonwbwm8bN0lUz6K_otVyu-nh2ih92XOSGAkUmYLBw)
![2023-11-30_17-16-50 976](https://private-user-images.githubusercontent.com/6526076/287086499-aaaccfcf-d6c3-419c-85b0-7166c1ba04e9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1ODE2NDIsIm5iZiI6MTcyMDU4MTM0MiwicGF0aCI6Ii82NTI2MDc2LzI4NzA4NjQ5OS1hYWFjY2ZjZi1kNmMzLTQxOWMtODViMC03MTY2YzFiYTA0ZTkucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTBUMDMxNTQyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YWJjM2M4NTg2NDExMTgyNjJlOTBjNGY4YzRkN2MyYzQ0YmUyZWQ3NTVmOGNmMGJmMWRiODU3NDc0NDk5ZWYwZCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.we1moTWylg-XZnAQlxPOMCj28b40CigGdrbhZzTkx3g)
![2023-11-30_17-17-08 722](https://private-user-images.githubusercontent.com/6526076/287086526-72d62205-c018-4d28-8364-badcd47611b6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjA1ODE2NDIsIm5iZiI6MTcyMDU4MTM0MiwicGF0aCI6Ii82NTI2MDc2LzI4NzA4NjUyNi03MmQ2MjIwNS1jMDE4LTRkMjgtODM2NC1iYWRjZDQ3NjExYjYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MTBUMDMxNTQyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9Y2FjOTQwN2YyZjc0ODljZjMzOWEyYzQ0OWYyODdhMWQzN2M5MDE5MTU3NTRmYjI5NzE4NGQxNjI5ZDlkMjM2MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.9_MAQZwd1_1hf_PsvN8l6KQZ7_rcVQ9N1kY-9enD2ao)
I'll still look to add a timezone selector when creating a new timestamp Variable Sensor but no eta on that.