snarky-snark/home-assistant-variables

Issue detected by HA

Closed this issue · 6 comments

Here is a log issued by Home Assistant (version 2023.7.1):

Logger: homeassistant.helpers.entity
Source: helpers/entity.py:701
First occurred: 10:40:10 (4 occurrences)
Last logged: 10:54:18

Entity var.living_room_temperature (<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.master_bedroom_temperature (<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.erwan_bedroom_temperature (<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.bitcoin_total_initial_value (<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.

Foguet commented

Hi! I have the same problem. How I can help to fix it?
Thanks in advance

ercsey commented

I made some changes for my own and created a pull request #100 but it was not yet merged. After the the changes I do not had any issues.

pull request #100 but it was not yet merged

Did you see the questions posted by @snarky-snark ? Could you please answer these to get this merged?

lloyda commented

@ercsey Be good if you could respond to @snarky-snark's questions. Would love to stop these errors filling my logfile.

ercsey commented

Hello. Sorry for late response. First of all I am not @ercsey, but his brother. He is in hospital. He sees the message but unable to respond. I am interpreting what he said: "I am not a programmer. I saw this solution on other github repo and made the changes for my self. After I've seen that the error messages are gone and the integration is working fine I made the changes and the pull request."
Sorry for this long waiting.

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)