esphome / issues

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

Validation Error Binary_Sensor [Solved] #247

Closed RDG88 closed 5 years ago

RDG88 commented 5 years ago

Operating environment/Installation (Hass.io/Docker/pip/etc.):

Hass.io on CentOS 7 with the latests stable release of addon ESPHome ESP (ESP32/ESP8266, Board/Sonoff):

esp8285 Affected component:

https://esphome.io/components/binary_sensor/index.html

Description of problem:

When i try to add the following to the YAML (switch): on_press: then:

INFO Reading configuration... WARNING The esphomeyaml section has been renamed to esphome in 1.11.0. Please replace 'esphomeyaml:' in your configuration with 'esphome:'. INFO Detected timezone 'CET' with UTC offset 1 and daylight savings time from 03/31/19 02:00:00 to 10/27/19 03:00:00 Failed config

binary_sensor.gpio: platform: gpio pin: number: 3 inverted: True name: energy_2_button on_press:

Problem-relevant YAML-configuration entries:

substitutions:
  plug_name: energy_2
  # Higher value gives lower watt readout
  current_res: "0.00221"
  # Lower value gives lower voltage readout
  voltage_div: "955"

esphomeyaml:
  name: ${plug_name}
  platform: ESP8266
  board: esp8285

wifi:
  ssid: 'myssid'
  password: 'mypassword'
  manual_ip:
    # Set this to the IP of the ESP
    static_ip: 192.168.2.96
    # Set this to the IP address of the router. Often ends with .1
    gateway: 192.168.2.254
    # The subnet of the network. 255.255.255.0 works for most home networks.
    subnet: 255.255.255.0

# Enable logging
logger:

# Enable Web server
web_server:
  port: 80

# Enable Home Assistant API
api:
  password: 'mypwd'

ota:
  password: 'mypwd'

time:
  - platform: homeassistant
    id: homeassistant_time

binary_sensor:
  - platform: gpio
    pin:
      number: GPIO3
      inverted: True
    name: "${plug_name}_button"
    on_press:
      then:
        - switch.toggle: "${plug_name}_Relay"
switch:
- platform: gpio
  name: "${plug_name}_Relay"
  pin: GPIO14
  restore_mode: ALWAYS_ON
- platform: gpio
  name: "${plug_name}_LED_Blue"
  pin: GPIO1
  inverted: True
  restore_mode: ALWAYS_OFF
- platform: gpio
  name: "${plug_name}_LED_Red"
  pin: GPIO13
  inverted: True
  restore_mode: ALWAYS_OFF
sensor:
  - platform: hlw8012
    sel_pin:
      number: GPIO12
      inverted: True
    cf_pin: GPIO04
    cf1_pin: GPIO05
    current_resistor: ${current_res}
    voltage_divider: ${voltage_div}
    current:
      name: "${plug_name}_Amperage"
      unit_of_measurement: A
    voltage:
      name: "${plug_name}_Voltage"
      unit_of_measurement: V
    power:
      name: "${plug_name}_Wattage"
      unit_of_measurement: W
      id: "${plug_name}_Wattage"
    change_mode_every: 8
    update_interval: 10s
  - platform: total_daily_energy
    name: "${plug_name}_Total Daily Energy"
    power_id: "${plug_name}_Wattage"
    filters:
        # Multiplication factor from W to kW is 0.001
        - multiply: 0.001
    unit_of_measurement: kWh

# Extra sensor to keep track of plug uptime
  - platform: uptime
    name: ${plug_name}_Uptime Sensor

Traceback (if applicable):

Not possible to flash over USB, but seems not to be the problem because the validation already failed

Additional information and things you've tried:

Been adjusting the config, tried the direct name instead of the template but still won't validate.

RDG88 commented 5 years ago

Im sorry, i did not include ID: for the switch, once defining ID: it validates correctly.