Integration does not work without code and supporting library modification
kr4ft125 opened this issue · 7 comments
In order to get this integration working correctly the first time (older version of Flair Integration) I had to modify the code for this, and another repo (flair-helper) to remove/comment references to puck light level. Seems that my pucks do not have a light level sensor and when attempting to instantiate the objects during a HASS restart, I get errored out with:
hass_flair_api.client.ApiError: ApiError<HTTP Response: 404>
Full trace:
2022-06-24 17:06:01 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry Flair for flair
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 339, in async_setup
result = await component.async_setup_entry(hass, self)
File "/config/custom_components/flair/init.py", line 33, in async_setup_entry
flair = await hass.async_add_executor_job(FlairHelper, client_id, client_secret)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.9/site-packages/flair/flair_helper.py", line 39, in init
self.discover_pucks()
File "/usr/local/lib/python3.9/site-packages/flair/flair_helper.py", line 118, in discover_pucks
pucks.append(Puck(puck, self))
File "/usr/local/lib/python3.9/site-packages/flair/pucks/puck.py", line 11, in init
self.refresh()
File "/usr/local/lib/python3.9/site-packages/flair/pucks/puck.py", line 15, in refresh
puck_light_level = self.api.puck_light_level(self.puck_id)
File "/usr/local/lib/python3.9/site-packages/flair/flair_helper.py", line 103, in puck_light_level
output = self.client.get('pucks', id + '/current-reading')
File "/usr/local/lib/python3.9/site-packages/hass_flair_api/client.py", line 226, in get
return self.handle_resp(
File "/usr/local/lib/python3.9/site-packages/hass_flair_api/client.py", line 339, in handle_resp
raise ApiError(resp)
hass_flair_api.client.ApiError: ApiError<HTTP Response: 404>
Again, commenting lines (not just the ones listed in the trace) regarding puck light level in flair_helper.py (lines 101-111), and puck.py (part of the flair-helper code; line 15 and lines 22-28) solved the ApiError and allowed the connection and polling of data from my system.
Could you shoot a message to flairhass at gmail dot com. I'll need to take a look at what info is being returned by your puck and from that any info that can be used to distinguish between pucks that have a light sensor and those that don't - I don't want to outright eliminate the light sensor as there are individuals that use it.
@kr4ft125 I don't know if you saw my email response with the findings, but I'll need the associated flair email account messaged to me so I can have Flair engineers fix the bug on your affected puck.
No big deal. Didn't know if it was a junk e-mail that you were using and didn't check. Given that it was the weekend and their team doesn't work on weekends, they wouldn't have gotten to it anyways.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@kr4ft125 I finally found the answer as to what was causing this.
The puck that's in question (as identified in the e-mail I sent you) doesn't have a current-reading endpoint due to it being marked as inactive (not plugged in/dead batteries).