I have setup an 4Ch. Thermometer with DS18B20 and 2 MAX7219 7Segment Boards.
I am trying to control the brightness of the 7Segments by using an value from a LDR-Sensor wich is on another esp. The LDR Sensor values are available in HA.
With an automation i would like to send this value to the max7219.
I have tried to make a sensor but ESPHOME gives me an error while compiling:
If you want to use the data from another sensor which is already available in HA you have to use the - platform: homeassistant
see: Home Assistant Sensor — ESPHome and not - platform: template
and you can then set the intensity in the lambda where you also print the temperature by using: it.set_intensity(id(max7219_bright).state); as described in MAX7219 7-Segment Display — ESPHome
Probably can’t calibrate it then but since it’s linear I believe you could use round(value/66.66666).
Not sure what the correct syntax in lambda is though.
THAT way round? OK.
Changed it and WOW! it works!
Because the light is down now i tried it with the value of my swap-file 189MB and the lights getting brighter! So the calibrate-filter works also! Gives me a value of 2.8.
Even the max7219 does only accept int-values from 0 (dark, not off!) to 15(full bright)
it runs with float-values too. Very good!
one hint for using those max7219-7Segment Displays on a ESP:
It runs well with 3.3V but there is a safety-diode onboard, you must remove this and replace it with 0R resistor or a peace of wire! If more than one diplay is daisy-chained there will be too much voltage-loss!