This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
The Homey Community has been moved to https://community.athom.com.
This forum is now read-only for archive purposes.
Youtube app
I am planning to create a simple Youtube app, which enables us playback youtube video.
For now this is an extension to chromecast app https://github.com/matjaz/com.google.chromecast/tree/rewrite
I am planning to create following
triggers
- youtube media changed (have url token)
actions
- search youtube (have query argument); triggers change
- get playlist (first, one random, all, all shuffle); triggers change
- play music on Homey (future... when media manager is documented/working)
Because how flows currently work, we need two flows for that.
1.
- when say something (text ->)
- search youtube (-> text)
2.
- when youtube media changes (url ->)
- cast media to chromecast (-> url)
We could use (global) variables, but that needs variables API as I suggested.
Maybe we could add global app events (with new built in general trigger onAppEvent(app, event))
Or implement more advanced actions as suggested here.
Thoughts & suggestions welcome!
For now this is an extension to chromecast app https://github.com/matjaz/com.google.chromecast/tree/rewrite
I am planning to create following
triggers
- youtube media changed (have url token)
actions
- search youtube (have query argument); triggers change
- get playlist (first, one random, all, all shuffle); triggers change
- play music on Homey (future... when media manager is documented/working)
Because how flows currently work, we need two flows for that.
1.
- when say something (text ->)
- search youtube (-> text)
2.
- when youtube media changes (url ->)
- cast media to chromecast (-> url)
We could use (global) variables, but that needs variables API as I suggested.
Maybe we could add global app events (with new built in general trigger onAppEvent(app, event))
Or implement more advanced actions as suggested here.
Thoughts & suggestions welcome!
Comments
Like what I am doing with Youtube and Chromecast app. You need two flows; 1. to make a youtube search and 2. for search result to play on Chromecast.
Thank you!
I managed to get a video played only by voice. But I guess the "Resume listening" flow card does not work yet, I have to say "Ok Homey" again to trigger the 2nd flow.
Here is a short description of an app.
Youtube app
Chromecast app
Hope this explains it.
Just for testing purposes I created three flows. I will describe the flows below to show other people what is possibel with these apps:
Flow 1: When on is pressed on the KaKu remote get Youtube playlist and play first song
Flow 2: When Youtube media changed cast url on Chromecast
Flow 3: When off is pressed on the KaKu remote get Youtube playlist and shuffle (play random) song
So now I can use my KaKu remote (or any other remote) to control my jukebox during parties .
Two questions/remarks:
- Is it possible to keep the playlist running until I want it to stop? I have to click the off button on the KaKu remote after the end of every song.
- The field in which you have to enter the url is too small and does not size good in the Homey flow cards.
Exemple i say; he homey Youtube Adele - Hello, and i can filter "Youtube". so it searches for "Adele Hello" instead of "Youtube Adele Hello"
(like couchpotato app)
When i copy your flows homey react on flow 2 immediately (because of "when you say anything")
is there a way you can enable flow 2 only if flow1 ended? could't find how, can't drag "flow" in "when" section.
Thank you so much for making this!
I'd like a speech command to trigger a flow playing a YouTube playlist on a chromecast device. What flow(s) do I need for this to work? This is what I currently have (2 flows):
Is this correct?
Since you selected First only first item from playlist will be played. "Next" plays all in order, shuffle will play random item. Since 0.2 playlists also supports autoplay.
Playlist URL should be in the following format https://www.youtube.com/playlist?list=PLueiy8sWqybzUoXf0gD4MXpTJDsiNgdyi
What do you have?
Try with some debug flow notification to see what text you get from speech.
Also added more lax speech commands:
- "watch Adele from YouTube"; triggers "YouTube media changed"
- "play Adele from YouTube"; plays music on Homey
You can also skip "from".@MatjaLipu What does this do in your app.json?
"fluidArgs": true
@MatjaLipu Running the YouTube app locally now. It throws this exception after activating the first flow through speech:
Archiving...
Uploading to 192.168.2.xxx.yy...
Running `com.youtube`...
Debugging...
YouTube ready
[Error: Cannot read property '0' of undefined]
And at seconds attempt:
TypeError: Cannot read property 'length' of undefined
at selectNextInPlaylist (/lib/playlist.js:59:63)
at Object.onFlowActionPlayListItems (/lib/playlist.js:28:5)
at Object.emit (events.js:118:17)
at /opt/homey-client/system/types/manager/apps/bootstrap/homey-app/manager/f
low.js:1:188
at /opt/homey-client/system/types/manager/apps/bootstrap/homey-app/helpers/c
lient.js:1:852
at Array.forEach (native)
at process.<anonymous> (/opt/homey-client/system/types/manager/apps/bootstra
p/homey-app/helpers/client.js:1:821)
at process.emit (events.js:110:17)
at handleMessage (child_process.js:324:10)
at Pipe.channel.onread (child_process.js:352:11)
@MatjaLipu Would you mind trying it yourself? I can't seem to understand the flow of your code. It has something to do with the playlist. Maybe with caching?
At first my playlist was private, which I changed to unlisted. Still didn't work. This is my playlist id: PLCnbzXkuy4_ZnobZc2viz1qncZ9UGXkba
Thanks for looking into this.