├── LICENSE ├── README.md └── WLED_WiFi ├── WLED_WiFi.ini ├── WLED_WiFi.py └── icon.png /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Lord FEAR 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Prismatik WLED-WiFi plugin 2 | Ambilight via WiFi. Prismatik plugin to support WLED 3 | 4 | ## Dependencies 5 | * [WLED](https://github.com/Aircoookie/WLED/releases/tag/v0.8.6 "WLED") for ESP8266/ESP32 (checked for 0.8.6) 6 | * [Python 3.7](https://www.python.org/downloads/ "Python 3.7") 7 | * [Prismatik](https://github.com/psieg/Lightpack/releases "Prismatik") (tested on 5.11.2.19) 8 | * [py-lightpack](https://github.com/tremby/py-lightpack "py-lightpack") 9 | For py-lightpack you need to install the future and boltons 10 | `pip install future` 11 | `pip install boltons` 12 | 13 | 14 | ## Installation 15 | 16 | Install Python 3.7 17 | In Prismatik: 18 | - Enable the API 19 | - Enable Expert mode under Profiles 20 | - Check Enable server under Experimental 21 | 22 | Download the ZIP from the repository. 23 | Place the unzipped folder in the Prismatik plugins directory (e.g. C:\Users\LordF\Prismatik\Plugins\WLED-WiFi) 24 | Adjust settings in the WLED-WiFi.ini file 25 | Refresh the plugin list in Prismatik 26 | 27 | ## Configuration Settings are configured in the WLED-WiFi.ini file. 28 | 29 | - Main 30 | - Execute - path to python.exe or python exe from system path 31 | - WLED 32 | - UDP_IP_ADDRESS - Exact ip or x.x.x.255 for broadband (convenient with dynamic ip on the device) 33 | - UDP_PORT_NO - Port on the WLED device (default 21324) Settings -> Sync Interfaces -> UDP Port 34 | - FPS - Frames per second 35 | 36 | ## The new version of hyperion adds support for WLED. 37 | https://github.com/hyperion-project/hyperion.ng/releases 38 | -------------------------------------------------------------------------------- /WLED_WiFi/WLED_WiFi.ini: -------------------------------------------------------------------------------- 1 | [Main] 2 | Name=WLED_WiFi 3 | Execute=python.exe WLED_WiFi.py 4 | Icon=icon.png 5 | Author=Lord FEAR 6 | Version=0.2 7 | Description=Adds DRGB protocol for WLED 8 | 9 | [WLED] 10 | UDP_IP_ADDRESS=192.168.1.255 11 | UDP_PORT_NO=21324 12 | FPS=66 -------------------------------------------------------------------------------- /WLED_WiFi/WLED_WiFi.py: -------------------------------------------------------------------------------- 1 | import lightpack, socket, configparser, os 2 | from time import sleep 3 | import sys 4 | 5 | class WLED_WiFi: 6 | def __init__(self): 7 | self.loadConfig() 8 | self.lp = lightpack.Lightpack() 9 | self.status = False 10 | try: 11 | self.lp.connect() 12 | except lightpack.CannotConnectError as e: 13 | print(repr(e)) 14 | sys.exit(1) 15 | 16 | def loadConfig(self): 17 | self.scriptDir = os.path.dirname(os.path.realpath(__file__)) 18 | self.config = configparser.ConfigParser() 19 | self.config.read(self.scriptDir + '/WLED_WiFi.ini') 20 | self.fps = self.config.getint('WLED', 'FPS') 21 | self.udpBroadcastIp = self.config.get('WLED', 'UDP_IP_ADDRESS') 22 | self.udpPort = self.config.getint('WLED', 'UDP_PORT_NO') 23 | 24 | def run(self): 25 | while(True): 26 | d = self.lp.getColoursFromAll() 27 | v = [2, 2] 28 | for i in d: 29 | v.append(d[i][0]) 30 | v.append(d[i][1]) 31 | v.append(d[i][2]) 32 | Message = bytes(v) 33 | clientSock = socket.socket (socket.AF_INET, socket.SOCK_DGRAM) 34 | clientSock.sendto (Message, (self.udpBroadcastIp, self.udpPort)) 35 | sleep(1/self.fps) 36 | 37 | warls = WLED_WiFi() 38 | warls.run() -------------------------------------------------------------------------------- /WLED_WiFi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lord-FEAR/Prismatik-WLED-WiFi/e11ad8e9b25f84814463798c81b7050730089cd1/WLED_WiFi/icon.png --------------------------------------------------------------------------------