python-lightify icon indicating copy to clipboard operation
python-lightify copied to clipboard

Add light.alpha() method

Open durera opened this issue 6 years ago • 2 comments

I can use the various accessor methods for all properties, except alpha. For alpha I need to to use raw_values tuple, would be nice to add aplha() to the Light class to avoid need to handle raw_values(), e.g. to avoid something like this:

			# Alpha is only available from raw_values()
			(onoff, lum, temp, red, green, blue, alpha) = light.raw_values()

			# if online is false then override on to be false, the light can't be on if it's not even powered on 
			state = {
				"online": light.reachable(),
				"lastSeen": light.last_seen(),
				"on": (light.reachable() and light.on()),
				"lum": light.lum(),
				"temp": light.temp(),
				"colour": {
					"red": light.red(),
					"green": light.green(),
					"blue": light.blue()
				},
				"alpha": alpha
			}

durera avatar Apr 02 '19 16:04 durera

No problem, I will add the alpha method.

Well, the main question is: how do you use that value? :) From my experience, it never changes (that's why it's not exposed). Could you please explain your case?

Thanks!

OleksandrBerchenko avatar Apr 02 '19 18:04 OleksandrBerchenko

@durera So, is that property actual for all device types or just for some particular ones? Do I need to preserve int or to convert it to bool?

Thanks!

OleksandrBerchenko avatar Apr 08 '19 13:04 OleksandrBerchenko