diff --git a/mlock-common.yml b/mlock-common.yaml similarity index 88% rename from mlock-common.yml rename to mlock-common.yaml index 6679f2b..2cb8322 100644 --- a/mlock-common.yml +++ b/mlock-common.yaml @@ -13,7 +13,7 @@ substitutions: ###### nothing to change below this line ###### esphome: - name: $name_of_board + name: mlock-${name_of_board} platform: ESP8266 board: d1_mini @@ -107,9 +107,9 @@ rc522_spi: then: - lambda: |- json::parse_json(id(http_request_data).get_string(), [](JsonObject root) { - std::string foobar = root["data"]["$name_of_board"]; + std::string foobar = root["data"]["mlock-$name_of_board"]; if(foobar == "True") { - id(switch_output).turn_on(); + id(mlock_${name_of_board}_switch).turn_on(); } }); @@ -118,14 +118,14 @@ rc522_spi: output: - platform: gpio pin: D1 - id: gpio_relais_output + id: mlock_${name_of_board}_gpio_relais_output # switch component for the output state switch: - platform: output name: "Relais Output" - id: ${name_of_board}_switch_output - output: 'gpio_relais_output' + id: mlock_${name_of_board}_switch + output: 'mlock_${name_of_board}_gpio_relais_output' internal: true # hide from Homeassistant, so no one can turn it on without Tag-Scanning @@ -136,15 +136,16 @@ binary_sensor: number: D3 inverted: true mode: INPUT_PULLUP - id: gpio_input_ausschalter + id: ${name_of_board}gpio_input_ausschalter on_press: - - switch.turn_off: switch_output + - switch.turn_off: mlock_${name_of_board}_switch # a template sensor for showing the current switch state (read only) - platform: template + id: mlock_${name_of_board}_state_output name: "${name_of_board} Status Ausgang" publish_initial_state: true lambda: |- - return id(switch_output).state; + return id(mlock_${name_of_board}_switch).state; # a button element for Homeassistant UI to allow turning off @@ -153,7 +154,7 @@ button: name: "${name_of_board} Ausschalter" id: ${name_of_board}_btn_ausschalter on_press: - - switch.turn_off: switch_output + - switch.turn_off: mlock_${name_of_board}_switch