59 lines
1.1 KiB
Nix
59 lines
1.1 KiB
Nix
|
{
|
||
|
action = rec {
|
||
|
callService = service: entity: {
|
||
|
service = service;
|
||
|
target.entity_id = entity;
|
||
|
};
|
||
|
|
||
|
delayed = f: delay: [
|
||
|
{delay.seconds = delay;}
|
||
|
(f)
|
||
|
];
|
||
|
|
||
|
turnOn = entity: callService "homeassistant.turn_on" entity;
|
||
|
turnOff = entity: callService "homeassistant.turn_off" entity;
|
||
|
};
|
||
|
|
||
|
condition = {
|
||
|
state = entity: state: {
|
||
|
condition = "state";
|
||
|
entity_id = entity;
|
||
|
state = state;
|
||
|
};
|
||
|
|
||
|
stateNot = entity: state: {
|
||
|
condition = "not";
|
||
|
conditions = [{
|
||
|
condition = "state";
|
||
|
entity_id = entity;
|
||
|
state = state;
|
||
|
}];
|
||
|
};
|
||
|
};
|
||
|
|
||
|
trigger = {
|
||
|
state = entity: {
|
||
|
platform = "state";
|
||
|
entity_id = entity;
|
||
|
};
|
||
|
|
||
|
stateFrom = entity: stateFrom: {
|
||
|
platform = "state";
|
||
|
entity_id = entity;
|
||
|
from = stateFrom;
|
||
|
};
|
||
|
|
||
|
stateTo = entity: stateTo: {
|
||
|
platform = "state";
|
||
|
entity_id = entity;
|
||
|
to = stateTo;
|
||
|
};
|
||
|
|
||
|
stateNotTo = entity: stateNotTo: {
|
||
|
platform = "state";
|
||
|
entity_id = entity;
|
||
|
not_to = stateNotTo;
|
||
|
};
|
||
|
};
|
||
|
}
|