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

Support fade speed in lights (wLightBoxS, dimmerBox) #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

gralin
Copy link
Contributor

@gralin gralin commented May 5, 2020

Hi! I have been testing your upcoming blebox component in HA at my house, and I was trying to find out if it would be possible to add dimming effect to light state changes. I have found out that in two of my modules (wLightBoxS, dimmerBox) apart from brightness we can also send a fadeSpeed argument which controls how fast should the change be made. I have made the changes in this library and in the HA component. I have tested it with mentioned modules and it all seems to work.

I had one issue, which is time conversion for this parameter. It is expected to send a value from 0 to 255. Using the mobile app I found out that the value correlates to time range from 0s to 1h, however the relation to time is not linear. I asked the manufacturer but didn't receive any answer (there was a question about this aready on the forum, also without answer). I solved it by downloading they mobile application APK file and anlyzed the source code. I found out that they store a fixed list of time values and that's how they do the conversion. So unless we learn what is the forumal to calculate it, doing it the same way is the only option, and that's what I have implemented.

Sorry in advnce for any mistakes that I made. I just started learning Python (my backgound is C#) so I will be very happy to learn how to write things better.

This PR closes #31

@gralin gralin changed the title Support fade_speed in lights (wLightBoxS, dimmerBox) Support fade speed in lights (wLightBoxS, dimmerBox) May 5, 2020
@gadgetmobile
Copy link
Contributor

I have made the changes in this library and in the HA component.

Can you link to those changes? I'd like to support it in HA as well, so anything useful in practice would save me a lot of time.

I'm currently trying to get full BleBox support merged in HA officially anyway, so I'm interested in changes that are useful to you.

I had one issue, which is time conversion for this parameter.

I'll help figure that out. If not, the table is very useful and I have nothing against it!

Sorry in advance for any mistakes that I made.

It's fine. I'm currently focused on high quality overall BleBox support in HA officially, so it might take some time before I get to this.

Still it's very helpful to have working, practical and useful code - so thanks for taking the time to make this PR!

@gadgetmobile
Copy link
Contributor

Based on your PR, I'll need to first improve the API so that additional parameters (like fadeSpeed) can be handled more cleanly.

That means I'll release a 2.0.0 version before getting back to this PR.

Let me know if you have any other suggestions, thanks!

@gralin
Copy link
Contributor Author

gralin commented May 9, 2020

Can you link to those changes? I'd like to support it in HA as well, so anything useful in practice would save me a lot of time.

I didn't open the PR yet becuase I needed this library to be updated first to be able to use it (locally I just had everythiing bundled together. Should I still open PR in your HA component repo? Or should I share those changes with you some other way?

I'm currently trying to get full BleBox support merged in HA officially anyway, so I'm interested in changes that are useful to you.

I'm following your PRs in HA repo and keeping fingers crossed 🤞 Once you add all the devices I hope we can add support for transition feature based on fadeSpeed described here.

I had one issue, which is time conversion for this parameter.

I'll help figure that out. If not, the table is very useful and I have nothing against it!

Cool. I have asked on BleBox official forum, where the same question was already asked before, but no answer. A bit disappointing becuase I paid extra for their products (compared to Sonoff or Shelly), supporting local industry and expecting better support compared to their cheap Chinese competitors ... Anyway this is the thread: http://forum.lic.pl/blebox/dimmerbox-sciemniacz-ac-230v-na-smartfony-i-tablety/45/

That means I'll release a 2.0.0 version before getting back to this PR.

Good idea. I was trying to make as little changes as possible but you can see that the changes are not state of the art. The fade_speed parameter could be actually set independently of light value and stored/retrieved as property, but that's something I didn't do becuase it would end up with too many changes which you might want to have done differently. So let me know when we can get back to this or if you need me to test the changes you make!

@gralin
Copy link
Contributor Author

gralin commented May 25, 2020

@gadgetmobile congrats on merging your integration into HA repo! 🎊

@gadgetmobile
Copy link
Contributor

Thanks!

I'll probably start celebrating after the next HA release.

Then, I'll deprecate my fork and I'll be able to get back to updating blebox_uniapi again...

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.

Support fade speed
2 participants