Hello, I am brand new to Home Assistant.
I am currently in the process of rebuilding all my automations from openHAB.
So far I have managed very well.
That was my code for openHAB:
var String WZ_Multimedia_HarmonyHub_1_Momentan
rule "Tv Steckdose Automatik"
when
Item WZ_Multimedia_HarmonyHub_1_Aktuell changed
then
if( WZ_Multimedia_HarmonyHub_1_Aktuell.state != 'PowerOff' ) {
WZ_Steckdose_1_AnAus.sendCommand(ON)
}
else
createTimer(now.plusSeconds(15))[|
WZ_Steckdose_1_AnAus.sendCommand(OFF)]
end
rule "TV Fernsehen wiederholen Harmony"
when
Item WZ_Multimedia_HarmonyHub_1_Aktuell changed
then
WZ_Multimedia_HarmonyHub_1_Momentan = WZ_Multimedia_HarmonyHub_1_Aktuell.state.toString
//if( WZ_Multimedia_HarmonyHub_1_Aktuell.state == '[TV] Fernsehen' ) {
createTimer(now.plusSeconds(15)) [|
WZ_Multimedia_HarmonyHub_1_Aktuell.sendCommand(WZ_Multimedia_HarmonyHub_1_Momentan)]
createTimer(now.plusSeconds(30)) [|
WZ_Multimedia_Harmony_TV.sendCommand('PowerToggle')]
//}
end
I want to switch on a socket as soon as I start an activity on the Harmony. As the devices need a short time, I would like to send the same command again after a delay of 15 seconds, as before.
alias: Wohnzimmer TV Steckdose
description: ""
trigger:
- platform: state
entity_id:
- select.wohnzimmer_activities
from: power_off
to: null
id: TV an
- platform: state
entity_id:
- select.wohnzimmer_activities
from: null
to: power_off
id: TV aus
condition: []
action:
- choose:
- conditions:
- condition: trigger
id:
- TV an
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.wz_steckdose_1_tv
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: select.select_option
data: {}
target:
entity_id: select.wohnzimmer_activities
- conditions:
- condition: trigger
id:
- TV aus
sequence:
- delay:
hours: 0
minutes: 0
seconds: 15
milliseconds: 0
- service: switch.turn_off
data: {}
target:
entity_id: switch.wz_steckdose_1_tv
mode: single
The only thing missing here is the command that sends the current status of the HarmonyHub again as a command.
Thank you for your help