vutang50 / homeassistant-pixelblaze Goto Github PK
View Code? Open in Web Editor NEWThis is a custom component to allow control of Pixelblaze devices in Home Assistant.
License: MIT License
This is a custom component to allow control of Pixelblaze devices in Home Assistant.
License: MIT License
"websocket-client>=1.0.0",
"pixelblaze-client==0.9.4"
Via UI
The attribute "effect" is not holding always the current effect. Most of the time, this attribute is empty.
{{ states.light.weihnachtsbaum }}
results in
<template TemplateState(<state light.weihnachtsbaum=on;
effect_list=['SEQUENCER', '1D Aurora Borealis', 'blink fade', 'color twinkles',
'Sparkling Tree', 'static random colors', 'Twinkly Stars'],
supported_color_modes=[<ColorMode.HS: 'hs'>],
color_mode=unknown,
brightness=128.000055,
effect=,
assumed_state=True,
icon=mdi:pine-tree,
friendly_name=Weihnachtsbaum,
supported_features=21 @ 2022-12-08T06:30:02.396731+01:00>)>
The Pixelblaze integration is using a deprecated feature that will apparently stop working in late 2024.
I'm using the integration, not the yaml.
Logs show that the integration is using a deprecated feature.
Logger: homeassistant.components.light
Source: components/light/__init__.py:1194
Integration: Light (documentation, issues)
First occurred: 3:38:06 PM (2 occurrences)
Last logged: 3:38:06 PM
Entity None (<class 'custom_components.pixelblaze.light.PixelblazeEntity'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <LightEntityFeature.EFFECT|1: 5> and color modes, please create a bug report at https://github.com/vutang50/homeassistant-pixelblaze/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation
I apologize up front for this not being a great bug report. If it's not immediately helpful, I can spend some time trying to reproduce it when I have a little more time free. Right now I would have to take down my HA installation and it runs the whole house.
What I know: earlier today I discovered my Home Assistant installation was not working. Specifically, connections to the web server would just hang, automations and scenes weren't responding, etc. The machine was still up, Supervisor was running, I could ssh to it and look at logs, etc. On a reboot, it would come back up briefly and then hang again within a minute or two. The log file had messages about various entity updates taking over 10 seconds, connections timing out, etc., so it wasn't obvious where the problem was. By process of elimination, I removed custom_components until I identified pixelblaze
as the one which triggers the problem.
During the incident, the only log entries related to this integration I could find look like:
2023-01-11 11:08:32.051 ERROR (MainThread) [custom_components.pixelblaze.light] Failed to update pixelblaze device Basement Counter [email protected]: Exception: [Errno 110] Operation timed out
It is probably extremely relevant that right now, that PixelBlaze device is in a strange state: it reports itself as alive to discovery, and it serves up its web page, but connections to port 81 for the websocket are immediately reset. This breaks the Pixelblaze client library:
>>> from pixelblaze import *
>>> pb = Pixelblaze("10.1.1.76")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/pixelblaze/pixelblaze.py", line 243, in __init__
self._open()
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/pixelblaze/pixelblaze.py", line 398, in _open
self.ws = websocket.create_connection(uri, sockopt=((socket.SOL_SOCKET, socket.SO_REUSEADDR, 1), (socket.IPPROTO_TCP, socket.TCP_NODELAY, 1),))
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_core.py", line 608, in create_connection
websock.connect(url, **options)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_core.py", line 253, in connect
self.handshake_response = handshake(self.sock, url, *addrs, **options)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_handshake.py", line 57, in handshake
status, resp = _get_resp_headers(sock)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_handshake.py", line 145, in _get_resp_headers
status, resp_headers, status_message = read_headers(sock)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_http.py", line 312, in read_headers
line = recv_line(sock)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_socket.py", line 131, in recv_line
c = recv(sock, 1)
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_socket.py", line 108, in recv
bytes_ = _recv()
File "/Users/chris/src/pixelblaze-client/.venv/lib/python3.10/site-packages/websocket/_socket.py", line 87, in _recv
return sock.recv(bufsize)
ConnectionResetError: [Errno 54] Connection reset by peer
What I don't understand is how this then results in this integration killing Home Assistant. But it does. Or at least, it did on my machine, today.
I have avoided power cycling my Pixelblaze for the moment, in case I need it to reproduce this. But I assume it should be possible to trigger the same condition by having anything answer on port 81 and then drop the connection. This is what I can try as a followup when I have time to do more.
Turning off a pixelblaze with this integration does work but turning it back on does not work as expected. The hass internal state changes to on
but the pixelblaze does not turn on.
ome-assistant | 2021-04-19 16:34:17 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140437571143568] Received {'type': 'call_service', 'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.pixelblaze_terasse'}, 'id': 122}
home-assistant | 2021-04-19 16:34:17 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.pixelblaze_terasse>
home-assistant | 2021-04-19 16:34:17 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140437571143568] Received {'type': 'call_service', 'domain': 'light', 'service': 'turn_on', 'service_data': {'entity_id': 'light.pixelblaze_terasse'}, 'id': 123}
home-assistant | 2021-04-19 16:34:17 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_on, service_data=entity_id=light.pixelblaze_terasse>
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.components.light] light.pixelblaze_terasse: set to unsupported color_mode: unknown, supported_color_modes: {'hs'}
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.pixelblaze_terasse, old_state=<state light.pixelblaze_terasse=off; effect_list=['SEQUENCER', '2D Wandering Fireball', '3D Rotation / Spotlights', 'blink fade', 'block reflections', 'Bouncer3D', 'color bands', 'color fade pulse', 'color twinkle bounce', 'color twinkles', 'cube fire 3D', 'Example: color hues', 'Example: modes and waveforms', 'Example: time and animation', 'Fancy Scolling Text 2D', 'fast pulse', 'fast pulse 3d', 'firework dust', 'firework rocket sparks', 'Fixed Color', 'Fixed Color HSV', 'glitch bands', 'green ripple reflections', 'honeycomb 3D', 'KITT', 'marching rainbow', 'matrix 2D honeycomb', 'matrix 2D pulse', 'millipede', 'opposites', 'Perlin/Simplex Noise 2D', 'plasma 3D', 'plasma 3D', 'Polar mapping helper 2D / 3D', 'rainbow fonts', 'rainbow fonts 2', 'rainbow melt', 'Red-Green XY 2D Sweep', 'RGBclock 2D', 'scrolling text marquee 2D', 'Shimmer Crossfade 2D', 'slow color shift', 'sound - blinkfade', 'sound - rays', 'sound - spectro kalidastrip', 'sound - spectromatrix optim', 'sparks', 'sparks center', 'spin cycle', 'tixy 2D', 'Wave 2D', 'xorcery 2D/3D'], supported_color_modes=['hs'], assumed_state=True, supported_features=21 @ 2021-04-19T22:34:17.492859+02:00>, new_state=<state light.pixelblaze_terasse=on; effect_list=['SEQUENCER', '2D Wandering Fireball', '3D Rotation / Spotlights', 'blink fade', 'block reflections', 'Bouncer3D', 'color bands', 'color fade pulse', 'color twinkle bounce', 'color twinkles', 'cube fire 3D', 'Example: color hues', 'Example: modes and waveforms', 'Example: time and animation', 'Fancy Scolling Text 2D', 'fast pulse', 'fast pulse 3d', 'firework dust', 'firework rocket sparks', 'Fixed Color', 'Fixed Color HSV', 'glitch bands', 'green ripple reflections', 'honeycomb 3D', 'KITT', 'marching rainbow', 'matrix 2D honeycomb', 'matrix 2D pulse', 'millipede', 'opposites', 'Perlin/Simplex Noise 2D', 'plasma 3D', 'plasma 3D', 'Polar mapping helper 2D / 3D', 'rainbow fonts', 'rainbow fonts 2', 'rainbow melt', 'Red-Green XY 2D Sweep', 'RGBclock 2D', 'scrolling text marquee 2D', 'Shimmer Crossfade 2D', 'slow color shift', 'sound - blinkfade', 'sound - rays', 'sound - spectro kalidastrip', 'sound - spectromatrix optim', 'sparks', 'sparks center', 'spin cycle', 'tixy 2D', 'Wave 2D', 'xorcery 2D/3D'], supported_color_modes=['hs'], color_mode=unknown, assumed_state=True, supported_features=21 @ 2021-04-19T22:34:18.085200+02:00>>
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140437571143568] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "light.pixelblaze_terasse", "old_state": {"entity_id": "light.pixelblaze_terasse", "state": "off", "attributes": {"effect_list": ["SEQUENCER", "2D Wandering Fireball", "3D Rotation / Spotlights", "blink fade", "block reflections", "Bouncer3D", "color bands", "color fade pulse", "color twinkle bounce", "color twinkles", "cube fire 3D", "Example: color hues", "Example: modes and waveforms", "Example: time and animation", "Fancy Scolling Text 2D", "fast pulse", "fast pulse 3d", "firework dust", "firework rocket sparks", "Fixed Color", "Fixed Color HSV", "glitch bands", "green ripple reflections", "honeycomb 3D", "KITT", "marching rainbow", "matrix 2D honeycomb", "matrix 2D pulse", "millipede", "opposites", "Perlin/Simplex Noise 2D", "plasma 3D", "plasma 3D", "Polar mapping helper 2D / 3D", "rainbow fonts", "rainbow fonts 2", "rainbow melt", "Red-Green XY 2D Sweep", "RGBclock 2D", "scrolling text marquee 2D", "Shimmer Crossfade 2D", "slow color shift", "sound - blinkfade", "sound - rays", "sound - spectro kalidastrip", "sound - spectromatrix optim", "sparks", "sparks center", "spin cycle", "tixy 2D", "Wave 2D", "xorcery 2D/3D"], "supported_color_modes": ["hs"], "assumed_state": true, "supported_features": 21}, "last_changed": "2021-04-19T20:34:17.492859+00:00", "last_updated": "2021-04-19T20:34:17.492859+00:00", "context": {"id": "dac2336d96efe0c9bdf8e4b4debb5e7c", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}, "new_state": {"entity_id": "light.pixelblaze_terasse", "state": "on", "attributes": {"effect_list": ["SEQUENCER", "2D Wandering Fireball", "3D Rotation / Spotlights", "blink fade", "block reflections", "Bouncer3D", "color bands", "color fade pulse", "color twinkle bounce", "color twinkles", "cube fire 3D", "Example: color hues", "Example: modes and waveforms", "Example: time and animation", "Fancy Scolling Text 2D", "fast pulse", "fast pulse 3d", "firework dust", "firework rocket sparks", "Fixed Color", "Fixed Color HSV", "glitch bands", "green ripple reflections", "honeycomb 3D", "KITT", "marching rainbow", "matrix 2D honeycomb", "matrix 2D pulse", "millipede", "opposites", "Perlin/Simplex Noise 2D", "plasma 3D", "plasma 3D", "Polar mapping helper 2D / 3D", "rainbow fonts", "rainbow fonts 2", "rainbow melt", "Red-Green XY 2D Sweep", "RGBclock 2D", "scrolling text marquee 2D", "Shimmer Crossfade 2D", "slow color shift", "sound - blinkfade", "sound - rays", "sound - spectro kalidastrip", "sound - spectromatrix optim", "sparks", "sparks center", "spin cycle", "tixy 2D", "Wave 2D", "xorcery 2D/3D"], "supported_color_modes": ["hs"], "color_mode": "unknown", "assumed_state": true, "supported_features": 21}, "last_changed": "2021-04-19T20:34:18.085200+00:00", "last_updated": "2021-04-19T20:34:18.085200+00:00", "context": {"id": "d7f5921444b97574e68b3369a898feb7", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}}, "origin": "LOCAL", "time_fired": "2021-04-19T20:34:18.085200+00:00", "context": {"id": "d7f5921444b97574e68b3369a898feb7", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}}
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140437571143568] Received {'type': 'call_service', 'domain': 'light', 'service': 'turn_off', 'service_data': {'entity_id': 'light.pixelblaze_terasse'}, 'id': 124}
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event call_service[L]: domain=light, service=turn_off, service_data=entity_id=light.pixelblaze_terasse>
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.components.light] light.pixelblaze_terasse: set to unsupported color_mode: unknown, supported_color_modes: {'hs'}
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.core] Bus:Handling <Event state_changed[L]: entity_id=light.pixelblaze_terasse, old_state=<state light.pixelblaze_terasse=on; effect_list=['SEQUENCER', '2D Wandering Fireball', '3D Rotation / Spotlights', 'blink fade', 'block reflections', 'Bouncer3D', 'color bands', 'color fade pulse', 'color twinkle bounce', 'color twinkles', 'cube fire 3D', 'Example: color hues', 'Example: modes and waveforms', 'Example: time and animation', 'Fancy Scolling Text 2D', 'fast pulse', 'fast pulse 3d', 'firework dust', 'firework rocket sparks', 'Fixed Color', 'Fixed Color HSV', 'glitch bands', 'green ripple reflections', 'honeycomb 3D', 'KITT', 'marching rainbow', 'matrix 2D honeycomb', 'matrix 2D pulse', 'millipede', 'opposites', 'Perlin/Simplex Noise 2D', 'plasma 3D', 'plasma 3D', 'Polar mapping helper 2D / 3D', 'rainbow fonts', 'rainbow fonts 2', 'rainbow melt', 'Red-Green XY 2D Sweep', 'RGBclock 2D', 'scrolling text marquee 2D', 'Shimmer Crossfade 2D', 'slow color shift', 'sound - blinkfade', 'sound - rays', 'sound - spectro kalidastrip', 'sound - spectromatrix optim', 'sparks', 'sparks center', 'spin cycle', 'tixy 2D', 'Wave 2D', 'xorcery 2D/3D'], supported_color_modes=['hs'], color_mode=unknown, assumed_state=True, supported_features=21 @ 2021-04-19T22:34:18.085200+02:00>, new_state=<state light.pixelblaze_terasse=off; effect_list=['SEQUENCER', '2D Wandering Fireball', '3D Rotation / Spotlights', 'blink fade', 'block reflections', 'Bouncer3D', 'color bands', 'color fade pulse', 'color twinkle bounce', 'color twinkles', 'cube fire 3D', 'Example: color hues', 'Example: modes and waveforms', 'Example: time and animation', 'Fancy Scolling Text 2D', 'fast pulse', 'fast pulse 3d', 'firework dust', 'firework rocket sparks', 'Fixed Color', 'Fixed Color HSV', 'glitch bands', 'green ripple reflections', 'honeycomb 3D', 'KITT', 'marching rainbow', 'matrix 2D honeycomb', 'matrix 2D pulse', 'millipede', 'opposites', 'Perlin/Simplex Noise 2D', 'plasma 3D', 'plasma 3D', 'Polar mapping helper 2D / 3D', 'rainbow fonts', 'rainbow fonts 2', 'rainbow melt', 'Red-Green XY 2D Sweep', 'RGBclock 2D', 'scrolling text marquee 2D', 'Shimmer Crossfade 2D', 'slow color shift', 'sound - blinkfade', 'sound - rays', 'sound - spectro kalidastrip', 'sound - spectromatrix optim', 'sparks', 'sparks center', 'spin cycle', 'tixy 2D', 'Wave 2D', 'xorcery 2D/3D'], supported_color_modes=['hs'], assumed_state=True, supported_features=21 @ 2021-04-19T22:34:18.569541+02:00>>
home-assistant | 2021-04-19 16:34:18 DEBUG (MainThread) [homeassistant.components.websocket_api.http.connection] [140437571143568] Sending {"id": 2, "type": "event", "event": {"event_type": "state_changed", "data": {"entity_id": "light.pixelblaze_terasse", "old_state": {"entity_id": "light.pixelblaze_terasse", "state": "on", "attributes": {"effect_list": ["SEQUENCER", "2D Wandering Fireball", "3D Rotation / Spotlights", "blink fade", "block reflections", "Bouncer3D", "color bands", "color fade pulse", "color twinkle bounce", "color twinkles", "cube fire 3D", "Example: color hues", "Example: modes and waveforms", "Example: time and animation", "Fancy Scolling Text 2D", "fast pulse", "fast pulse 3d", "firework dust", "firework rocket sparks", "Fixed Color", "Fixed Color HSV", "glitch bands", "green ripple reflections", "honeycomb 3D", "KITT", "marching rainbow", "matrix 2D honeycomb", "matrix 2D pulse", "millipede", "opposites", "Perlin/Simplex Noise 2D", "plasma 3D", "plasma 3D", "Polar mapping helper 2D / 3D", "rainbow fonts", "rainbow fonts 2", "rainbow melt", "Red-Green XY 2D Sweep", "RGBclock 2D", "scrolling text marquee 2D", "Shimmer Crossfade 2D", "slow color shift", "sound - blinkfade", "sound - rays", "sound - spectro kalidastrip", "sound - spectromatrix optim", "sparks", "sparks center", "spin cycle", "tixy 2D", "Wave 2D", "xorcery 2D/3D"], "supported_color_modes": ["hs"], "color_mode": "unknown", "assumed_state": true, "supported_features": 21}, "last_changed": "2021-04-19T20:34:18.085200+00:00", "last_updated": "2021-04-19T20:34:18.085200+00:00", "context": {"id": "d7f5921444b97574e68b3369a898feb7", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}, "new_state": {"entity_id": "light.pixelblaze_terasse", "state": "off", "attributes": {"effect_list": ["SEQUENCER", "2D Wandering Fireball", "3D Rotation / Spotlights", "blink fade", "block reflections", "Bouncer3D", "color bands", "color fade pulse", "color twinkle bounce", "color twinkles", "cube fire 3D", "Example: color hues", "Example: modes and waveforms", "Example: time and animation", "Fancy Scolling Text 2D", "fast pulse", "fast pulse 3d", "firework dust", "firework rocket sparks", "Fixed Color", "Fixed Color HSV", "glitch bands", "green ripple reflections", "honeycomb 3D", "KITT", "marching rainbow", "matrix 2D honeycomb", "matrix 2D pulse", "millipede", "opposites", "Perlin/Simplex Noise 2D", "plasma 3D", "plasma 3D", "Polar mapping helper 2D / 3D", "rainbow fonts", "rainbow fonts 2", "rainbow melt", "Red-Green XY 2D Sweep", "RGBclock 2D", "scrolling text marquee 2D", "Shimmer Crossfade 2D", "slow color shift", "sound - blinkfade", "sound - rays", "sound - spectro kalidastrip", "sound - spectromatrix optim", "sparks", "sparks center", "spin cycle", "tixy 2D", "Wave 2D", "xorcery 2D/3D"], "supported_color_modes": ["hs"], "assumed_state": true, "supported_features": 21}, "last_changed": "2021-04-19T20:34:18.569541+00:00", "last_updated": "2021-04-19T20:34:18.569541+00:00", "context": {"id": "3c8098ef5a01b11b696d98b2ffc7e054", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}}, "origin": "LOCAL", "time_fired": "2021-04-19T20:34:18.569541+00:00", "context": {"id": "3c8098ef5a01b11b696d98b2ffc7e054", "parent_id": null, "user_id": "b6e0a5a4cfa2456686391932605d0b97"}}}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.