Closed turcotmii closed 3 months ago
I forgot to add the following screenshot in logs
found the root cause, upon init process, the first pass to setup energy meter with that line
total_power = self._hass.states.get(smart_meter)
retrun the following result
<state sensor.meter00_power=unavailable; state_class=measurement, unit_of_measurement=W, device_class=power, icon=mdi:lan-disconnect, friendly_name=Meter00 Power @ 2024-02-17T23:58:54.271655-05:00>
The code is executed twice in setup ; the first pass it brings an error, inthe second pass, the value is found and no error is raised.
Multiple issues raised about this, basically the code is broken. Someone tried to fix it in 324 but the code isn't working perfectly. There's no reset at midnight. If you can help, please do!
after 2 weeks of back and forth and debug, I'm more than convinced that the mistake is coming from rows 560 in _init.py the sensor sensor.smartenergymeter_power doesnt exist nor referenced somewhere in the code.
the error is raised from that line at script initialisation only once. As said earlier, the total_power.state value is unavailable at the time. I suspect this is coming from the orders things are being done as per mentionne ine comment https://github.com/dvd-dev/hilo/issues/381#issuecomment-1951439830
sensor.smartenergymeter_power
Perhaps this is from an older hardware not part of Hilo anymore. What happens if you remove that line?
The line isnt coming from previous hardware, it's from the source code. My Hilo installation is 2 months old.
When removing that line, I get the following message every minutes.
I just refresh the integration from HACS and it contains the same line.
so far, the best solution I could do it overide the code with that - it gives the error only once at startup
I wild guess here but smart meter might be the Hydro-Quebec meter used to create the sensor.meter00_power.
that was a good idea ; I've looked at hydroqc but couldnt find any reference but it lead me an idea for the fix.
This is what I have implemented in my local ; feel free to look an implement if it make sense to the code repo. I dont have any error at startup.
I tried your code in __init__.py
and unless I'm not following I'm still getting the error at startup.
ERROR (MainThread) [homeassistant.components.sensor] Error while setting up hilo platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 344, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/hilo/sensor.py", line 184, in async_setup_entry
await utility_manager.update(async_add_entities)
File "/config/custom_components/hilo/managers.py", line 72, in update
await utility_setup(self.hass, config)
File "/usr/src/homeassistant/homeassistant/components/utility_meter/__init__.py", line 143, in async_setup
if not conf[CONF_TARIFFS]:
~~~~^^^^^^^^^^^^^^
KeyError: 'tariffs'
Then the logs get spammed with
WARNING (MainThread) [custom_components.hilo] check_tarif: Unable to find state for sensor.hilo_energy_total_low
Perhaps your screenshot doesn't contain everything you updated in __init__.py
. Could you share all the files you've modified so that I'm certain I'm not having typos.
Also are you on the latest version?
The error you are referring to (unable to find sensor.hilo_energy_total_low) is related to another issue that happens once in a while during restart ; the sensor referred above doesn’t exists anymore in your instance.
Apologies I haven't been watching the repo much lately.
@turcotmii I hadn't noticed the issue but total_low and total_medium will not populate with "generate only total meters" checkbox. That's actually normal behaviour though it shouldn't cause errors in the logs.
Le français me va parfaitement bien aussi, au choix ;)
Apologies I haven't been watching the repo much lately.
@turcotmii I hadn't noticed the issue but total_low and total_medium will not populate with "generate only total meters" checkbox. That's actually normal behaviour though it shouldn't cause errors in the logs.
Le français me va parfaitement bien aussi, au choix ;)
Generate only total meters for each devices
n'est pas coché dans mon setup. J'ai testé pour le fun et coché ou non ça donne la même erreur. Je suis sur la dernière version du component Hilo. Le fix dans ce thread ne règle pas ce problème. L'extension est vraiment brisé et ce depuis plusieurs mois. Il y aurait besoin d'un programmeur expérimenté qui prenne le temps de régler les bogues. Je pense qu'à la gang on est incapable.
Unable to setup utility meter low and medium; the medium and low meters arent incrementing![image](https://github.com/dvd-dev/hilo/assets/133166752/e6be68a6-808e-4077-bb1a-067aa46c72e4)
Version of the custom_component
Core: 2024.2.1 Supervisor: 2024.01.1 Operating System: 11.5 Frontend: 20240207.1 custom component : 2024.2.2![image](https://github.com/dvd-dev/hilo/assets/133166752/efec405c-dc19-4293-9058-c07b5a3db5ff)
Configuration
Describe the bug
The meter hilo_energy_total is working fine, but the hilo_energy_total_low and hilo_energy_total_medium aren't working and stay to 0![image](https://github.com/dvd-dev/hilo/assets/133166752/ad6cf512-57e0-4d02-baf0-9c7bbbd924b6)
Debug log
home-assistant_2024-02-14T14-46-22.854Z.log