DurgNomis-drol / google_home_timers_card

Card for Home Assistant Google Home integration.
MIT License
34 stars 16 forks source link

Use card in conditional card #24

Open GunnarBjoru opened 3 years ago

GunnarBjoru commented 3 years ago

First of all, thank you for making this nice card.

I was trying to use the card in a conditional card but found that OR statement is not possible in conditions. I find this difficult to do since I have to choose either alarm or timer as condition.

I have a google home units and would only show the card if it has a timer OR an alarm. I have tried to make two separate conditional cards which works fine until I have both an alarm and a timer running. Then I get two equal cards which is not that nice.

If I could get an option to not show both alarms and timers I think it would be better.

ejpenney commented 3 years ago

Just my two cents, but I think this enhancement would be better suited to the Conditional Lovelace card as its the one with the limitation, it probably should have an "operator: and/or" option or something. That said, you can get this to work by creating a binary_sensor that toggles based on both states, with the template platform in configuration.yaml like so:

  - platform: template
    sensors:
      kitchen_timers:
        friendly_name: "Kitchen Alarms/Timers"
        value_template: '{{ states("sensor.kitchen_speaker_timers") != "unavailable" or states("sensor.kitchen_speaker_alarms") != "unavailable" }}'

Then set your card to use the binary_sensor like so:

type: conditional
conditions:
  - entity: binary_sensor.kitchen_timers
    state: 'on'
card:
  type: custom:googletimers-card
  entity: sensor.kitchen_speaker_timers
  alarms_entity: sensor.kitchen_speaker_alarms
  title: Kitchen
DurgNomis-drol commented 3 years ago

@GunnarBjoru

Sorry for the late answer. I am not able to continue this project, though i would love to. But the underlying integration does not work for me unfortunately anymore.

@ejpenney Solution should work and i agree that the built in conditional card should be updated to handle the and/or scenario. I was working on a solution for this card, but the hole thing came to a stand still because of the problems i have.