Giter Site home page Giter Site logo

rgomezjnr / wizcon Goto Github PK

View Code? Open in Web Editor NEW
39.0 5.0 7.0 25 KB

Control Philips WiZ Connected smart light bulbs

Home Page: https://pypi.org/project/wizcon/

License: MIT License

Python 100.00%
philips wiz wifi wireless cli tool home-automation smart-lights bulb lightbulb

wizcon's Introduction

wizcon

Control Philips WiZ Connected smart light bulbs

Requirements

Installation

pip install wizcon

Usage

usage: wizcon [-h] [-si {1-32}] [-b {0-255}] [-rgb {0-255} {0-255} {0-255}] [-v] IP {ON,OFF,SWITCH}

Control Philips WiZ Connected smart light bulbs

positional arguments:
  IP                    IP address of smart bulb
  {ON,OFF,SWITCH}       Command sent to the smart bulb

optional arguments:
  -h, --help            show this help message and exit
  -si {1-32}, --scene_id {1-32}
                        Set scene of smart bulb using scene ID
  -b {0-255}, --brightness {0-255}
                        Set brightness of smart bulb
  -rgb {0-255} {0-255} {0-255}, --rgb {0-255} {0-255} {0-255}
                        Set RGB color of smart bulb
  -v, --version         show program's version number and exit

Scene Table
1: "Ocean"
2: "Romance"
3: "Sunset"
4: "Party"
5: "Fireplace"
6: "Cozy"
7: "Forest"
8: "Pastel Colors"
9: "Wake up"
10: "Bedtime"
11: "Warm White"
12: "Daylight"
13: "Cool white"
14: "Night light"
15: "Focus"
16: "Relax"
17: "True colors"
18: "TV time"
19: "Plantgrowth"
20: "Spring"
21: "Summer"
22: "Fall"
23: "Deepdive"
24: "Jungle"
25: "Mojito"
26: "Club"
27: "Christmas"
28: "Halloween"
29: "Candlelight"
30: "Golden white"
31: "Pulse"
32: "Steampunk"

Examples

Turn smart bulb on:
wizcon 192.168.1.100 ON

Turn smart bulb off:
wizcon 192.168.1.100 OFF

Switch smart bulb between on and off states:
wizcon 192.168.1.100 SWITCH

Set scene to "Deepdive" using scene ID:
wizcon --scene_id 23 192.168.1.100 ON

Set brightness to 255 (max brightness):
wizcon --brightness 255 192.168.1.100 ON

Set smart bulb color to blue:
wizcon -rgb 0 0 255 192.168.1.100 ON

Tested bulbs

Model Model ID Firmware
1 A19 (RGB) 1.22.0 23007
2 A21 (RGB) 1.24.0 B23078
3 AE27 (White) 1.17.1 23032

Related

Smart-Bulb-Control - Rainmeter skin for controlling smart light bulbs

Support

If you find an issue or have any feedback please submit an issue on GitHub.

If you would like to show your support donations are greatly appeciated via:

  • GitHub Sponsors
  • PayPal
  • Bitcoin: bc1qh46qmztl77d9dl8f6ezswvqdqxcaurrqegca2p
  • Ethereum: 0xAB443e578c9eA629088e26A9009e44Ed40f68678

Authors

Robert Gomez, Jr.

Ariq Fadlan

Source code

https://github.com/rgomezjnr/wizcon

License

MIT

wizcon's People

Contributors

ariqfadlan avatar rgomezjnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wizcon's Issues

Works fine but getting an error

Hi, this works absolutely fine, but I get an error while executing it via cmd

Exception ignored in: <function wizlight.__del__ at 0x0000025A84156440>
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\pywizlight\bulb.py", line 781, in __del__
    self.loop.call_soon_threadsafe(self._async_close)
  File "C:\Python310\lib\asyncio\base_events.py", line 795, in call_soon_threadsafe
    self._check_closed()
  File "C:\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000025A84038A60>
Traceback (most recent call last):
  File "C:\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Python310\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Python310\lib\asyncio\base_events.py", line 750, in call_soon
    self._check_closed()
  File "C:\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Thought I'd post it here just in case.

