water_escape schreef op dinsdag 16 februari 2021 @ 11:42:
alles is gelukt so far,
input_boolean, aan en uit scene en de automation.
lampen gaan aan. maar nog niet uit als ik er weer op klik...
YAML:
1
2
3
4
5
| type: 'custom:button-card'
tap_action:
action: toggle
entity: input_boolean.lego
name: Lego |
YAML:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| alias: Lego aan/uit
description: ''
trigger:
- platform: state
entity_id: input_boolean.lego
condition: []
action:
- condition: state
entity_id: input_boolean.lego
state: 'on'
- service: scene.turn_on
data: {}
entity_id: scene.lego_aan
- condition: state
entity_id: input_boolean.lego
state: 'off'
- service: scene.turn_on
data: {}
entity_id: scene.lego_uit
mode: single |
[...]
Kijk even beter naar mijn voorbeeld. Wat je nu hebt gedaan is conditions in de action opgenomen. Dat kán wel, maar zorgt ervoor dat de volgende actions alleen uitgevoerd worden als de condition waar is. Dus, in stapjes:
Uitgangspositie: lamp aan, input_boolean.lego aan
- Je drukt op knop, input_boolean.lego gaat naar off
- Automation triggert (want input_boolean.lego wijzigt van state)
- Eerste stap in de actions is "check of input_boolean.lego status 'on' heeft --> nee --> abort
Dat verklaart ook waarom het andersom wel werkt:
Uitgangspositie: lamp uit, input_boolean.lego uit
- Je drukt op knop, input_boolean.lego gaat naar on
- Automation triggert (want input_boolean.lego wijzigt van state)
- Eerste stap in de actions is "check of input_boolean.lego status 'on' heeft" --> ja --> continue
- Tweede stap: zet scene.lego_aan aan
- Derde stap: "check of input_boolean.lego status 'off' heeft" --> nee --> abort
Om dit te fixen heb ik in mijn voorbeeld gebruik gemaakt van "choose", dat is een speciale action die kiest op basis van conditions.
[
Voor 3% gewijzigd door
Hmmbob op 16-02-2021 12:16
]