NEEOInc / neeo-sdk

NEEO Brain SDK
https://neeoinc.github.io/neeo-sdk/
MIT License
49 stars 17 forks source link

Virtual device POWER ON/OFF relation #35

Closed DarkCinema closed 7 years ago

DarkCinema commented 7 years ago

How are the POWER ON and POWER OFF keys defined and used in the Brain?

If I define a new (virtual) device that has only a POWER ON and POWER SUSPEND virtual key, I notice that I can not use the Power icon on the remote to power off the recipe, it just stays in the GUI.

While in the recipe you are able to define the actions when pressing power on/off anyway, so why is this actually linked with these capabilities?

Off course I can easily fix this by changing the POWER SUSPEND key and name it POWER OFF but I like to understand what/why the software is behaving this way.

neophob commented 7 years ago

Hi @DarkCinema

We use "POWER ON" and "POWER OFF" primary for the infrared devices, they send discrete commands to the target device. As Infrared provides no feedback, thats the only reliable way for us to know if a device is powered on or not.

We adapted this behavior to other devices, so your custom device needs to provide those commands that NEEO can proper power on / off the device.

There is definitive room for improvement, documentation and code wise, that this is more explicit.

Let me know if you have idea, happy to discuss here.

DarkCinema commented 7 years ago

I would like to understand why: Is this correct: In the GUI the device is show as active, only when there is a POWER ON key? If this is correct then why do this based on this key? You can trigger the ON/OFF from the automatic created recipe. Maybe set an option in the recipe to show an active device on the GUI yes/no and trigger the recipe off always when pressing the off button on the active recipe, not depending on actual keys?

neophob commented 7 years ago

Is this correct: In the GUI the device is show as active, only when there is a POWER ON key?

that's correct at the moment yes. we will add support for another capability like a "getPowerState" function which will return if the device is powered on or not. there are even more cases, for example there are always on devices (like an apple tv and sonos) - they need to handles special.

If this is correct then why do this based on this key?

why not - what's the issue with the current solution?

You can trigger the ON/OFF from the automatic created recipe.

yes, you could also trigger a discrete on/off from shortcuts or as part of another recipe.

Maybe set an option in the recipe to show an active device on the GUI yes/no

can you give me an example when this feature could be used? which device you want to power on but not display it as active now?

and trigger the recipe off always when pressing the off button on the active recipe, not depending on actual keys?

currently we know if we can power off the device - if there's a macro with the POWER OFF name. so it does not make sense to trigger a command which does not exists. Or do I miss something here?

DarkCinema commented 7 years ago

If this is correct then why do this based on this key? why not - what's the issue with the current solution?

It is not an issue, now I know how it is handled I can define the correct virtual keys or macro's. I used similar apps that use the same logic.

Maybe set an option in the recipe to show an active device on the GUI yes/no can you give me an example when this feature could be used? which device you want to power on but not display it as active now?

I did not give it much thought. In my setup I have one projector, AVR and three media-players in one room. I could create three recipes, one for each media-player. But if I then run them all I would have three active devices. In this case one recipe to power the Projector and AVR and within then select the used media-player from within the gui could be an approach, because for all three I need the Projector and AVR.

and trigger the recipe off always when pressing the off button on the active recipe, not depending on actual keys? currently we know if we can power off the device - if there's a macro with the POWER OFF name. so it does not make sense to trigger a command which does not exists. Or do I miss something here?

By this I mean if there is no POWER OFF definition, in the recipe you van tell with command is the equivalent of the POWER OFF macro.

neophob commented 7 years ago

It is not an issue, now I know how it is handled I can define the correct virtual keys or macro's. I used similar apps that use the same logic.

Thanks for the feedback, as I said we definitive need better documentation for that part

I did not give it much thought. In my setup I have one projector, AVR and three media-players in one room. I could create three recipes, one for each media-player. But if I then run them all I would have three active devices. In this case one recipe to power the Projector and AVR and within then select the used media-player from within the gui could be an approach, because for all three I need the Projector and AVR.

Today we show only the "source" device in the active now screen, this means the device where the data is coming from. audio controls can be already selected in the recipe (tv/avr). so I see a match here

By this I mean if there is no POWER OFF definition, in the recipe you van tell with command is the equivalent of the POWER OFF macro.

Why do you want to choose? Either a POWER OFF macro is present, then it will be used. You can add as much commands as you want in the power off recipe - it will be executed. The only issue we have at the moment is an UI issue, that devices without POWER OFF are not visible in the "Active now" list. but you can always power off a recipe (power key on the remote and context menu on the mobile app)

neophob commented 7 years ago

@DarkCinema anything unclear or can I close?

DarkCinema commented 7 years ago

Thanks for the info on this. You can close this.