so today i was playing around with the tags! and what actually I should do, is use thet TAG as a condition,so this automation should only be ready to fire once the Door is open if the TAG was triggered. is this possible?
Going to continue to play around to see.
Because the cleaning lady will clean it and the guest may only open the door like 2 hours later or something.
wait! i think i got it! the TRIGER is the TAG, and the condition is the Door Sensor!
Going to test out this afternoon.
hello
Hope you are ok
Here is a different approach. No need for door sensor.
One card for guests and one for the cleaner.
Create two toggle switches under config/helpers
Name them
room_cleaner (initial state should be off)
room_welcome_video
Create one automation for cleaner.
When cleaner in room she scans the card.
The card sets ‘flags’ for the next automation.
- id: '1614465306585'
alias: Cleaner at room
description: ''
trigger:
- platform: tag
tag_id: 27e4b2eb-20f3-4248-a42e-25c7005e5008
condition: []
action:
- service: input_boolean.toggle
data: {}
entity_id: input_boolean.room_cleaner
- condition: state
entity_id: input_boolean.room_welcome_video
state: 'on'
- service: input_boolean.turn_off
data: {}
entity_id: input_boolean.room_welcome_video
mode: single
When she finishes cleaning she scans the card again.
A second automation for guests.
It should look like this.
The automation runs only if input_boolean.room_cleaner = off
(if cleaner forgets to scan card on way out it won’t work)
The automation will also set the input_boolean.room_welcome_video to ON, so it will run once!
- id: '1614465306585'
alias: Guests at Room
description: ''
trigger:
- platform: tag
tag_id: 84209ec1-8811-499d-8610-ef95863256dd
condition:
- condition: state
entity_id: input_boolean.room_cleaner
state: 'off'
- condition: state
entity_id: input_boolean.room_welcome_video
state: 'off'
action:
- service: webostv.command
data:
entity_id: media_player.pb_s_lg
command: system.launcher/launch
payload:
id: youtube.leanback.v4
contentId: fiwXDPufstQ
entity_id: media_player.pb_s_lg
- service: input_boolean.turn_on
data: {}
entity_id: input_boolean.room_welcome_video
mode: single
When guests leave and cleaner get to the room again it will reset the room_welcome_video switch and the automation will start over.
Hope it makes sense.
Test it and let me know
thats an amazing IDEA for me to measure how long it took here to clean the apartment! ill give it a go too! But i wanna start small for them, because of the human factor! Forgetting to scan!
i ended up wit this from the Help of @fedot
alias: Welcome Guest with TAG THE REAL DEAL
description: ''
trigger:
- platform: tag
tag_id: 539da932-1993-404d-aca7-94035ef6fee4
condition: []
action:
- wait_template: >-
{{
is_state('binary_sensor.3drt_sensor_porta_access_control_window_door_is_open','on')
}}
continue_on_timeout: false
- device_id: e772c96042b9626d85031612ac482177
domain: mobile_app
type: notify
message: Cliente Entrou Pela primeira Vez
title: 3drt
- service: media_player.turn_on
data: {}
entity_id: media_player.lg_webos_smart_tv_3
- service: script.1612486421804
data: {}
mode: single
what this does is exactly what i wanted! when she finishes her task, she scans it and after the automation keeps waiting for the door to open! Genius!
i just dont know what is the TIME OUT, so i left it false
I Just want to say thank you so much! to you and everyone! amazing community! I wish one day to contribute back!
If the WebOS command “system.launcher/launch” can be used to launch the LG Youtube app and feed it an ID…
Can system.launcher/launch start the pictures and videos LG app and feed it a video stream?? When you use the LG app on a phone, its doing something similar. Got to be some API for that?
EDIT: I also downloaded the pylgtv scripts and am having fun playing with it, but without LG API docs - I don’t think I can make it any further than just lunching the app, which we can already do in HA (change source)
Hello to everyone.
There’s someone know the payload Id for YouTube Kids?
Thanks in advance.
Hello!
The same thing happens to me using a code like yours. Youtube app opens, but no video plays.
Did you find a way to fix it?
sequence:
- service: webostv.command
data:
entity_id: media_player.pb_s_lg
command: system.launcher/launch
payload:
id: youtube.leanback.v4
contentId: >-
{{ "https://www.youtube.com/tv?v=" +
trigger.event.data.url.split(".be/")[1] }}
entity_id: media_player.pb_s_lg
Where [1] is the actual id.
Using the link from a normal browser somewhat breaks the youtube app.
Thanks, now it works!!
Is there any way to play a list randomly?
Hello!
I using a code like yours
Youtube app opens, but no video plays and error in log:
Template variable error: ‘trigger’ is undefined when rendering ‘{{ “YouTube TV” + trigger.event.data.url.split(".be/")[Ftm2uv7-Ybw] }}’
Hello. I use a script like the following to play video on Youtube:
tv_livingroom_play_music_videos:
alias: "TV salon. Reproduce videos musicales en YouTube"
sequence:
- service: webostv.command
data:
entity_id: media_player.tv_salon
command: system.launcher/launch
payload:
id: youtube.leanback.v4
contentId: "https://www.youtube.com/tv?video_id"
entity_id: media_player.tv_salon
- delay: "00:00:09"
- service: webostv.button
target:
entity_id: media_player.tv_salon
data:
button: "ENTER"
You only have to replace video_id with the id of the video you have to play. The id is the part of the URL after www.youtube.com/watch?v=
If you copy directly the URL of the video in contentId doesn’t work because you have use /tv? not /watch?v=.
The last part of the script is needed because Youtube app ask you to choose a user and that problem can be solve simulating a ENTER keypress.
Hi, this script does not work for me, youtube starts up and play video that is in the list, and the link specified in the script is not transferred to the app. I tried different options with a link, but the link is not passed to the app. I think it depends on the version of TV and YouTube app. My TV is OLED77C9PLA ver 05.10.15 and YouTube ver 1.0.99. What version do you have?
Hi, my TV is SM8500PLA, software version 05.10.15 and YouTube app version is web_20210815_10_RC00.
This isn’t currently working for me either. I have a CX model LG TV and I’m running web20211122_10_RC00 of the YouTube app.
This doesn’t appear to be an interface issue, as I can’t coax YouTube to play a particular video with directly with the pylgtv library.
The following python script:
from pylgtv import WebOsClient
webos_client = WebOsClient(tv_ip)
webos_client.launch_app_with_content_id('youtube.leanback.v4','Ix1dTGkZkqY')
will launch the Youtube App successfully, but it will not play the video at that YouTube index. If the app is already open, the script will do nothing. I’m assuming that the app has a slightly different format to the contentId now, but I can’t seem to figure out what it is. Is there any way to get information on this, either from documentation of the YouTube app or alternatively is there any way to use pylgtv to query what the YouTube app currently doing?
Looks to me like the quoting is out.
That’s just a weird typo from my copy-pasta. I fixed it. In any case, trust me, it’s not a syntax error. I can interact with the other functionality just fine, including sending contentIDs to Netflix via the ’ "m=https://www.netflix.com/watch/######"
syntax structure.
I just looked and ha does not use pylgtv, which is unmaintained. It uses GitHub - bendavid/aiopylgtv: Library to control webOS based LG Tv devices. I don’t know if that helps.
Not really. aiopylgtv
and pylgtv
have effectively identical calls to the WebOS API. The only difference appears to be that aiopylgtv
makes the calls asynchronously.
Both libraries makes identical API calls to request "ssap://system.launcher/launch"
with a set of parameters {"id": app, "contentId": contentId}
. From what I can tell in the WebOS documentation (Reference | webOS Open Source Edition), this is a standard method for calling apps with a specified content id, but the exact form of the content is specific to the app in question.
As I said before, the Netflix App responds as expected to { "id": "netflix", "contentId": "m=https://www.netflix.com/watch/#####" }
. The launch_app_with_content_id
method passes these values as a tuple to the actual request. After some poking around on the internet, it appears as though the YouTube App will now respond to { "id":"youtube.leanback.v4", "contentId":"https://www.youtube.com/tv?v=9bZkp7q19f0"}
. However, if you do it this way, the app will always prompt to ask you which account is watching.
Whilst I’m aware that you could hack the Home Assistant automation to wait and click a button, I believe there is a more straightforward way. Looking at the public void launchYouTube
method in this Java library I found makes me believe that you can add &pairingCode=****
to the contentId and have the YouTube app simply launch a program directly. However, I don’t know where to find this pairing code.
Any suggestions?