[solved] Lovelace card w. automation & state_image from another switch?

Hi all

Is it possible to have a lovelace card that triggers an automation and change the presentation of the card based on the status of another switch?

I don’t have a clue how to use the status of another, also KNX, switch which is a different the one that has to be triggered by the automation.

I know a picture entity card solves the first part but what about the status?

Thanks in advance!
Nick

Nobody?
To obvious, to difficult, not possible, not clear ???

You can trigger automations with the automation.trigger service. The second half of your question is ambiguous. What do you mean “presentation”.

Also, picture entity doesn’t really have anything to do with this, unless that’s what you mean by presentation.

As for changing cards based on states of items, many cards have a build in ‘state’ clauses that change things on the card in question. There’s also entity_filter cards that filters out items on your card. There’s conditional card that will conditionally display the card. And that’s just the built in cards. When you start going custom, the options are endless.

My recommendation: State exactly what you want with explicit instructions on what you expect.

Hi petro, thank you for your help!

Sorry for not being clear, will try to shed some light.
I need Lovelace cards that control stuff to use short pulses (lights/gates/curtains are controlled by traditional relays, installed 17y ago, and to difficult to change).
Since there is not a button card (yet) that sends pulses, I’m using automations triggered by a Lovelace card.
These automations call the switch on/off service with a delay to simulate a pulse, which trigger switch ‘A’.
So far, this works.

I have state addresses coming, from let’s say switch ‘B’, which represent the actual state because switch ‘A’ has gone to it’s original state after that pulse.
How can I use the state of switch ‘B’ to represent the actual state/image of the Lovelace card that controls switch ‘A’ (through the pulse automation)?

I hope I am more clear now…

Change the tap_action to call service and call automation.trigger with the proper service_data. Have the entity be switch ‘b’ for the picture card.

type: picture-entity
entity: switch.b
state_image:
  'a': /local/blah.png
  'b': /local/blahhhh.png
tap_action:
  action: call-service
  service: automation.trigger
  service_data:
    entity_id: automation.xxxx
1 Like

THANK YOU!!! :+1:

Now that I see the code it’s so obvious… :blush:
I honestly had no clue that you can use a different entity as the main one and refer to another in the automation.

1 more thing: the ‘a’ and ‘b’ in the state_image of your code; in the documentation ‘on’ and ‘off’ is being used.
Did you put ‘a’ and ‘b’ between quotes because it can be anything or because it’s needed for functionality?

you need the quotes if you want to use on and off because yaml will naturally translate them to True/False.

Is there anything else then on/off that can be used as the state image since you typed a/b in your example?

Yes, you can use any state. The correct image should appear as long as the state of the device matches the state placed in that list.