Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Use card in conditional card #24

Open
GunnarBjoru opened this issue May 31, 2021 · 2 comments
Open

Use card in conditional card #24

GunnarBjoru opened this issue May 31, 2021 · 2 comments

Comments

@GunnarBjoru
Copy link

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
Copy link

ejpenney commented Jun 13, 2021

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
Copy link
Owner

@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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants