Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Support Favorites for SDK devices #52

Open
1 of 3 tasks
barnabycourt opened this issue Nov 15, 2017 · 17 comments
Open
1 of 3 tasks

[Feature Request] Support Favorites for SDK devices #52

barnabycourt opened this issue Nov 15, 2017 · 17 comments

Comments

@barnabycourt
Copy link

barnabycourt commented Nov 15, 2017

I would like the ability to dynamically add & remove buttons from a device. Currently I have to restart the node server & rebuild the device. I would like to be able to do this on the fly while the server is running.

The reason for this is to accommodate Devices such as a Roku where channels can be added & removed dynamically. I would like to be able to periodically poll the channel listing from my node service and update the available channels as buttons available to the NEEO without restarting the driver & re-creating the device.

(edited) status:

  • Favorites as callbacks from the Brain, without custom source or list.
  • Expose custom favorite search results to the Brain
  • Favorites not managed on Brain
@neophob
Copy link
Contributor

neophob commented Nov 15, 2017

Thanks @barnabycourt for your input.

Can you explain what roku channels are and how you plan to use it? it looks like an "app" on the apple tv - how you can select such a channel?

BR

@barnabycourt
Copy link
Author

@neophob These are very much like "apps" on apple tv. Someone can add a new channel/app via the roku search and then the next time neeo driver can retreive the updated app list and create new favorite's buttons for each app.

@neophob
Copy link
Contributor

neophob commented Nov 15, 2017

I see - something like the current favorite channels you can choose (tv or dvb)

@barnabycourt
Copy link
Author

Exactly, When I query the Roku I get a list of all the available apps/channels (amazon, Netflix, Hulu, etc.) I want to dynamically create buttons for each app

@Krikroff77
Copy link

+1 I also definitely need this feature

I finishing a driver to handle the scenes on Fibaro Home Center 2 & Lite (Home automation box) and i would like to be able to added and removed dynamically buttons / switches.

Regards

@neophob
Copy link
Contributor

neophob commented Nov 16, 2017

Just to be sure for the Roku use case, so you can request this list of apps/channels. each of this list items have something like a unique id that can be sent to roku and that item will be activated?

