i8beef / node-red-contrib-castv2

MIT License
22 stars 14 forks source link

Listen to changes #21

Closed hgghyxo closed 4 years ago

hgghyxo commented 4 years ago

Is there a way to implement a listener to this node? My intention would be if I start to play something on my chromecast, or google mini, node-red would be able to respond to it.

Like casting a video to chromescast should automatically turn on TV. To accomplish this I need an active listener, which watches the current status.

( I have a very similar implementation, where homeautomation watches the cast devices, and updates it's internal status, then an other package reads the states from HA and transfers it to NodeRed. However I want to get rid of HA, and this functionality keeps it back)

Thank you

i8beef commented 4 years ago

No, as it does not maintain an open connection. You'd have to poll on an interval.

i8beef commented 4 years ago

3.0.0, which should be live, should allow for this now. You can specify a connection that is kept open now and should stay connected to the cast target. When that cast target gets status messages from a receiver it should now publish that state out so you can use it to trigger other stuff.

I still need to put in a state publish of some sort for platform changes (i.e., on app open / close, volume changes, etc.), but for now this new style should give you a good idea of where its going.

i8beef commented 4 years ago

I added an event that gets fired off on platform changes too to cover that hole.

i8beef commented 4 years ago

Resolved in 3.0.0, please let me know if you have issues!

hgghyxo commented 4 years ago

Thank you very much for implementing this, already testing the changes, will submit you some feedbacks if find something ;)