diff --git a/upk2esphome/parts/switch.py b/upk2esphome/parts/switch.py index 887d94e..441cd96 100644 --- a/upk2esphome/parts/switch.py +++ b/upk2esphome/parts/switch.py @@ -49,6 +49,12 @@ def generate(yr: YamlResult, config: ConfigData, opts: Opts): } invert(switch, rl_inv) + if led_pin is not None and netled_reuse: + yr.warn( + f"Skipping LED {i} on pin P{led_pin} - shared status LED is enabled" + ) + led_pin = None + if led_pin is not None: yr.log(f" - LED {i}: pin P{led_pin}") output = { diff --git a/upk2esphome/tests/plug_netled_reuse_led1.txt b/upk2esphome/tests/plug_netled_reuse_led1.txt new file mode 100644 index 0000000..7310da9 --- /dev/null +++ b/upk2esphome/tests/plug_netled_reuse_led1.txt @@ -0,0 +1,34 @@ +{ + "bt1_lv": 0, + "bt1_pin": 10, + "bt1_type": 0, + "ch1_stat": 2, + "ch_cddpid1": 9, + "ch_dpid1": 1, + "ch_num": 1, + "chip_type": 0, + "crc": 8, + "ele_fun_en": 1, + "ele_pin": 7, + "ffc_select": 1, + "jv": "1.0.4", + "led1_lv": 0, + "led1_pin": 23, + "lose_vol": 90, + "module": "CB2S", + "net_trig": 4, + "netled1_lv": 0, + "netled1_pin": 8, + "netled_reuse": 1, + "over_cur": 25000, + "over_vol": 270, + "reset_t": 3, + "resistor": 1, + "rl1_lv": 1, + "rl1_pin": 26, + "rl1_type": 0, + "sel_pin_lv": 1, + "sel_pin_pin": 24, + "vi_pin": 6, + "vol_def": 1 +}