Example:

  • get list from roku (curl http://192.168.1.134:8060/query/apps)
<apps>
  <app id="11">Roku Channel Store</app>
  <app id="12">Netflix</app>
  <app id="13">Amazon Video on Demand</app>
  <app id="14">MLB.TV®</app>
  <app id="26">Free FrameChannel Service</app>
  <app id="27">Mediafly</app>
  <app id="28">Pandora</app>
</apps>
  • activate 'netflix' by sending a rest request to roku (curl -d '' 'http://192.168.1.134:8060/launch/11?contentID=12')

that would be the complete example, right?

@barnabycourt
Copy link
Author

That is correct. The full details of the Roku API can be found at https://sdkdocs.roku.com/display/sdkdoc/External+Control+API#ExternalControlAPI-query/appsExample. For reference, I am using the nodeku library for discovery & app launching in my particular driver: https://github.com/barnabycourt/neeo_driver_roku

@neophob neophob changed the title [Feature Request] Add ability to dynamically add/remove buttons to a running device [Feature Request] Support Favorites for SDK devices Nov 16, 2017
@neophob neophob mentioned this issue Nov 16, 2017
@gvdhoven
Copy link

Copied from beta section: https://planet.neeo.com/t/q553a9

I have written a DVB driver, for the Netherlands i would like to expose a set of default favorites (e.g. channels of Dutch television); would be cool if there was a 'setupFavorites' mapping in the deviceBuilder with channel name (and/or logo) and number for example.

Same goes for shortcuts btw, a custom driver might want to give a head-start to a user.

Does this fall into this feature request?

@neophob
Copy link
Contributor

neophob commented Jun 1, 2018

absolutly

@gvdhoven
Copy link

gvdhoven commented Jun 1, 2018

Thanx @neophob would be even cooler if the device driver would be able to dynamically change the favorites, e.g. depending on time of day a childrens channel might not be 'on air'.

@neophob
Copy link
Contributor

neophob commented Jun 1, 2018

Yes I see multiple use cases:

  • favorites for dvb devices
  • scenes for lamps
  • favorite movies (think about kodi)

and so on

@pfiaux
Copy link
Contributor

pfiaux commented Aug 3, 2018

As discussed in #123 the favorite feature should be flexible to accommodate different scenarios:

  • Favorites as callbacks from the Brain, without custom source or list.
    • using the built in favorites search and channel list
  • Expose custom favorite search results to the Brain
    • optionally disable the default favorites
    • still use the interface to set numbers and manage added favorites
  • Favorites not managed on Brain
    • Disable the interface to search and add favorites
    • Expose a callback to fetch list of favorite images/ids
      • ideally this could use a sensor to further make them dynamic
    • App/remote then simply display the favorites exposed by the device

The API might then look like

.enableFavorites({
  useDefaultSearch: true, // enable/disable the default search results
  customSearch: (query) => {...} // optional some callback to search
  useChannelNumbers: true, // disable to use only ids
                                               // user can add favorites but no need to manually assign numbers?
  customFavorites: () => {...} // optional if used fetches favorites from driver, instead of Brain
                                              // this would also need a sensor to track if they change and refresh on Brain
  favoriteHandler: (id) => {...} // Callback when a favorite is called with id or channel number as string.
})

@pfiaux
Copy link
Contributor

pfiaux commented Dec 10, 2018

First version of this feature will only cover the favorite handler callback (search and get/set will still be done on the Brain). Most likely this will be the API:

.registerFavoriteHandlers({
  execute: (deviceId, channelNr) => { ... },
});

So if a favorite on the Brain for channel 42 is called the channelNr will be '42' allowing the SDK implementation to split, delay, add pre/postfix commands as needed. The Brain wont send DIGIT 4 and DIGIT 2 button commands anymore if this is enabled for that device.

@carp3-noctem
Copy link

@pfiaux Sounds nice, will the channel number be validated as number? or can it also be annother action (script, url-call, callback, ...).
As far as i understand your posting, this means, only the available (currently in NEEO Favorites DB) stored Images will be accessible and must be user defined, or can this also be done via SDK?

Or does this only send the "user defined Numbers" back to the SDK to let the SDK handle the Commands (e.g. User gets favorites CH30, NEEO doesn't send IR Commands but calls SDK "FAV30" is pressed, and SDK can handle NEEO Send TCP/IP 3, TCP/IP 0 TCP/IP Enter) or any other thing like open app Netflix.

Sorry if i don't get it.
Hope one Day this is full flexible also with providing Channel Logos through the SDK and Custom Commands in background and expose this to the NEEO as "Favorites Page" So you can display a list of recordings with Pictures or something like that ;-) (i know that this is not the intention of the Favorites Page, but until the Listview can be selected as Page on NEEO)

@pfiaux
Copy link
Contributor

pfiaux commented Dec 11, 2018

Currently the channel number will be the numbers defined in the app by the user when adding the favorites, which allows numbers and some separators, however no script/url at the moment. Here's some examples for a favorite to channel 42:

Currently:

  1. Favorite 42 is triggered
  2. Brain sends 'DIGIT 4' to SDK button handler
  3. Brain sends 'DIGIT 2' to SDK button handler

With new optional handler:

  1. Favorite 42 is triggered
  2. Brain sends '42' to SDK favorite handler

That's the first part of the feature. Possible future steps as outlined above could be:

  • Custom SDK provided favorites:
    • No management of favorites in the NEEO app
    • Favorites for the device are fetched from the SDK, this could include urls for the images.
  • More advanced SDK provided "channels" database:
    • Management of favorite searches goes through SDK instead of NEEO defaults
    • User might or not need to define the channels in that case (maybe both options or maybe none)

@gvdhoven
Copy link

@pfiaux nice one, however the api is now different between the button handler and the favorite handler, is that correct? pseudo implementation:

.addButtonHandler((button, serialNumberOrUniqueId) => {
		MediaboxManager.ButtonPressed(serialNumberOrUniqueId, button);
	})
	.registerFavoriteHandlers({
		execute: (serialNumberOrUniqueId, favoriteId) => {
			MediaboxManager.FavoritePressed(serialNumberOrUniqueId, favoriteId);
		}
	})

@pfiaux
Copy link
Contributor

pfiaux commented Feb 18, 2019

@webunity that looks right, button has had the parameters flipped for backwards compatibility reasons that remains. Most other callbacks will use deviceId first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

6 participants