Closed harmptor closed 1 year ago
That's odd, it looks like the integration failed to initialize properly. What HA version do you have? Have you updated this component? Have you tried reloading the integration or restarting HA?
HA 2022.11.5 OS 9.4 Component version 4.0.0 I reloaded the Integration a few times and just restarted my operating system, no change. π€·ββοΈ
Then I probably used an API first available on version 2022.12.x You'll probably need to upgrade HA or downgrade this integration.
Ohh I must have missed that. Okay, will upgrade and report back!
I'll check if there is a config to tell HACS the minimum HA version
I upgraded to HA 2022.12.8, reloaded the integration and restarted HA, but unfortunately the error still persists.
2022-12-28 14:10:17.221 WARNING (MainThread) [custom_components.dbuezas_eq3btsmart.python_eq3bt.eq3bt.bleakconnection] [room] Broken connection [retry 1/14]:
2022-12-28 14:10:21.514 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/dbuezas_eq3btsmart/python_eq3bt/eq3bt/bleakconnection.py", line 161, in on_notification
self._callback(data)
File "/config/custom_components/dbuezas_eq3btsmart/python_eq3bt/eq3bt/eq3btsmart.py", line 154, in handle_notification
callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 673, in schedule_update_ha_state
self.hass.add_job(self.async_update_ha_state(force_refresh))
AttributeError: 'NoneType' object has no attribute 'add_job'
Can you look at the beginning of the log to see if there ia any other error preceding this? Also, just to be sure, please try reloading the integration without restarting HA. After that, try v3. Maybe that gives some clue for me to debug this
I don't see anything unusual to my setup, but maybe you can spot something: https://dpaste.org/uCVzy
Okay, trying v3.0.0 soon. Should I 'Delete' my instance of this integration (in the Settings, the one with the 'configure' button) before clicking 'Redownload' in HACS?
I think some other integration is delaying the setup of entities (from all of those "longer than 10 seconds" warnings) and I may not be explicitly waiting for the setup being fully finished. If that's true, it should go away if you reload the integration after it has veen running for a while (i think). I'll take a look, but I'm not quite sure what could be going on here.
On v4, after doing this, the error still occurs: (image to make sure we're talking about the same thing haha) Downgrading to v3 in a minute
So I re-downloaded v3.0.0 (but manifest says version "2.1.0", idk). At first I thought it was back to the usual errors because I saw four of them. Then I reloaded the integration and I thought got fewer errors from there on. But maybe that's just because the configuration options disappeared and the scan interval might be fixed at 5min. Log: https://dpaste.org/zE5Wb
Oh, you have to restart HA too. Otherwise the old version will still be running I think
And yes, I forgot updating the manifest that time :/
Sorry, yes I restarted HA after, just forgot to mention.
Ok, then it's not what i thought. I'll think some more
I still can't reproduce this does it still happen after updating HA and this component?
I suspect it's my bluetooth chip being funny, but the 3B+'s built-in BT chip is listed as one of the "high performance" ones by HomeAssistant iiuc. π€·ββοΈ I'm on HA 2022.12.9 and I went back to v4.0.0 coz v3.0.0 didn't help. I just noticed you released v4.0.1, gonna pull that and report back...
Wait, v4.0.1 requires HA 2023.1.1. Could you let me know how it looks like once you've updated both?
By the way, does the climate entity work for you regardless or does it stay as unavailable forever?
woop, okay. I'm always a bit hesitant because I've had things breaking after updating to a fresh new release. Is 2023.1 likely gonna change anything?
And can I somehow give you more information, verbose logs or something, if you can't reproduce the error? Because the error message alone seems rather meaningful, doesn't it? We should be able to trace down where it fails to return the correct object π€
Edit: Reloading the integration after a HA restart makes the climate entity available again, thank you for that trick!
Ok, that's a good indicator. I think something is delaying full initialisation of the entity then. What the error tells us is that the entity is missing the hass property, and that is set by home assistant itself. I don't know why that's not happening before the thermostat is queried, this should only happen after the "added to home assistant" callback is called (which should be after initialisation is done). I could just make it wait for it just in case. I'll make a beta release with that soon and ask you to test it :)
Oh okay, but don't get me wrong, reloading only fixes the climate entity state, the errors keep popping up regardless. Okay, eager to test. Thank you!
Oh, it's not a one time thing! I guess I could pass the hass variable myself, but that's really weird. Let's wait until you can test it in 2023.1. If anyone else is having the same issue, please write here :)
I upgraded to 2023.1, then downloaded v4.0.1 and restarted. After rebooting, this error occurs every 2 minutes(my scan interval):
2023-01-07 16:57:35.588 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File "/config/custom_components/dbuezas_eq3btsmart/python_eq3bt/eq3bt/bleakconnection.py", line 161, in on_notification
self._callback(data)
File "/config/custom_components/dbuezas_eq3btsmart/python_eq3bt/eq3bt/eq3btsmart.py", line 154, in handle_notification
callback()
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 687, in schedule_update_ha_state
self.hass.add_job(self.async_update_ha_state(force_refresh))
AttributeError: 'NoneType' object has no attribute 'add_job'
The moment I reload the integration, the same error is logged. After reloading, it still logs the same error every 2 minutes.
Did you add the device from autodiscovery or manually via add integration
?
Uhh, I don't quite remember. I'm leaning towards autodiscovery. Should I remove and set it up again?
Yes, please do :) If you want to extract the mac first, you can click the "configure" button in the integration and enable the debug entities. Then open the device and look for the MAC entity.
Removing and adding it manually seems to have done the trick! No more error messages (assuming it'll survive a HA restart) Awesome, thank you!! For some reason I have way fewer entities now (19 vs 27 iirc) and I like that. I almost feel like only very few should be enabled by default anyway.
No way! The configuration was broken then! π And yes, the other entities are for debugging, I may remove them completely at some point but for now they can be enabled/disabled from the options flow (the configure button).
Unfortunately I have to report it does not survive a restart. I can work around it by removing the integration and re-adding it, but that's rather tedious. π
How frustrating... The only thing I can do is put a try catch there and hope for the best.
The integration only queries the thermostat after HA finishes setting up the entity. Your error happens when it answers back, because the entity isn't setup. See the contradiction? I have no idea what is going on in your instance, but if i catch the exception it may succeed in the next scan. Are you sure there are no exceptions prior to that one?
Ah okay I understand. Is it possible that HA somehow messes up setting the entity up correctly, not giving it the add_job attribute because, idk, it's mistaking it for another entity type or something?
Because it works fine when I set the device up (well I have to reload once), but then only after I restart HA it does all this...
But yeah we can try catching the exception and pray ππ
Ok, I also call that from some of the number entities when they are changed: https://github.com/dbuezas/eq3btsmart/search?q=async_update&type= Do you have any automation changing them by any chance? Or a scheduler component that may touch them? Another thing i could do is to only register the changes callbacks AFTER everything is set up. That way if anything triggers a scan, the non initialized entities won't get notified.
Sorry, forgot to answer: Yes, there is no error before that. Here's the log after startup https://dpaste.org/cTvxz
No automations, but I do have the scheduler component which has one routine targeting the trv, but that isn't enabled (coz I leave the trv at 20Β° nowadays). I'm deleting the routine real quick. Does it also help if I temporarily disable the Scheduler integration?
Regarding the last thing: I'm not sure I fully understand, (newbie coder, first semester) but that sounds like a good idea? In a regular situation the initialization shouldn't take long at all, so we shouldn't really lose anything right?
Oh, well, then you have an awesome and challenging adventure in ahead of you :)
Yes, you are right, that wouldn't make it lose information. The climate component will start a scan itself anyway.
What do you have setup in the scheduler? It may the key to find out what's going wrong.
Thank you! :)
What exactly do you mean by that? My scheduler card yaml? Or the stuff inside .storage?
I mean which entity does the scheduler touch. If it's off it shouldn't matter, but just in case.
(Minor correction: I used the word "scan" meaning querying the device for it's state, not a Bluetooth scan to find available devices)
It touched my climate entity climate.trv
(previously climate.room
, in case you saw that in the logs somewhere)
And inside my scheduler card I have this custom action (I think because the default action does .1 steps and I wanted .5 steps):
type: custom:scheduler-card
customize:
climate.trv:
exclude_actions:
- heat
- set preset
- set mode
- turn off
actions:
- service: climate.set_temperature
icon: mdi:thermometer
variables:
temperature:
min: 4.5
max: 29
step: 0.5
unit: Β°C
If you think it makes sense, I could try disabling the scheduler integration and restarting HA.
(thank you for being pedantic with your choice of words haha)
Please try this release: https://github.com/dbuezas/eq3btsmart/releases/tag/crixionz-test
(in hacks, tick "use beta versions" and pick crixionz-test
)
Hahaha, I also wrote "it's" in place of "its", but that's English so whatever π
The change in the card shouldn't be the source of the issue.
Please let me know if disabling the scheduler made a difference before trying the test version
Haha, well I think there's a line to draw between useful pedanticism (because the semantics change) and pedanticism just for the sake of it (or to annoy others lol). Yea, english amirite? π
Okay, so I disabled the scheduler integration and restarted HA, the error still occurs. Logfile looks the same to me: https://dpaste.org/NJRvn Except now there is
2023-01-20 14:39:26.545 WARNING (MainThread) [homeassistant.components.number] Setup of number platform dbuezas_eq3btsmart is taking over 10 seconds.
2023-01-20 14:39:26.549 WARNING (MainThread) [homeassistant.components.climate] Setup of climate platform dbuezas_eq3btsmart is taking over 10 seconds.
but I think that was random / my raspberry being slow π
I then deleted the eq3 integration to remove my climate entity, then downloaded the test release. I restarted HA and then added my TRV manually. It seemed to work fine (perhaps only after reloading the integration once).
I then restarted HA again (the crucial test if it survives a restart)
and now the attributes all had their entity set to sensor.none_*etc*
. So I did the whole thing again, this time they were named correctly, but I can't get the climate entity working. The attributes work fine, but the climate entity stays unavailable even after reloading the integration multiple times. π
The logfile has the same error as usual.
Wow, that's so weird! I'm starting to become suspicious about the bluetooth integration. This one depends on it, so maybe HA never finishes initialising the climate entity because it waits for Bluetooth to be done. Do you use BT with some other integration? can you confirm it works fine?
Yeah, I use Ernst79's https://github.com/custom-components/ble_monitor to get readings from my bluetooth scale. It works fine as far as I can tell π€·
It looks like async_added_to_hass
is never called in the climate entity. How did you add the thermostat? (Mac address or auto discovered)
Manually via its MAC address.
Does any of the other entities in the component work? You could try fetching the schedule or enabling/disabling boost mode to test that. Also, can you try disabling the custom component you mentioned, restarting and trying again? As far as I know you are the only one with this issue (if somebody is reading along, please comment!)
Closed as stale. Feel free to comment further and/reopen it if the issue persists
My thermostat was working fine at first, but now it's mostly
unavailable
. I have this error that pops up constantly. Its about 700 error messages a day. Most of the times its just line 3 and downwards (so just the exception thing) but sometimes line 1 or even line 2 come before that.But see for yourself. Extended log here: https://dpaste.org/xSQRt
I don't know what else to specify here, other than maybe my setup: Raspberry Pi 3B+ with builtin bluetooth. Only one TRV which is on version 146 according to the sensor in HA. Distance between the rpi and the TRV is about 1.5m. Let me know what else you need. :)