andyboeh / esphome-dmx512

An ESPHOME custom component to control DMX-512 devices via UART + RS485 module
39 stars 21 forks source link

Lambda for dimmer #31

Open stijnb1234 opened 9 months ago

stijnb1234 commented 9 months ago

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?

andyboeh commented 9 months ago

Sure: Create a template output and add your logic to the write_value function:

https://esphome.io/components/output/template.html

stijnb1234 commented 9 months ago

So far I understand. But what are the input values (which range?) and what are the output values?

andyboeh commented 9 months ago

The values at the output are in the range 0.0 to 1.0, it's a float output. The DMX component calculates the 0-254 values based on this float range. So you are dealing with two float ranges between 0 and 1 here and you need to map your values here.