rgomezjnr / wizcon

Control Philips WiZ Connected smart light bulbs
https://pypi.org/project/wizcon/
MIT License
39 stars 7 forks source link

[Feature request] 'get' command to for power state(on/off), brightness, color temperature etc. #8

Closed rp1231 closed 2 years ago

rp1231 commented 2 years ago

Hi,

It would be nice to have a 'get' command to get the power state(on/off), brightness, color temperature etc.

Thanks

rgomezjnr commented 2 years ago

Hi does wizlight work for you?

$ wizlight state
IP address of the bulb: IP
Get the state from IP
{'mac': MAC, 'rssi': -56, 'src': '', 'state': True, 'sceneId': 23, 'speed': 100, 'dimming': 100}
rp1231 commented 2 years ago

Yes it works, But the problem is that it requires an extra step of inputting the ip address. The ip address can't be passed as an argument like it can be in wizcon.

I'm trying to use this for a rainmeter skin, so that it can show a deactivated state when the bulb is off.

rgomezjnr commented 2 years ago

It works for me in version 0.5.14. if I add the --ip option:

wizlight state --ip IP
Get the state from IP
{'mac': 'X', 'rssi': -63, 'src': '', 'state': False, 'sceneId': 11, 'temp': 2700, 'dimming': 100}
wizlight state --help
Usage: wizlight state [OPTIONS]

  Get the current state of a given bulb.

Options:
  --ip TEXT  IP address of the bulb.
  --help     Show this message and exit.
rp1231 commented 2 years ago

Aah I see, That works for me. Thanks.

rp1231 commented 1 year ago

Is it possible to get only the state (true or false) via a command? Thanks

rgomezjnr commented 1 year ago

Here's a roundabout quick and dirty way of doing it I think, assuming you're using bash shell:

wizlight state --ip 192.168.1.100 > bulb-state.json sed 's/'\''/\"/g' < bulb-state.json python -c 'import json; print(json.load(open("bulb-state.json"))["state"])'