I want to set ON/OFF the status LED.
Currently I am using substitution to assign the pin number for a specific board. Example "build_in_led_pin: GPIO02 ".
I am also using a substitution for the board type of the D1mini, ESP6288 and ESP32.
I wish to determine the pin number based on the board type.
Here is my code, I assign the pin number base on substitution ${esp_id}_BuildInLED
output:
platform: gpio
id: ${esp_id}_BuildInLED
pin:
number: ${build_in_led_pin}
#number: |-
# if ( ${board_type} == esp32doit-devkit-v1) return 'GPI02';
# else return (ERROR);
My assignment in substitution : board_type: esp32doit-devkit-v1
I try to assign the pin number base on board type example esp32doit-devkit-v1 would be pin number GPIO2 while board type nodemcuv2 would be D4.
I think that I can do it with lambda, but I don’t know how.
Can someone with programming knowledge help me please.