snarky-snark / home-assistant-variables

A custom Home Assistant component for declaring and setting generic variable entities dynamically.
Apache License 2.0
278 stars 16 forks source link

Using self.async_update_ha_state() #99

Closed ercsey closed 11 months ago

ercsey commented 1 year ago

Hello.

After updating Home Assistant to version 2023.5.0 this message appeared in the error log:

Entity var.room_1_saved_target (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

Could you please take a look to it? Thank you.

snarky-snark commented 1 year ago

Does this still appear for you on 2023.5.3? It looks like the warning was potentially erroneous up until then.

https://github.com/home-assistant/core/pull/91387

ercsey commented 1 year ago

Does this still appear for you on 2023.5.3? It looks like the warning was potentially erroneous up until then.

home-assistant/core#91387

Yes it's still present in the logs even after updating to HA version 2023.5.3

rmkew377 commented 1 year ago

Hi, same here:

Protokolldetails (WARNUNG) Logger: homeassistant.helpers.entity Source: helpers/entity.py:560 First occurred: 31. Mai 2023 um 23:00:00 (3 occurrences) Last logged: 31. Mai 2023 um 23:59:45

Entity var.tsoll_studio_new (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

Entity var.gas_per_day (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

Entity var.burner_daily_runtime (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

HA:

Home Assistant 2023.5.4 Supervisor 2023.04.1 Operating System 10.2

var Component:

{ "domain": "var", "name": "Variable", "version": "0.15.0",

waldmeisterx commented 1 year ago

Hi, it's still there also in HA 2023.6.3

Logger: homeassistant.helpers.entity Source: helpers/entity.py:565

Entity var.nina_birthday_days2go (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

home-assistant-variables v0.15.0

pdwonline commented 1 year ago

Hi,

Got this too and stiil there in HA 2023.8.1

mcpfr commented 1 year ago

Hello,

I have the same warning, I am in HA 2023.8.4

2023-08-30 11:19:04.490 WARNING (MainThread) [homeassistant.helpers.entity] Entity var.stock_mode_absent (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.

alex-v-fraser commented 1 year ago

System Information

version core-2023.9.1
installation_type Home Assistant Supervised
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.11.5
os_name Linux
os_version 6.1.19-v8+
arch aarch64
config_dir /config
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Debian GNU/Linux 11 (bullseye) -- | -- update_channel | stable supervisor_version | supervisor-2023.09.2 agent_version | 1.4.1 docker_version | 23.0.2 disk_total | 113.1 GB disk_used | 20.2 GB healthy | true supported | true supervisor_api | ok version_api | ok installed_addons | Mosquitto broker (6.3.1), Zigbee2MQTT (1.33.0-1), File editor (5.6.0), ESPHome (2023.8.3), Studio Code Server (5.10.2), Samba share (10.0.2), Asterisk (4.1.1), motionEye (0.18.0)
Dashboards dashboards | 1 -- | -- resources | 1 views | 3 mode | storage
Recorder oldest_recorder_run | September 9, 2023, 5:27 PM -- | -- current_recorder_run | September 14, 2023, 7:33 PM estimated_db_size | 781.35 MiB database_engine | sqlite database_version | 3.41.2
Logger: homeassistant.helpers.entity
Source: helpers/entity.py:689 
First occurred: 15 сентября 2023 г., 20:00:00 (5 occurrences) 
Last logged: 15 сентября 2023 г., 20:00:01

Entity var.sended_counter_cold (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.
Entity var.sended_counter_hot (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.
Entity var.sended_counter_cold_bath (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.
Entity var.sended_counter_hot_bath (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.
Entity var.sended_date (<class 'custom_components.var.Variable'>) is using self.async_update_ha_state(), without enabling force_update. Instead it should use self.async_write_ha_state(), please report it to the custom integration author.
danielbrunt57 commented 1 year ago

I created a new pull request https://github.com/snarky-snark/home-assistant-variables/pull/103 which is slightly different than pull request https://github.com/snarky-snark/home-assistant-variables/pull/100. I also am not a python programmer so I do not know the absolute correct way of fixing this but my PR has eliminated the error message and the var integration is working for me. All I had to change was line 448: await self.async_update_ha_state() --> await self.async_update_ha_state(True)

enricota66 commented 11 months ago

I created a new pull request #103 which is slightly different than pull request #100. I also am not a python programmer so I do not know the absolute correct way of fixing this but my PR has eliminated the error message and the var integration is working for me. All I had to change was line 448: await self.async_update_ha_state() --> await self.async_update_ha_state(True)

I have but only tested various changes this seems to delete the warning also in my case it works