esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
290 stars 35 forks source link

Pin validation issue starting in v2023.12.0 #5247

Closed andypnz closed 9 months ago

andypnz commented 9 months ago

The problem

Since 2023.12.0 I get the follwoing error when using one ADC pin to generate two readings (raw and modified):

`INFO ESPHome 2023.12.0 INFO Reading configuration /config/esphome/esp32-waterpump-mon.yaml... Failed config

sensor.adc: [source :100]

Pin 32 is used in multiple places. platform: adc name: esp32-waterpump-mon Water Pressure pin: number: 32 mode: input: True output: False open_drain: False pullup: False pulldown: False inverted: False ignore_strapping_warning: False drive_strength: 20.0 update_interval: 2s unit_of_measurement: PSI accuracy_decimals: 2 attenuation: 0db filters:

Which version of ESPHome has the issue?

2023.12.0

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.12.3

What platform are you using?

ESP32

Board

esp32dev

Component causing the issue

ADC

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

peejayw commented 9 months ago

I am getting the same error "pin 17 is used in multiple locations." Just started.

makkie2002 commented 9 months ago

Same here. Broke my S0 watersensor: https://github.com/huizebruin/s0tool.

INFO ESPHome 2023.12.0
INFO Reading configuration /config/esphome/s0tool-watermeter-ad280f.yaml...
INFO Updating https://github.com/huizebruin/s0tool/@main
INFO Detected timezone 'Europe/Brussels'
Failed config

sensor.pulse_meter: [source <unicode string>:66]

  Pin 4 is used in multiple places.
  platform: pulse_meter
  internal_filter_mode: PULSE
  internal_filter: 50ms
  pin: 
    number: 4
    mode: 
      input: True
      output: False
      open_drain: False
      pullup: False
      pulldown: False
      analog: False
    inverted: False
  id: watermeter_flow
  name: watermeter flow
  state_class: measurement
  unit_of_measurement: l/min
  accuracy_decimals: 1
  icon: mdi:water-pump
  filters: 
    - lambda: !lambda |-
        return x * atof(id(Select_pulse_water).state.c_str()) * 1000;
  total: 
    id: sensor_pulse_meter_total
    name: watermeter Totaal
    state_class: total_increasing
    device_class: water
    icon: mdi:water
    unit_of_measurement: m³
    accuracy_decimals: 3
    filters: 
      - multiply: 0.001
    disabled_by_default: False
    force_update: False
  disabled_by_default: False
  force_update: False
  timeout: 5min
binary_sensor.gpio: [source <unicode string>:50]

  Pin 4 is used in multiple places.
  platform: gpio
  id: water_sensor_status
  name: Water sensor status
  internal: False
  pin: 
    number: 4
    inverted: True
    mode: 
      input: True
      output: False
      open_drain: False
      pullup: False
      pulldown: False
      analog: False
  on_press: 
    - then: 
        - lambda: !lambda |-
            id(total_water_pulses) += 1;
  disabled_by_default: False
Murada99 commented 9 months ago

Try the following pin:
number: 4 allow_other_uses: true

Ronnie1967 commented 9 months ago

I have the same error... my platform is ultrasonic and I am not using the gpio pins. How would I add in the above for:

1st try

just adding it in gives me: sensor.ultrasonic: [source :50] platform: ultrasonic trigger_pin: D5

[allow_other_uses] is an invalid option for [sensor.ultrasonic]. Please check the indentation. allow_other_uses: True echo_pin: D6

2nd try

gives me mapping values are not allowed in this context in "", line 52, column 23

Murada99 commented 9 months ago

Can you try :

trigger_pin: number: D5
allow_other_uses: true

Ronnie1967 commented 9 months ago

Thanks @Murada99 that worked....

randybb commented 9 months ago

It was mentioned as a breaking change. Please read release notes first.

ssieb commented 9 months ago

There's a reason that validation was added. You shouldn't be doing things like this.

peejayw commented 9 months ago

So this is my watering sensor firmware, could sme kind person point me to what I need to get it working again (error is pin 17 is used in multiple places.) Thanks.

INFO ESPHome 2023.12.1
INFO Reading configuration /config/esphome/192-168-1-28.yaml...
Failed config

sensor.adc: [source <unicode string>:47]

  Pin 17 is used in multiple places.
  platform: adc
  pin: 
    number: 17
    mode: 
      analog: True
      input: True
      output: False
      open_drain: False
      pullup: False
      pulldown: False
    inverted: False
  id: adcMoisture
  accuracy_decimals: 0
  unit_of_measurement: %
  filters: 
    - calibrate_linear: 
        datapoints: 
          - from: 0.375
            to: 100.0
          - from: 0.74023
            to: 0.0
        method: least_squares
  name: Plant - Moisture Level
  update_interval: 30s
  disabled_by_default: False
  force_update: False
  device_class: voltage
  state_class: measurement
  raw: False
sensor.adc: [source <unicode string>:58]

  Pin 17 is used in multiple places.
  platform: adc
  pin: 
    number: 17
    mode: 
      analog: True
      input: True
      output: False
      open_drain: False
      pullup: False
      pulldown: False
    inverted: False
  id: adcRaw_Sensor_Data
  accuracy_decimals: 5
  name: Plant - Sensor Voltage
  update_interval: 30s
  disabled_by_default: False
  force_update: False
  unit_of_measurement: V
  device_class: voltage
  state_class: measurement
  raw: False
peejayw commented 9 months ago
esphome:
  name: "192-168-1-28"
  friendly_name: Watering Sensor
  platformio_options:
    board_build.f_cpu: 160000000L
esp8266:
  board: esp01_1m

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "stl28kifE3Jt/309AT1xkz4oAbvYCCVUQQ2Gppt/kMc="

ota:

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Esphome-Web-9215B0"
    password: "OT5GbjKPwMas"

captive_portal:
web_server:
    port: 80

light:
  - platform: binary
    name: "Blue Light"
    output: light_output
    id: led_light
    restore_mode: ALWAYS_OFF

output:
  - platform: gpio
    pin: GPIO2
    id: light_output
    inverted: true

sensor:
- platform: adc
  pin: A0
  id: "adcMoisture"
  accuracy_decimals: 0
  unit_of_measurement: '%'
  filters:
    - calibrate_linear:
      - 0.37500  -> 100.0
      - 0.74023 -> 0
  name: "Plant - Moisture Level"
  update_interval: 30s
- platform: adc
  pin: A0
  id: "adcRaw_Sensor_Data"
  accuracy_decimals: 5
  name: "Plant - Sensor Voltage"
  update_interval: 30s
- platform: wifi_signal
  name: "Plant - WiFi Signal Sensor"
  update_interval: 30s    
ssieb commented 9 months ago
sensor:
- platform: copy
  source_id: adcRaw_Sensor_Data
  id: "adcMoisture"
  accuracy_decimals: 0
  unit_of_measurement: '%'
  filters:
    - calibrate_linear:
      - 0.37500  -> 100.0
      - 0.74023 -> 0
  name: "Plant - Moisture Level"
- platform: adc
  pin: A0
  id: "adcRaw_Sensor_Data"
  accuracy_decimals: 5
  name: "Plant - Sensor Voltage"
  update_interval: 30s

If you have any more questions about it, come ask on the discord server.

peejayw commented 9 months ago

Than you, that worked, dont know how but copy and paste was my friend and my plants are grateful.

On Fri, Dec 22, 2023 at 1:48 PM Samuel Sieb @.***> wrote:

sensor:

  • platform: copy source_id: adcRaw_Sensor_Data id: "adcMoisture" accuracy_decimals: 0 unit_of_measurement: '%' filters:
    • calibrate_linear:
      • 0.37500 -> 100.0
      • 0.74023 -> 0 name: "Plant - Moisture Level"
  • platform: adc pin: A0 id: "adcRaw_Sensor_Data" accuracy_decimals: 5 name: "Plant - Sensor Voltage" update_interval: 30s

If you have any more questions about it, come ask on the discord server.

— Reply to this email directly, view it on GitHub https://github.com/esphome/issues/issues/5247#issuecomment-1867094476, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC6LPPYUI6Y24O4BZT3HCILYKTKFRAVCNFSM6AAAAABA5Z3CD6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRXGA4TINBXGY . You are receiving this because you commented.Message ID: @.***>