yeonv / ledfxrm Goto Github PK
View Code? Open in Web Editor NEWCustom Integration for Home Assistant to control a any (local/remote) LedFX-server - State: beta
License: MIT License
Custom Integration for Home Assistant to control a any (local/remote) LedFX-server - State: beta
License: MIT License
Is your feature request related to a problem? Please describe.
It would be very convenient to have the ability to set different effects for each individual strip versus a "scene" that contains multiple lights.
Describe the solution you'd like
Using the example from the wiki:
It would be nice to be able to click on the entity and have an option to select the desired effect (whether custom preset or default included effect (retrieve via /api/schema/effects and use defaults?)).
e.g. the ability to edit the "mode"
Describe alternatives you've considered
Currently I resort to accessing the ledfx UI directly or very manual command_line switches.
Additional context
None
I'm using this addon https://github.com/hassio-addons/addon-ledfx installed on rpi.
Web UI for this addon require basic authorization with HA login and password. Without this REST API don't work.
It's same rpi, where ledfxrm is installed.
Please add BasicAuth to ledfxrm
I replace code like this
session.get(url4, ssl=False, auth=aiohttp.BasicAuth('bob', ''))
to
session.get(url4, ssl=False, auth=aiohttp.BasicAuth('user', 'pwd'))
and it helps a bit.
0.2.9
host: 192.168.1.56
port: 8888
scan interval in seconds: 300
Create Entities for SubDevices: unchecked
Add Start/Stop-Server custom-endpoint: unchecked
Add Virtual-Lights (requires LedFx >0.9.2): unchecked
LedFX hosted on Windows, with one device (WLED) added and 2 scenes defined. Home Assistant core 2021.7.1
All sensors show a value of 0 apart from server status which shows connected but doesn't change state when LedFX is closed. Scene selector on the light entity also shows all 0's
Error while setting up ledfxrm platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 250, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/ledfxrm/light.py", line 51, in async_setup_entry
for k in virtuals:
TypeError: 'NoneType' object is not iterable
{
"audio": {
"device_index": 0
},
"crossfade": 1.0,
"custom_presets": {},
"dev_mode": false,
"devices": [
{
"config": {
"center_offset": 0,
"channel_count": 636,
"channel_offset": 0,
"e131_Packet_Priority": 100,
"force_refresh": false,
"icon_name": "SettingsInputComponent",
"ip_address": "192.168.1.160",
"max_brightness": 1,
"name": "WLED",
"pixel_count": 212,
"preview_only": false,
"refresh_rate": 60,
"type": "e131",
"universe": 1,
"universe_end": 2,
"universe_size": 510
},
"id": "wled",
"type": "e131"
}
],
"fade": 1.0,
"host": "192.168.1.56",
"integrations": [],
"max_workers": 10,
"port": 8888,
"presets": {
"subbass": {
"devices": {
"wled1": {
"config": {
"blur": 1.0,
"brightness": 1.0,
"flip": false,
"frequency_range": "sub_bass",
"gradient_method": "bezier",
"gradient_name": "Spectral",
"gradient_roll": 1,
"mirror": true
},
"type": "beat(Reactive)"
}
},
"name": "subbass"
}
},
"scenes": {
"bass": {
"devices": {
"wled": {
"config": {
"background_color": "black",
"blur": 2.3114887329706866,
"brightness": 1.0,
"flip": true,
"frequency_range": "Bass (60-250Hz)",
"gradient_name": "Viridis",
"gradient_repeat": 1,
"gradient_roll": 7,
"mirror": true
},
"type": "magnitude(Reactive)"
}
},
"name": "Bass"
},
"orange": {
"devices": {
"wled": {
"config": {
"active": true,
"background_color": "black",
"blur": 3.0,
"brightness": 1.0,
"flip": false,
"gradient_name": "Rust",
"gradient_repeat": 1,
"gradient_roll": 0,
"mirror": false
},
"type": "wavelength(Reactive)"
}
},
"name": "Orange"
}
},
"virtuals": []
}
0.2.4
None
I receive the below error when trying to turn on the imported devices that were already off. I have confirmed that turning off and turning on devices that were already on work fine. I am running the latest version of HA and latest version of LedFx (v11.1).
e.g. The issue happens for all with the X below:
[140297667665728] 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://MYURLandPORT/api/devices/wled6/effects')
[140297667665728] 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://MYURLandPORT/api/devices/stool/effects')
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 135, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1445, in async_call
task.result()
File "/usr/src/homeassistant/homeassistant/core.py", line 1480, in _execute_service
await handler.job.target(service_call)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 204, in handle_service
await self.hass.helpers.service.entity_service_call(
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 593, in entity_service_call
future.result() # pop exception if have
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 664, in async_request_call
await coro
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 630, in _handle_entity_call
await result
File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 230, in async_handle_light_on_service
await light.async_turn_on(**params)
File "/config/custom_components/ledfxrm/light.py", line 149, in async_turn_on
await self.coordinator.api.async_device_on(self.devicename)
File "/config/custom_components/ledfxrm/__init__.py", line 418, in async_device_on
await set_effect.json()
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1097, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://MYURLandPORT/api/devices/wled6/effects')
0.2.6
N/A
One observation is that it seems that after restarting HA the "Home Assistant is starting, not everything will be available until it is finished." message is displayed for what seems like 4+ minutes until it finally gives up if LedFx isn't already running. Then the below logs show up. I can then use the built in start button and see it start, but the subdevices are still broken and show as "unavailable" with the message:
This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device.
If the entity is no longer in use, you can clean it up by removing it.
The subdevices are broken until I restart HA with LedFx already running. If LedFx is already running it starts up no problem (no delay and subdevices displayed).
Is there a way to maybe have an option in the ledfxrm settings to "auto call the start server endpoint on startup" before trying to setup the subdevices?
Error while setting up ledfxrm platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 199, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/ledfxrm/light.py", line 51, in async_setup_entry
for k in virtuals:
TypeError: 'NoneType' object is not iterable
hey ๐ @ALL..
I only have one question and otherwise don't know where to ask the question .. that's why here... sorry ๐
where can I find the ledfx config yaml so that I can enter the IP address??
Hello,
I have problem when adding your component to my HA instance.
My LedFX is in docker container on Synology.
This is the log:
Logger: aiohttp.server
Source: custom_components/ledfxrm/config_flow.py:166
First occurred: 14:06:57 (14 occurrences)
Last logged: 14:17:42
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 155, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/config/custom_components/ledfxrm/config_flow.py", line 51, in async_step_user
name, version = await self.get_rest_status(
File "/config/custom_components/ledfxrm/config_flow.py", line 166, in get_rest_status
rest_info = await resp.json()
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1099, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain; charset=utf-8', url=URL('http://192.168.x.x:9999/api/info')
This is the response from API:
{"url": "http://0.0.0.0:8888", "name": "LedFx Controller", "version": "0.7", "debug_mode": true}
Hi,
I have LedFX running on a raspberry pi 3B+ that has a usb mic to listen for music. I have 2 dig-uno running WLED version 0.11.1 (latest) and all works great. I am running Home Assistant supervised 2021.01.5 (latest) on core-2021.1.4 (latest) on a ESXI virtual machine. When I install LedFx Remote 0.2.4 (latest) through Hacs 1.10.0 (latest) I'm getting log and performance problems. The processor jumps from 7% normal running to 25%. Then LedFx Controller is writing over 1 million logs per hour to the logfile. Below is the log, IP addresses are correct but replaced by XXXXXX. The logs are been written even without any led Scenes selected.
UPDATING WTF {'info': {'url': 'http://0.0.0.0:8888', 'name': 'LedFx Controller', 'version': '0.9.2', 'debug_mode': True}, 'devices': {'status': 'success', 'devices': {'wled-2': {'config': {'center_offset': 0, 'channel_count': 180, 'channel_offset': 0, 'force_refresh': False, 'ip_address': '192.XXXXXXX', 'max_brightness': 1.0, 'name': 'wled-2', 'pixel_count': 60, 'preview_only': False, 'refresh_rate': 60, 'universe': 1, 'universe_end': 1, 'universe_size': 512, 'type': 'e131'}, 'id': 'wled-2', 'type': 'e131', 'effect': {}}, 'wled-1': {'config': {'center_offset': 0, 'channel_count': 180, 'channel_offset': 0, 'force_refresh': False, 'ip_address': '192.XXXXXX', 'max_brightness': 1.0, 'name': 'wled-1', 'pixel_count': 60, 'preview_only': False, 'refresh_rate': 60, 'universe': 1, 'universe_end': 1, 'universe_size': 512, 'type': 'e131'}, 'id': 'wled-1', 'type': 'e131', 'effect': {}}}}, 'virtuals': {'virtuals': {'blade': True, 'list': []}}, 'scenes': {'status': 'success', 'scenes': {'wled-2-bar': {'devices': {'wled-2': {'config': {'background_color': 'black', 'blur': 0.0, 'brightness': 1.0, 'color_step': 0.327, 'ease_method': 'ease_out', 'flip': False, 'gradient_name': 'Rainbow', 'gradient_repeat': 1, 'gradient_roll': 0, 'mirror': False, 'mode': 'bounce'}, 'type': 'bar(Reactive)'}}, 'name': 'wled-2 Bar'}, 'wled-2-off': {'devices': {'wled-1': {}, 'wled-2': {}}, 'name': 'wled-2 Off'}, 'wled-2-rain-sensitive': {'devices': {'wled-2': {'config': {'background_color': 'black', 'blur': 0.0, 'brightness': 1.0, 'flip': False, 'high_colour': 'blue', 'high_sensitivity': 0.035, 'lows_colour': 'white', 'lows_sensitivity': 0.03, 'mids_colour': 'red', 'mids_sensitivity': 0.03, 'mirror': True, 'raindrop_animation': 'droplet_0.npy'}, 'type': 'rain(Reactive)'}}, 'name': 'wled-2 Rain Sensitive'}, 'wled-2-real-strobe': {'devices': {'wled-2': {'config': {'background_color': 'black', 'bass_strobe_decay_rate': 0.5, 'bass_threshold': 0.4, 'blur': 0.0, 'brightness': 1.0, 'color_step': 0.0625, 'flip': False, 'gradient_name': 'Dancefloor', 'gradient_repeat': 1, 'gradient_roll': 0, 'mirror': False, 'strobe_color': 'white', 'strobe_decay_rate': 0.5, 'strobe_width': 10}, 'type': 'real_strobe(Reactive)'}}, 'name': 'wled-2 Real Strobe'}}}, 'show_subdevices': False}
When a scene is selected this is the logs
UPDATING WTF {'info': {'url': 'http://0.0.0.0:8888', 'name': 'LedFx Controller', 'version': '0.9.2', 'debug_mode': True}, 'devices': {'status': 'success', 'devices': {'wled-2': {'config': {'center_offset': 0, 'channel_count': 180, 'channel_offset': 0, 'force_refresh': False, 'ip_address': '192.XXXXXXXX', 'max_brightness': 1.0, 'name': 'wled-2', 'pixel_count': 60, 'preview_only': False, 'refresh_rate': 60, 'universe': 1, 'universe_end': 1, 'universe_size': 512, 'type': 'e131'}, 'id': 'wled-2', 'type': 'e131', 'effect': {'config': {'background_color': 'black', 'blur': 0.0, 'brightness': 1.0, 'flip': False, 'high_colour': 'blue', 'high_sensitivity': 0.035, 'lows_colour': 'white', 'lows_sensitivity': 0.03, 'mids_colour': 'red', 'mids_sensitivity': 0.03, 'mirror': True, 'raindrop_animation': 'droplet_0.npy'}, 'name': 'Rain', 'type': 'rain(Reactive)'}}, 'wled-1': {'config': {'center_offset': 0, 'channel_count': 180, 'channel_offset': 0, 'force_refresh': False, 'ip_address': '192.168.0.126', 'max_brightness': 1.0, 'name': 'wled-1', 'pixel_count': 60, 'preview_only': False, 'refresh_rate': 60, 'universe': 1, 'universe_end': 1, 'universe_size': 512, 'type': 'e131'}, 'id': 'wled-1', 'type': 'e131', 'effect': {}}}}, 'virtuals': {'virtuals': {'blade': True, 'list': []}}, 'scenes': {'status': 'success', 'scenes': {'wled-2-bar': {'devices': {'wled-2': {'config': {'background_color': 'black', 'blur': 0.0, 'brightness': 1.0, 'color_step': 0.327, 'ease_method': 'ease_out', 'flip': False, 'gradient_name': 'Rainbow', 'gradient_repeat': 1, 'gradient_roll': 0, 'mirror': False, 'mode': 'bounce'}, 'type': 'bar(Reactive)'}}, 'name': 'wled-2 Bar'}, 'wled-2-off': {'devices': {'wled-1': {}, 'wled-2': {}}, 'name': 'wled-2 Off'}, 'wled-2-rain-sensitive': {'devices': {'wled-2': {'config': {'background_color': 'black', 'blur': 0.0, 'brightness': 1.0, 'flip': False, 'high_colour': 'blue', 'high_sensitivity': 0.035, 'lows_colour': 'white', 'lows_sensitivity': 0.03, 'mids_colour': 'red', 'mids_sensitivity': 0.03, 'mirror': True, 'raindrop_animation': 'droplet_0.npy'}, 'type': 'rain(Reactive)'}}, 'name': 'wled-2 Rain Sensitive'}, 'wled-2-real-strobe': {'devices': {'wled-2': {'config': {'background_color': 'black', 'bass_strobe_decay_rate': 0.5, 'bass_threshold': 0.4, 'blur': 0.0, 'brightness': 1.0, 'color_step': 0.0625, 'flip': False, 'gradient_name': 'Dancefloor', 'gradient_repeat': 1, 'gradient_roll': 0, 'mirror': False, 'strobe_color': 'white', 'strobe_decay_rate': 0.5, 'strobe_width': 10}, 'type': 'real_strobe(Reactive)'}}, 'name': 'wled-2 Real Strobe'}}}, 'show_subdevices': False}
I don't have anything for LedFX Remote in my configuration.yaml file.
I completely removed LedFX, rebooted and all was ok, I reinstalled it again and get the same problems. Any ideas or thoughts would be greatly appreciated.
Thanks
0.2.5
None
Hello, Thank you very much for the integration, it is exactly what I'm looking for! I am having an issue when trying to add devices. I receive the following error log. I am on the latest version of HA. The issue persists even after following the "messed up" guide in the wiki.
Error adding entities for domain light with platform ledfxrm
Error while setting up ledfxrm platform for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 427, in _async_add_entity
original_icon=entity.icon,
File "/config/custom_components/ledfxrm/light.py", line 185, in icon
if self.deviceconfig["icon_name"].startswith("mdi:"):
KeyError: 'icon_name'
The light entity for selecting scenes works well enough but requires you open the more info page to actually select a scene, select would feel more natural.
Use the select entity/integration to switch scenes.
Using the current light entity
https://www.home-assistant.io/blog/2021/07/07/release-20217/#new-entity-select
https://www.home-assistant.io/integrations/select/
https://github.com/home-assistant/core/tree/dev/homeassistant/components/select
v0.2.9
HACS: 1.12.3
HA: 2021.5.5
Haha:
In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "LedFx Remote"
Also see here ;)
After installing and rebooting HA, no Integration was found.
But it seems loaded (see log)
2021-05-22 16:56:37 WARNING (MainThread) [homeassistant.loader] You are using a custom integration ledfxrm which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
Also missing within config/info
Logger: aiohttp.server
Source: custom_components/ledfxrm/config_flow.py:73
First occurred: 2:10:55 (45 occurrences)
Last logged: 13:51:54
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
resp = await task
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 169, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 106, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 153, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 201, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/config/custom_components/ledfxrm/config_flow.py", line 37, in async_step_user
name, version = await self.get_rest_status(user_input[CONF_HOST], user_input[CONF_PORT])
File "/config/custom_components/ledfxrm/config_flow.py", line 73, in get_rest_status
rest_info = await resp.json()
File "/usr/local/lib/python3.8/site-packages/aiohttp/client_reqrep.py", line 1026, in json
raise ContentTypeError(
aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: text/plain', url=URL('http://localhost:5333/api/info')
LEDFxRm 0.2.6 (Running on RPi4 2Gb, Hassio 2021.2.3, Home Assistant OS 5.12, Frontend version: 20210127.7 - latest)
LEDFx 0.10.0 (Running on a RPi4 2Gb, Rasperry Pi OS Lite, Python 3.7.3)
After the integration is added only the binary and sensor entities are added (4 in total) and there are no entities for the lights or switches so LEDFx cannot be controlled from Home assistant.
After the integration is configured the following is in the log for LEDFxRm:
Logger: homeassistant.config_entries
Source: loader.py:480
First occurred: 3:13:58 PM (1 occurrences)
Last logged: 3:13:58 PM
Error setting up entry LedFx Controller for light
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 239, in async_setup
result = await component.async_setup_entry(hass, self) # type: ignore
File "/usr/src/homeassistant/homeassistant/components/light/init.py", line 268, in async_setup_entry
return await hass.data[DOMAIN].async_setup_entry(entry)
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 140, in async_setup_entry
platform = await async_prepare_setup_platform(
File "/usr/src/homeassistant/homeassistant/setup.py", line 298, in async_prepare_setup_platform
platform = integration.get_platform(domain)
File "/usr/src/homeassistant/homeassistant/loader.py", line 475, in get_platform
cache[full_name] = self._import_platform(platform_name)
File "/usr/src/homeassistant/homeassistant/loader.py", line 480, in _import_platform
return importlib.import_module(f"{self.pkg_path}.{platform_name}")
File "/usr/local/lib/python3.8/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1014, in _gcd_import
File "", line 991, in _find_and_load
File "", line 975, in _find_and_load_unlocked
File "", line 671, in _load_unlocked
File "", line 779, in exec_module
File "", line 916, in get_code
File "", line 846, in source_to_code
File "", line 219, in _call_with_frames_removed
File "/config/custom_components/ledfxrm/light.py", line 185
if self.deviceconfig.has_key("icon_name")
^
SyntaxError: invalid syntax
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.