esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
292 stars 36 forks source link

Cover Id and device_class problem #1514

Closed Bredin76 closed 4 years ago

Bredin76 commented 4 years ago

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

My configuration image

ESP (ESP32/ESP8266, Board/Sonoff):

Shelly1 - Compiled firmware as generic ESP8266 Board

ESPHome version (latest production, beta, dev branch) ESPHome Current version: 1.15.2

HA - 0.115

Affected component:

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

Description of problem: Device_class seems not to be used by home assistant

Problem-relevant YAML-configuration entries:

substitutions:
  friendly_name: Porte Garage

esphome:
  name: porte
  platform: ESP8266
  board: esp01_1m

wifi:
  ssid: !secret ssid
  password: !secret ssid_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:

captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:
  password: !secret api_password

ota:
  password: !secret api_password
  id : my_ota
  # Le 24 V n'est pas comme dans la notice de la porte. Il est sur le PP Gauche et le Stop Droit
  # il est nécessaire d'uploader fichier .yaml (le firmware) quand on crée les switch et autres. Pour ca, passer par le addon ESPHOME 
# The door contact sensor that is attached to SW on the 
# Shelly 1. Not exposed to HA, instead used to set the 
# state of the cover.
binary_sensor:
  - platform: gpio
    pin: GPIO5
    name: "Garage Door Contact Sensor"
    id: contact_sensor
    internal: true
    filters:
      - invert:

# The relay in the Shelly 1 that will deliver the pulse to
# the garage door opener (not exposed to HA)
switch:
  - platform: gpio
    pin: GPIO4
    name: "Garage Door Relay"
    id: relay
    internal: true

# This creates the actual garage door in HA. The state is based
# on the contact sensor. Opening/closing the garage door simply
# turns the relay on/off with a 0.5s delay in between.
cover:
  - platform: template
    device_class: garage
    name: "Garage Door"
    id: template_cov
    lambda: |-
      if (id(contact_sensor).state) {
        return COVER_OPEN;
      } else {
        return COVER_CLOSED;
      }
    open_action:
      - switch.turn_on: relay
      - delay: 0.5s
      - switch.turn_off: relay
    close_action:
      - switch.turn_on: relay
      - delay: 0.5s
      - switch.turn_off: relay

Logs (if applicable):

No LOG 

Additional information and things you've tried:

Device state reflect device_class is considered as default one ( shutter) and not garage, the one is configured and needed.

image Id seems problematic too cause HA doesn't reflect the one which is parametered

I tryed to paste this yaml code => failds to compile

cover:
  - platform: template
    covers:
      garage_door:
        device_class: garage
...
Bredin76 commented 4 years ago

Damn... i forgot a customize_domain...

homeassistant:
   customize_domain: #for all covers 
      cover:
      device_class: shutter