andyboeh / esphome-dmx512 Goto Github PK
View Code? Open in Web Editor NEWAn ESPHOME custom component to control DMX-512 devices via UART + RS485 module
An ESPHOME custom component to control DMX-512 devices via UART + RS485 module
Thank you very much for this component.
It works great with ADJ VBar Pak fixtures using the config below. It is possible to control effects too!
The only issue is that there's no way to specify the DMX address of the light, as we have 4 or them, daisy chained with standard DMX cable. Please help me how to implement addressing to set up the lights, so we can set them separately.
Best would be to have an address
option added to each output
.
uart:
id: uart_bus
baud_rate: 250000
tx_pin: 5
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
enable_pin: 33
tx_pin: 5
uart_num: 1
force_full_frames: true
output:
- platform: dmx512
channel: 1
universe: dmx
id: vbar_red
- platform: dmx512
channel: 2
universe: dmx
id: vbar_green
- platform: dmx512
channel: 3
universe: dmx
id: vbar_blue
- platform: dmx512
channel: 4
universe: dmx
id: vbar_amber
- platform: dmx512
channel: 5
universe: dmx
id: vbar_master
- platform: dmx512
channel: 6
universe: dmx
id: vbar_effect_level
- platform: dmx512
channel: 7
universe: dmx
id: vbar_effect_select
- platform: dmx512
channel: 8
universe: dmx
id: vbar_effect_mode
number:
- platform: template
name: "VBar Pak Effect Level"
icon: mdi:gauge-low
id: vbar_effect_level_num
optimistic: true
min_value: 0
max_value: 255
step: 1
# mode: box
restore_value: true
set_action:
- lambda: |-
id(vbar_effect_level).set_level(x / 255);
- platform: template
name: "VBar Pak Effect Mode"
icon: mdi:gauge
id: vbar_effect_mode_num
optimistic: true
min_value: 0
max_value: 255
step: 1
mode: box
restore_value: true
set_action:
- lambda: |-
id(vbar_effect_mode).set_level(x / 255);
select:
- platform: template
name: VBar Pak Effect Selection
optimistic: true
restore_value: true
icon: "mdi:led-strip-variant"
id: vbar_effect_select_dropdown
options:
- "None"
- "Color Macro"
- "Color Change"
- "Color Fade"
- "Sound Active"
- "Strobing"
set_action:
- lambda: |-
if (0 == x.compare(std::string{"None"})) {
id(vbar_effect_select).set_level(0);
auto call_level = id(vbar_effect_level_num).make_call();
auto call_mode = id(vbar_effect_mode_num).make_call();
call_level.set_value(0);
call_mode.set_value(0);
call_level.perform();
call_mode.perform();
}
if (0 == x.compare(std::string{"Strobing"})) {
id(vbar_effect_select).set_level(0.04);
}
if (0 == x.compare(std::string{"Color Macro"})) {
id(vbar_effect_select).set_level(0.3);
}
if (0 == x.compare(std::string{"Color Change"})) {
id(vbar_effect_select).set_level(0.5);
}
if (0 == x.compare(std::string{"Color Fade"})) {
id(vbar_effect_select).set_level(0.66);
}
if (0 == x.compare(std::string{"Sound Active"})) {
id(vbar_effect_select).set_level(0.9);
auto call = id(vbar_effect_level_num).make_call();
call.set_value(200);
call.perform();
}
light:
- platform: monochromatic
name: "VBar Pak Dimmer"
output: vbar_master
icon: mdi:white-balance-sunny
default_transition_length: 2s
restore_mode: RESTORE_DEFAULT_ON
- platform: rgbw
name: "VBar Pak"
red: vbar_red
green: vbar_green
blue: vbar_blue
white: vbar_amber
icon: mdi:spotlight
default_transition_length: 0s
color_interlock: false
restore_mode: RESTORE_DEFAULT_ON
Hello,
In new version of esphome (12.0), a new security feature has been introduced called "Pin Reuse Validation" Pin Reuse Validation Documentation that prevents a pin from being used in 2 different locations. There is a bypass available here called "allow_other_uses" that can be set to "true" under a "pin" entry, so I had to change my configuration like that to be able to compile the configuration again.
uart:
id: uart_bus
baud_rate: 250000
tx_pin:
number: GPIO2
allow_other_uses: true # <== add bypass here
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
enable_pin:
number: GPIO13
allow_other_uses: true # <== add bypass here (because i've created a switch to be able to mute the dmx output
force_full_frames: false
tx_pin:
number: GPIO2
allow_other_uses: true # <== add bypass here
uart_num: 1
and with this part of the configuration edited it works very well, no problem whatsoever.
If you want, i can create a pull request to edit the examples of the repo, let me know.
Best regards.
Is there any support offered to receive a DMX signal, process, and react accordingly? I would like to be able to control a series of relays based upon DMX information received. Ideally I would like to keep this in the ESPHome platform on an ESP32 device.
Hi there,
I was wondering if there is a way to define 16bit outputs or to support that in the future. (for instance address 1 is coarse adjustment for RED, the second address is fine adjustment for RED)
I'm using your component with my ESP32 Wrover kit. I've connected two different lights to it, but one of the lights is flashing every second for a short period. What can cause this?
I've connected the ESP32 to a MAX485 module as described in your README.
My ESPHome configuration:
external_components:
- source: github://andyboeh/esphome-dmx512
esphome:
name: esp-rgbdmx
platform: esp32
board: esp-wrover-kit
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ap:
ssid: "esp-p1reader"
password: !secret fallback_password
captive_portal:
logger:
baud_rate: 0
api:
ota:
password: !secret ota_password
uart:
id: uart_bus
baud_rate: 250000
tx_pin: GPIO1
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
tx_pin: GPIO1
uart_num: 0
output:
- platform: dmx512
channel: 2
universe: dmx
id: lskon_red
- platform: dmx512
channel: 1
universe: dmx
id: lskon_green
- platform: dmx512
channel: 3
universe: dmx
id: lskon_blue
- platform: dmx512
channel: 4
universe: dmx
id: lskon_white
- platform: dmx512
channel: 5
universe: dmx
id: tdcsrig_master
- platform: dmx512
channel: 6
universe: dmx
id: tdcsrig_redyellow
- platform: dmx512
channel: 7
universe: dmx
id: tdcsrig_greenwhite
- platform: dmx512
channel: 8
universe: dmx
id: tdcsrig_bluepink
- platform: dmx512
channel: 9
universe: dmx
id: tdcsrig_strobe
- platform: dmx512
channel: 10
universe: dmx
id: tdcsrig_motor
- platform: dmx512
channel: 11
universe: dmx
id: tdcsrig_macro
light:
- platform: rgbw
name: LedstripKoning RGBW
id: lskon_rgbw
red: lskon_red
green: lskon_green
blue: lskon_blue
white: lskon_white
icon: mdi:spotlight
default_transition_length: 0.3s
color_interlock: false
gamma_correct: 0
restore_mode: RESTORE_DEFAULT_ON
- platform: monochromatic
name: Ayra TDC Sunrise Right
output: tdcsrig_master
icon: mdi:blur
disabled_by_default: true
default_transition_length: 2s
gamma_correct: 0
restore_mode: RESTORE_DEFAULT_ON
- platform: rgb
name: Ayra TDC Sunrise Right RGB
id: tdcsrig
red: tdcsrig_redyellow
green: tdcsrig_greenwhite
blue: tdcsrig_bluepink
icon: mdi:spotlight
default_transition_length: 0.3s
gamma_correct: 0
restore_mode: RESTORE_DEFAULT_ON
Hello.
First of all, thank you for making this custom component. It is exactly what I needed.
I am having a problem getting this to work using this yaml:
packages:
wifi: !include common/wifi.yaml
device_base: !include common/device_base.yaml
external_components:
- source: github://andyboeh/esphome-dmx512
esphome:
platform: ESP32
board: nodemcu-32s
uart:
id: uart_bus
baud_rate: 250000
tx_pin: 5
stop_bits: 2
dmx512:
id: dmx_0
uart_id: uart_bus
enable_pin: 33
tx_pin: 5
uart_num: 1
output:
- platform: dmx512
channel: 1
universe: dmx_0
id: dmx_0_ch1
- platform: dmx512
channel: 2
universe: dmx_0
id: dmx_0_ch2
- platform: dmx512
channel: 3
universe: dmx_0
id: dmx_0_ch3
- platform: dmx512
channel: 4
universe: dmx_0
id: dmx_0_ch4
- platform: dmx512
channel: 5
universe: dmx_0
id: dmx_0_ch5
- platform: dmx512
channel: 6
universe: dmx_0
id: dmx_0_ch6
- platform: dmx512
channel: 7
universe: dmx_0
id: dmx_0_ch7
- platform: dmx512
channel: 8
universe: dmx_0
id: dmx_0_ch8
- platform: dmx512
channel: 9
universe: dmx_0
id: dmx_0_ch9
- platform: dmx512
channel: 10
universe: dmx_0
id: dmx_0_ch10
- platform: dmx512
channel: 11
universe: dmx_0
id: dmx_0_ch11
- platform: dmx512
channel: 12
universe: dmx_0
id: dmx_0_ch12
light:
- platform: rgb
name: "RGB1"
red: dmx_0_ch1
green: dmx_0_ch2
blue: dmx_0_ch3
- platform: rgb
name: "RGB2"
red: dmx_0_ch4
green: dmx_0_ch5
blue: dmx_0_ch6
- platform: rgb
name: "RGB3"
red: dmx_0_ch4
green: dmx_0_ch5
blue: dmx_0_ch6
- platform: rgb
name: "RGB4"
red: dmx_0_ch4
green: dmx_0_ch5
blue: dmx_0_ch6
When I try to validate the config I get the error:
File "/data/persist/esphome/.esphome/external_components/9d3a21bd/components/dmx512/__init__.py", line 20, in _declare_type
if CORE.using_arduino:
AttributeError: 'EsphomeCore' object has no attribute 'using_arduino'
I am unsure what this error means. Could you assist with this?
If I comment out the if CORE.using_arduino
statement, the validation works, however compiling fails with this error:
INFO Reading configuration /data/persist/esphome/woonkamer_rgbleds.yaml...
INFO Detected timezone 'CET' with UTC offset 1 and daylight saving time from 27 March 02:00:00 to 30 October 03:00:00
INFO Generating C++ source...
/nix/store/k44dvza23wpjbry43qd985r07li26lpa-esphome-1.18.0/lib/python3.8/site-packages/esphome/core/__init__.py:678: RuntimeWarning: coroutine 'to_code' was never awaited
next(task)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
ERROR Circular dependency detected!
I hope you have any idea where I should start troubleshooting this.
Hey guys,
i have a azdelivery esp32 and a max3485 module... my dmx device is a 32channel 3A dmx512-decoder. so i ordered a usb to dmx cable to check if my led strip is working correctly - all ok (test it with qlc+).
then i connect the esp32 (pin5) to the max3485 and test it also...but nothing works..
i have set the dmx512 controller to adress 1 (at display) and turn it into 16bit mode. then connect a rgbw stripe to out1...in qlc+ its:
adress 1 : red
address 3: green
address 5 blue
address 7 white
external_components:
- source: github://andyboeh/esphome-dmx512
uart:
id: uart_bus
baud_rate: 250000
tx_pin: GPIO5
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
tx_pin: GPIO5
enable_pin: GPIO33
uart_num: 1
periodic_update: true
force_full_frames: false
custom_break_len: 92
custom_mab_len: 12
update_interval: 500
light:
- platform: monochromatic
name: "Test Lights"
output: coarse_red
id: light_test
default_transition_length: 2s
output:
- platform: dmx512
channel: 1
universe: dmx
id: coarse_red
maybe you can help me ;)
Salut zusammen
Sobald ich ich mehr als 35 RGBW Lichter mit je 4 Kanälen erstelle, läuft es nicht mehr oder sehr instabiel.
Irgend wer eine Idee?
From practical perspective: would be nice to have a switch implemented in this component which would drastically cut the output of the ESP when turned on: the equivalent of DMX cable pulled out.
By muting the output I mean simply not to send any signal at all, keep the GPIO in low state. DMX fixtures will all turn off when they don't get any signal on their inputs, and turn back on when signal comes back.
Use case 1: for longer periods turned off, minimize energy consumption and RF interference noise (reduce electrosmog)
Use case 2: re-arrange lights settings in blind (without being seen).
Sorry I'm a noob.
I am trying to unterstand the project (don't want to order all stuff without an idea how to integrate).
A) Can I include a DMX touch controller with this (has both lan and 3 pin (could use both in general) (DMX input)
B) A dimpack (3 pin) (seems straightforward)
I already orded the 485Max ànd have esps running on ha (mainly for relays).
1000 thanks for your work
Trying to compile with esp8266 end in:
Compiling .pioenvs\led-buero-dmx\src\esphome\components\light\light_state.cpp.o
src\esphome\components\dmx512\dmx512esp8266.cpp: In member function 'virtual void esphome::dmx512::DMX512ESP8266::send_break()':
src\esphome\components\dmx512\dmx512esp8266.cpp:13:5: error: 'SET_PERI_REG_MASK' was not declared in this scope
13 | SET_PERI_REG_MASK(UART_CONF0(this->uart_idx_), UART_TXD_BRK);
| ^~~~~~~~~~~~~~~~~
src\esphome\components\dmx512\dmx512esp8266.cpp:15:5: error: 'CLEAR_PERI_REG_MASK' was not declared in this scope
15 | CLEAR_PERI_REG_MASK(UART_CONF0(this->uart_idx_), UART_TXD_BRK);
| ^~~~~~~~~~~~~~~~~~~
*** [.pioenvs\led-buero-dmx\src\esphome\components\dmx512\dmx512esp8266.cpp.o] Error 1
src\esphome\components\light\light_call.cpp:11:25: warning: 'const esphome::LogString* esphome::light::color_mode_to_human(esphome::light::ColorMode)' defined but not used [-Wunused-function]
11 | static const LogString *color_mode_to_human(ColorMode color_mode) {
| ^~~~~~~~~~~~~~~~~~~
============================================== [FAILED] Took 7.55 seconds ==============================================
Do you have any ideas?
Thanks,
Patrick
This issue is somehow related to this component.
I am trying to create an ESPhome node to receive E131 commands from jinx or some other source to control a light and to spit out these settings to a DMX output with the esphome-dmx512 component through a 485 module. Outputting the DMX signal is working fine but I can't get the E131 traffic from my source to control the same light. It would be great to have this light function with the E131 input and DMX output while having ESPhome/HA as a "man in the middle". Is anyone capable of adding the missing link here?
e131:
method: multicast
output:
- platform: dmx512
channel: 1
universe: dmx
id: dmx_ch1
light:
- platform: monochromatic
name: "DMX from SACN"
output: dmx_ch1
id: sacn2dmx_light
gamma_correct: 0
- platform: partition
id: test_light
segments:
- single_light_id: sacn2dmx_light
effects:
- e131:
universe: 1
channels: MONO
uart:
id: uart_bus
tx_pin: GPIO2
rx_pin: GPIO3
baud_rate: 9600
dmx512:
id: dmx
uart_id: uart_bus
# enable_pin: GPIO33 # optional
tx_pin: GPIO2
uart_num: 1
periodic_update: true # optional
force_full_frames: false #optional
custom_break_len: 92 #optional
custom_mab_len: 12 #optional
update_interval: 500 #optional
Using source: github://andyboeh/esphome-dmx512@esp8266_support
and ESPHome 2021.12.3 or 2022.1.0b2 with Home Assistant Add-On, build fails with the following error:
Compiling /data/esp8266-test-1-dmx/.pioenvs/esp8266-test-1-dmx/lib975/ESPAsyncTCP-esphome/AsyncPrinter.cpp.o
Compiling /data/esp8266-test-1-dmx/.pioenvs/esp8266-test-1-dmx/lib975/ESPAsyncTCP-esphome/ESPAsyncTCP.cpp.o
src/main.cpp:31:1: error: 'DMX512ESP8266' in namespace 'esphome::dmx512' does not name a type
dmx512::DMX512ESP8266 *dmx;
^
src/main.cpp: In function 'void setup()':
src/main.cpp:337:3: error: 'dmx' was not declared in this scope
dmx = new dmx512::DMX512ESP8266();
^
src/main.cpp:337:13: error: expected type-specifier
dmx = new dmx512::DMX512ESP8266();
^
src/main.cpp:337:13: error: expected ';'
*** [/data/esp8266-test-1-dmx/.pioenvs/esp8266-test-1-dmx/src/main.cpp.o] Error 1
========================= [FAILED] Took 66.97 seconds =========================
ESP32 is OK.
Hi,
I made this work wiht an esp32 d1 mini and a generic max512 modbus board. It intergrates perfectly in home assistant and works as it should, But the delay is very noticable. like 1 second to turn on or off.
Does that ahve to do with wifi speed or the serial library? can this possibly be improved ?
thanks a bunch!
Config:
uart:
id: uart_bus
baud_rate: 250000
tx_pin: GPIO5
stop_bits: 2
dmx512:
id: dmx
uart_id: uart_bus
enable_pin: GPIO33
tx_pin: GPIO5
uart_num: 1
output:
- platform: dmx512
channel: 1
universe: dmx
id: dmx_1
light:
- platform: monochromatic
name: "Test Lights"
output: dmx_1
id: light_test
default_transition_length: 2s
Error at build:
INFO Reading configuration /config/esphome/esp32-test-1-dmx.yaml...
INFO Cloning https://github.com/andyboeh/esphome-dmx512.git@None
Failed config
dmx512: [source /config/esphome/esp32-test-1-dmx.yaml:79]
- [source /config/esphome/esp32-test-1-dmx.yaml:80]
id: dmx
uart_id: uart_bus
enable_pin: GPIO33
Expected integer, but cannot parse gpio5 as an integer.
tx_pin: GPIO5 [source /config/esphome/esp32-test-1-dmx.yaml:83]
uart_num: 1
To avoid confusion, ESPHome added GPIO
string to the pins to differentiate pin numbering of the MCU from pin numbering of various boards.
Please allow us in this component to use the same pin addressing scheme.
I am wondering if I could use this library with the https://www.olimex.com/Products/Modules/Interface/MOD-RS485/open-source-hardware . It would be a nice combination, since then it'd be an entirely off the shelf Ethernet<->DMX with esphome solution.
Specifically, I'd appreciate if you could tell me how the disconnection of the pins generates the break signal, and if it's relying on specific behavior of the rs485 chips you suggest.
Thanks!
Hello,
I want to trigger things in ESPhome based on a DMX input. Is this possible to implement? It looks like the integration only supports outputting DMX, not inputs.
Hi
My use case:
I'm using your custom component to my content on an ESP32 WT32-ETH01 device which drives a 12 channel dimmer capable of delivering 43kW to 12 channels. I'm "only" using 4 channels with a combined power output of 12.4kW. 3 channels are for a 3 phase flow heater, 10kW and 1 channel for an electric boiler. Now Node-Red and Home Assistant are used to give DMX512 signals to the ESP32. But I want more reliability and robustness. So I'd like to take Node-Red and Home Assistant out of the mix if possible at all. Doing so I'd avoid possibly wrong dim levels to be set if eg. an upgrade fails.
My question:
Is it possible with automations and lambda functions to let esphome itself write directly to DMX512? Avoiding Node-Red/HOme Assistant as a dependency. If this is possible, could you give me an example how to do it? I'm a bit puzzled since I'm a bit new to esphome.
Thanks a lot.
I have a DMX dimmer in my circuit with weird values:
Below 124 is off
124 - 150 is dimming from 0-100%
Above 150 is on
How can I do this with this component? Can I use the lambda, and how?
Hi Andy - Thanks for making this library for ESPHome!
I'm fantasizing about using a DMX controller to send control signals to ESPHome. So basically, to be able to create sensors for Home Assistant using ESPHome,attached to an inexpensive DMX controller.
Any chance that it would be trivial to build such a library? I know that isn't the intention of this library, but thought this might be an appropriate place to ask.
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.