babincc / flutter_workshop

This repo houses add-ons, plug-ins, and helpful code to make Flutter programming easier.
5 stars 1 forks source link

Mirek color temperature validation error [flutter_hue] #16

Closed drachim-dev closed 2 months ago

drachim-dev commented 3 months ago

Hi,

thanks for creating and maintaining this!

I'm migrating from hue_dart to your library and got a issue due to a specific light bulb. When calling hueNetwork.fetchAll() I get an assertion error here: assert(Validators.isValidMirek(min), "minmust be between 153 and 500 (inclusive)"), assert(Validators.isValidMirek(max), "maxmust be between 153 and 500 (inclusive)");

My bulb provides mirek_minimum of 0 and maximum of 65535 as you can see here:

Screenshot 2024-03-17 at 15 08 09

Note that the bulb is also stating mirek_valid -> false

Any idea how I can handle this? I just want to toggle the light on and off without controlling any color temperature.

babincc commented 3 months ago

This is interesting. Philips Hue's API documentation is where I got the min and max for mirek value. The bulb you are using, is it an official Philips Hue product?

drachim-dev commented 3 months ago

No, it's not. It's a Livarno GU10. Color temperature can be controlled via the official hue app though.

babincc commented 3 months ago

I have updated the package to 1.2.5

I just removed the assert statements so third-party products won't be blocked.

This should fix the issue you are currently facing. I don't have any third-party products to test; so, I imagine you might come across similar issues in the future. If you do, could you make a note of the issue, and just comment out the assert statements to get past them, and see if there are more afterward? My concern is that the third-party product might fail a handful of assertions, but we are only seeing one right now since the code is stopped at the first assertion. I just don't want to have to publish several package updates to fix essentially the same issue.

drachim-dev commented 3 months ago

Thank you so much! Unfortunately I left for a long vacation this morning and I'll only be able to test and verify when I'm back as mDNS does not work over VPN as I just found out. I'll report back after that.

drachim-dev commented 2 months ago

Just tested and it works. I can toggle the lights now :) Thank you so much!