eelcohn / home-assistant-rdw

RDW sensor module for Home Assistant
7 stars 2 forks source link

Insured as a binary sensor #7

Closed metbril closed 4 years ago

metbril commented 4 years ago

Currently, the Insured state is a sensor and not a binary_sensor. For automations etc. it would be preferable to create the sensor as a type binary_sensor, so it can be used for logical comparisions. Using this, will also allow it to be displayed in our local language Dutch, since the True/False or On/Off etc. get translated. We can even use the device class type for sensors:

https://www.home-assistant.io/docs/configuration/customizing-devices/#device_class

My current workaround is to create an extra template binary sensor:

binary_sensor:
  - platform: template
    sensors:
      niro_insured:
        friendly_name: "Niro Insured"
        entity_id: sensor.niro_insured
        value_template: "{{ is_state('sensor.niro_insured', 'True') }}"
eelcohn commented 4 years ago

Thank you for your feedback. I agree that binary_sensor would be better. I'll add it in a new release, but it's probably gonna take till the new year before I get to program this though.

eelcohn commented 4 years ago

Implementing this would mean moving away from setting up the RDW component as:

sensor:
  - platform: rdw
    plate: 16RSL9
    sensors:
      - expdate
      - insured
      - recall

to something like this:

rdw:
  - plate: 16RSL9
    binary_sensors:
      - insured
    sensors:
      - expdate
      - recall

I'll have to look into this if and how I want to do this.

metbril commented 4 years ago

An alternative would be like other integrations to use 'monitored_conditions' instead of 'sensors'. For example Dark Sky, Buienradar or Luftdaten.

eelcohn commented 4 years ago

This is fixed in the latest release of the RDW platform (v2.9.0). I've just pushed it to the github repository.