Problem is I want to give my computer time to switch to live tv before entering the channels. So I don’t want to delay each individual item, but just basically like:
Rather than having to set the variable and value and then use the variable down below like the example says:
**delay'**
** fields:**
** minutes:**
** description: 'The amount of time to wait before turning on the living room lights'**
** example: 1**
sequence:
# This is Home Assistant Script Syntax
- event: LOGBOOK_ENTRY
event_data:
name: Paulus
message: is waking up
entity_id: device_tracker.paulus
domain: light
- alias: Bedroom lights on
service: light.turn_on
data:
entity_id: group.bedroom
brightness: 100
**- delay:**
** # supports seconds, milliseconds, minutes, hours**
** minutes: {{ minutes }}**
Now nothing in that page you pointed to mentions commands specifically so maybe not compatible within a command list?
Thanks, have to see what is causing this error in the below.
Error
Error executing service <ServiceCall script.abc (c:9252ce047002457aa8bfd1c7afed1438)>
7:06:33 PM – core.py (ERROR)
Error executing script script.abc. Invalid data for call_service at pos 1: value should be a string @ data['command'][1]
7:06:33 PM – Script (ERROR)
Oh, sorry, I misread. You’re right, you can’t put a delay as one of the commands for remote.send_command. But you should be able to make it work with multiple service calls. I think you want something like this:
I just thought of a flaw in my original logic. I really only want the delay to happen when I’m either watching my media on Emby or Plex or doing anything else other than watching LiveTv. So if I’m already watching TV then don’t want the delay, but if I have to switch into it then would want it. But looking at what’s available within HA for the Harmony, I do not think there is a way to see what command was sent like this as it’s not an Activity and even an Activity I’m not sure I can tell what Activity I’m currently in thru HA.
I’m not at all familiar with the Harmony platform, but reading through the docs for it at https://www.home-assistant.io/integrations/harmony/ suggests that your remote.familyroom_hub entity might have a current_activity attribute that you can check to see what it’s doing? It might be as simple as using a template to check if current_activity is “LiveTv”. I can’t test it, but maybe something like
# Delay 1 second if LiveTV is active, 120 seconds otherwise. Maybe.
- delay:
seconds: >
{% if state_attr("remote.familyroom_hub", "current_activity") == "LiveTv") %}
1
{% else %}
120
{% endif %}
Yeah I do use that for other things. Only problem with that is it only knows what “Activity” you are in. For me that is basically:
Run the XBox
Play some music
The problem with that is the Activity is Run the XBox, not LiveTv. It launches the XBox and then I can navigate to LiveTV or play movies on Emby or use the local Recorded TV but those are buttons on Emby I can click to get to different things but not an Activity in the Harmony sense.
Now if there was a way to get from the XBox if it’s in those states then maybe but I can’t even ping this thing to see if it’s up let alone that.