RobertD502 / home-assistant-flair

Custom component for Home Assistant Core for Flair pucks, vents, rooms, structures, and minisplits
MIT License
90 stars 12 forks source link

Integration does not work without code and supporting library modification #29

Closed kr4ft125 closed 2 years ago

kr4ft125 commented 2 years ago

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.

RobertD502 commented 2 years ago

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.

RobertD502 commented 2 years ago

@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.

kr4ft125 commented 2 years ago

I saw it. Sorry, hectic weekend. It is, in fact, this very same email address: @.***

Nate

On Mon, Jun 27, 2022 at 12:30 PM RobertD502 @.***> wrote:

@kr4ft125 https://github.com/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.

— Reply to this email directly, view it on GitHub https://github.com/RobertD502/home-assistant-flair/issues/29#issuecomment-1167578076, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATL3EEKTHHAKX33WUESO5I3VRHJJ5ANCNFSM5ZYP64PA . You are receiving this because you were mentioned.Message ID: @.***>

RobertD502 commented 2 years ago

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.

stale[bot] commented 2 years ago

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.

stale[bot] commented 2 years ago

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.

RobertD502 commented 1 year ago

@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).