Thanks

Choose a custom color

Just a question about custom colors...

I see choosing them does not appear to be implemented but, is it implemented in pywizlight either? Experimenting with the color gradient chooser in the WiZ app, the colors don't appear to be "really", in that the app has predefined "color names" for pretty much every position on the gradient (i.e.: Dark Red, Navy Blue, Harlequin, etc.)... so, when one adds a "custom color", is that just giving it a predefined scene_id maybe? ...or maybe those are just color nick-names Philips hard-coded in their iOS app? Just wondering if those colors might be setable by the scene_id parameter after added (if the scene_id param could go above 32)... ?

Wizcon has stopped working for me recently.

This is the error I get :

wizcon <ip_address> off
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pywizlight\bulb.py", line 758, in send
    resp = await asyncio.wait_for(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\tasks.py", line 520, in wait_for
    return await fut
           ^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\proactor_events.py", line 559, in _loop_reading
    res = fut.result()
          ^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\windows_events.py", line 798, in _poll
    value = callback(transferred, key, ov)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\windows_events.py", line 461, in finish_socket_func
    return ov.getresult()
           ^^^^^^^^^^^^^^
OSError: [WinError 1234] No service is operating at the destination network endpoint on the remote system

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\Scripts\wizcon.exe\__main__.py", line 7, in <module>
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\wizcon\wizcon.py", line 127, in main_async
    return asyncio.run(main())
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 684, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\wizcon\wizcon.py", line 123, in main
    await wizcon.run(args)
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\wizcon\wizcon.py", line 44, in run
    await self.turn_bulb_off()
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\wizcon\wizcon.py", line 28, in turn_bulb_off
    await self.light.turn_off()
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pywizlight\bulb.py", line 630, in turn_off
    await self.send({"method": "setPilot", "params": {"state": False}})
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pywizlight\bulb.py", line 762, in send
    raise WizLightConnectionError(str(ex)) from ex
pywizlight.exceptions.WizLightConnectionError: [WinError 1234] No service is operating at the destination network endpoint on the remote system
Exception ignored in: <function wizlight.__del__ at 0x00000225B9C51120>
Traceback (most recent call last):
  File "C:\Users\Admin\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\pywizlight\bulb.py", line 800, in __del__
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 837, in call_soon_threadsafe
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.496.0_x64__qbz5n2kfra8p0\Lib\asyncio\base_events.py", line 539, in _check_closed
RuntimeError: Event loop is closed

Is it still working for you?

Brightness command not working with Philips Astra smart batten.

Hi,

The Brightness command is not working with Philips Astra smart batten.
Maybe it is because it does not have rgb but only white and yellow modes?

The scenes that are present on the mobile app seem to be working fine.

Firmware version: 1.26.0
Model ID: 23096

Thanks

Enable Disable WiZ Motion Sensor

I was wondering if it might be possible to Enable and Disable a WiZ Motion Sensor via wizcon? I see that it mostly uses pywizlight but have not found that setting there.

wizcon connection issue

I'm wondering if a recent Python or other library update has caused this? The following basic wizcon command was working fine just a day or two ago. FYI: my bulb is ping'able...

pi@jpimain:~ $ wizcon 192.168.50.122 OFF
Task exception was never retrieved
future: <Task finished coro=<DatagramClient.send() done, defined at /usr/local/lib/python3.7/dist-packages/asyncio_dgram/aio.py:148> exception=ConnectionRefusedError(111, 'Connection refused')>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/asyncio_dgram/aio.py", line 152, in send
await super()._send(data)
File "/usr/local/lib/python3.7/dist-packages/asyncio_dgram/aio.py", line 106, in _send
_ = self.exception
File "/usr/local/lib/python3.7/dist-packages/asyncio_dgram/aio.py", line 59, in exception
raise exc
File "/usr/lib/python3.7/asyncio/selector_events.py", line 954, in _read_ready
data, addr = self._sock.recvfrom(self.max_size)
ConnectionRefusedError: [Errno 111] Connection refused

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.