Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue in switchboxd boxtype manifest causing errors when toggling switchboxd relays #152

Merged

Conversation

swistakm
Copy link
Contributor

This should resolve errors thrown when toggling relays as reported in #137

@shibby20
Copy link

Awesome PR. I will try it tomorrow and will back with feedback

@swistakm
Copy link
Contributor Author

Note: I have also found data race when preserving latest state (thanks @shibby20 for testing it out so I could find the problem). This is now solved and there's pretty long code comment explaining the underlying problem.

I have also updated boxtype manifests for all switchboxD devices with latest information from https://technical.blebox.eu/

@shibby20
Copy link

shibby20 commented Jan 18, 2024

@swistakm patch applied and looks good - no errors in log. Looks like NodeRed is working - i`m remote right now so ill check all when i back from work to home. But one is strange - i dont see PowerConsumption entities... meaning they appeared but are not available

obraz

obraz

@swistakm
Copy link
Contributor Author

Uhh, turns out I made another mistake by swapping different API version variants in box_type manifest and also forgot to reload homeassistant when I was testing how it integrates. That's why I missed it. I feel so stupid by now 🤦

I've made a fix pushed it to this PR. I went a couple of times through it, and also double checked with specifications on https://technical.blebox.eu to make sure manifest is now aligned. Third time's the charm!

Last but not least, there was yet another thing that got me confused. The example payload for state/extended in switchBoxD v20200229 and v20190808 documentation do not include powerMeasuring entry while it does include it on the component level of OpenAPI specification. I guess it is just a documentation mistake, so I made the fix with assumption that all API levels support this feature. Nevertheless, this makes me a bit nervous and I cannot verify how it should be exactly it as I don't have these devices at hand.

If this PR works for you @shibby20 (I hope so) then we'll be most likely set. I've already messaged folks at BleBox regarding the release procedure for it.

But if you will experience any more problems, then there is some information that would be extremely helpful in further investigating this:

  • the value of device.apiLevel key under /info endpoint (or /api/device/state if it is older than 20200229) on your devices
  • the example payload under /state/extended endpoint ( or /api/relay/extended/state if it is older 20200229) of your devices

@shibby20
Copy link

shibby20 commented Jan 23, 2024

@swistakm we are almost home. Power measurement units for switchBoxD have appeared but for switchBox it doesn't. So based on your commits i changed api_path and exteded_path in switchBox->20220114 to
"switchBox": { 20220114: { "api_path": "/api/relay/extended/state", "extended_state_path": "/api/relay/extended/state",
and added sensors definition under spec 20220114. And now it works !!
obraz

Thank you so much for your help

@slimek21
Copy link

slimek21 commented Jan 24, 2024

Hi, I have the same problem. How to correct it in home assistant?

@swistakm swistakm force-pushed the fix/switchboxd-power-measurement-errors branch from 8ff612c to d982d96 Compare January 26, 2024 15:13
@swistakm swistakm merged commit 6a30044 into blebox:master Jan 26, 2024
2 checks passed
@swistakm
Copy link
Contributor Author

@slimek21 I just did a release of blebox_uniapi==2.2.1 including necessary fixes. If you are able to install packages manually in your environment you can obtain it via pip. Otherwise you will have to wait for official inclusion of this new version in homeassistant core project.

I'm going to submit a PR to homassistant in few minutes and will keep this thread updated.

@slimek21
Copy link

@shibby20 can you tell me how to update blebox integration in homeassistant??

@shibby20
Copy link

@swistakm great job. I upgraded HA to latest version and force uniapi 2.2.1 - all works as intended, finally :) Thank you.

@slimek21 you have to enter inside docker container with you HA instalation and edit file "/usr/src/homeassistant/homeassistant/components/blebox/manifest.json" - change blebox_uniapi from 2.2.0 to 2.2.1, save and restart you HA. Or just wait a little bit. I hope HA will accept new version of blebox_uniapi for next few days

home-assistant/core#108918

@lukaszgithub
Copy link

Works!
Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants