esphome / esphome/feature-requests

Substitutions for PINs

Open
#2,342 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
450
Forks
29
PR merge metrics
No merged PRs in 30d

Description

Describe the problem you have/What new integration you would like
Please make PIN values available for substitutions

Please describe your use case for this integration and alternatives you've tried:
Currently I am working on a project automating my subfloor heating. This uses a WEMOS D1 Mini and a relay board to control the valves.
Unfortunately 90 % of the configuration stays the same for all 6 rooms I am doing the automation for. The only things which are changing are the variable from Home Assistant storing the current temperature (available for substitution) and the PIN value (e.g. D2) used to open the relay (not available for substitution).
My current workaround is to copy the whole section 6 times to cover all rooms but it would be much easier if the PIN values would be available for substitution as well.

Thank you very much in advance!

Additional context

I tried to add the following snippet to the main configuration for the WEMOS D1 Mini:

# Add thermostat configuration for kitchen
# D7 -> IN3 -> kitchen
<<: !include 
      file: common/thermostat.yaml
      vars:
        location: "kitchen"
        valve_pin: D7 

and this is the block I need to copy 6 times once for each room:

##########################################################################
#
# ESPHome configuration for heating based on WEMOS D1 Mini.
# Introduced in August 2023
#
##########################################################################

# Thermostat for the given room
climate:
  - platform: thermostat
    id: thermostat_${location}
    name: thermostat_${location}
    default_preset: home
    idle_action:
      - switch.turn_off: valve_${location}
    heat_action:
      - switch.turn_on: valve_${location}
    min_heating_off_time: 300s
    min_heating_run_time: 300s
    min_idle_time: 30s
    preset:
      - name: away
        default_target_temperature_low: 15 °C
      - name: comfort
        default_target_temperature_low: 22 °C
      - name: home
        default_target_temperature_low: 21.5 °C
      - name: sleep
        default_target_temperature_low: 17 °C
    sensor: temperature_${location}

# Temperature of the given room (from home assistant)
sensor:
  - platform: homeassistant
    id: temperature_${location}
    entity_id: sensor.temperature_${location}
    filters:
     - filter_out: nan
    internal: true

# Relais for valve
switch:
  - platform: gpio
    id: valve_${location}
    name: valve_${location}
    icon: "mdi:pipe-valve"
    pin:
      inverted: yes
      number: ${valve_pin}
    restore_mode: ALWAYS_OFF

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the main YAML configuration and the included common/thermostat.yaml example, focusing on how the existing location and temperature substitutions are handled. Check the feature-request context and configuration behavior first; done means a PIN such as D7 can be supplied per include without copying the thermostat block for every room.

Written by the indexing model from the issue text.

Assessment

Tech stack
yaml
Domain
embedded-iot
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.