akasma74 / Hass-Custom-Alarm

It is a fork of "Yet another take on a home assistant custom alarm" that will exist until its author is back to our Earth
80 stars 31 forks source link

Trigger seems to fail with virtual sensor (platform template) #68

Closed Extreme79 closed 4 years ago

Extreme79 commented 4 years ago

Your components (from Alarm/Settings/About):

Platform & Browser:

Describe the bug virtual sensor seems do not trigger the alarm. For testing pourposes (not physical devices yet) I created 2 virtual switches (input boolean), "virtual door" and "virtual siren", and a virtual door sensor. Virtual door sensor added to the alarm. With off virtual door switch the door sensor is closed, with on virtual switch the door sensor is opened.

Expected behavior I expect an alarm trigger when manually turning the virtual door switch on. This not happen.

input_boolean:
  virtual_door:
    name: switch Porta
    initial: off
    icon: mdi:door
  virtual_siren:
    name: Sirena Virtuale
    initial: off
    icon: mdi:eye

sensor:    
- platform: template
  sensors:
    virtual_door_sensor:
      value_template: >
        {{ 'opened' if is_state('input_boolean.virtual_door', 'on')
           else 'closed' }}
      friendly_name: 'Porta virtuale'

I'm wrong in something or it's really a bug? Has to set on and off for teh sensor value? true/false?

akasma74 commented 4 years ago

It does not matter if your sensor is physical or virtual, that's its state that matters. Have a look at the standard states Your one is not there, that's why there is no reaction.

For future reference, you need to configure custom_supported_statuses_on and custom_supported_statuses_off for non-standard sensor states.

p.s there is no such thing as "latest version of XXX".

Extreme79 commented 4 years ago

Thank you, this clarify me a lot of things, also for the future.

p.s there is no such thing as "latest version of XXX". You are right, because I've not specified if I'm on stable or beta, what os, nothing. I'll be more precise in the future, sorry.

akasma74 commented 4 years ago

No worries at all, happy to help. I'm closing this issue now (in the future you can do it yourself if you feel like it's resolved ;)