elric91 / homeassistant_zigate

Custom components for Home Assistant
MIT License
22 stars 5 forks source link

Add support for binary_sensor #15

Open ruimarinho opened 6 years ago

ruimarinho commented 6 years ago

I think ideally the Xiaomi Door Sensor should behave as a binary_sensor instead of the suggested config as a switch as there is no action available - it would either report as open or closed.

elric91 commented 6 years ago

Yes I'm thinking about it You can already configure it as one, but you loose all the advantages related to the switch behavior and representation

Neraud commented 6 years ago

A binary_sensor can be typed to represent a door using a device_class : https://home-assistant.io/components/binary_sensor/

ruimarinho commented 6 years ago

I'm using this as an alternative:

- platform: template
  sensors:
    main_door_binary_sensor:
      value_template: "{{ is_state('sensor.main_door', 'on-press') }}"
      device_class: door
      entity_id: sensor.main_door

I don't think it would work out of the box, would it?

- platform: zigate
  sensors:
    main_door_binary_sensor:
      device_class: door
      entity_id: sensor.main_door

@elric91 - thanks for the great work on this component.