starkillerOG / motion-blinds

Python library for interfacing with Motion Blinds
MIT License
22 stars 9 forks source link

Make AC motor check more region agnostic #45

Closed GingerSnap-xx closed 3 months ago

GingerSnap-xx commented 5 months ago

Starting to get myself familiar with the codebase to try to resolve a bug I reported. I noticed this voltage check seems to be assuming an EU or UK mains voltage of 220. In the US it is 120 (or 110 depending on who you ask), and according to Wikipedia, some countries (Japan) go as low as 100!

Without some knowledge that regardless of what the true ac voltage is it gets reported as 220, I assumed this was something that might not be accurate in all cases and figured I'd submit a fix to open it up a bit.

starkillerOG commented 3 months ago

Thank you for the PR, did you actually have a AC blind reporting a voltage between 100 and 220 V?

GingerSnap-xx commented 3 months ago

Thank you for the PR, did you actually have a AC blind reporting a voltage between 100 and 220 V?

I did not have one myself, so it was mostly speculative. The only reason I would think you wouldn't get 120 would be is if there's a transformer at play upstream of the sensor. I can try to get a hold of a model that uses AC motors to test it. If you already know of a good low cost one I could use that'd be awesome otherwise I'll look around.

starkillerOG commented 3 months ago

I don't think testing will be nessesary. Besides it could very well be that the voltage is hardcoded to 230V and not actually measured. (Why would they measure the 230V, kind of pointless)