unfoldedcircle / feature-and-bug-tracker

Feature and bug tracker repository for Unfolded Circle products
25 stars 0 forks source link

Activity groups #64

Closed martonborzak closed 11 months ago

martonborzak commented 1 year ago

Activity groups

Activity groups are a way of linking activities together, so the included entities' states are handled together when switching between activities in a group.

Creation

Activity groups can be created with the web configurator under Activities & Macros. An activity group has the following properties:

How do activity groups work?

Let's look at an example with 2 activities:

The Watch TV activity does the following for the on-sequence:

  1. Turns on the TV
  2. Turns on the cable box
  3. Turns on the amplifier
  4. Delay 5 seconds
  5. Switches the TV to HDMI1

The Play videogames activity does the following for the on sequence:

  1. Turns on the TV
  2. Turns on the amplifier
  3. Delay 5 seconds
  4. Turns on the games console
  5. Delay 2 seconds
  6. Switches the TV to HDMI2

If you start the Watch TV activity, the on-sequence will run. After that if you exit the activity UI (and not switching off the activity) and start the Play videogames activity, the on-sequence for this activity will run, but skipping the power on for entities that are already turned on. I.e. only steps 4), 5) and 6) are run.

Then running the Watch TV activity again, will turn off the games console, as that entity is not part of this activity. Then it runs its on-sequence, skipping the already powered entities (in state "ON"). I.e. only step 2) Turn on cable box and 5) Switching TV to HDMI1.

Please note that the off-sequence for the current activity is skipped, when starting another activity in the same activity group. Only when turning off the currently running activity, will execute its off-sequence.

You can think of activity groups this way: the state of entities - that are part of the activities - added to the group are handled together. This means that depending on which activity was turned on last will automatically adjust the state of entities (included in all activities within a group) to transition to the newly started activity.

Restrictions

UI

Activity groups are not shown in the UI. However, each activity has an indication that it is part of a group.

zehnm commented 1 year ago

Activity group management has been implemented in release 1.4.5. The entity power command logic, when switching between activities in a group, will be part of a future update.

hprotter commented 1 year ago

I have a problem with running the on-sequence of an activity. The on-sequence will just run if the state of the activity is "off", but will not be executed if I call the activity again when the activity state is already "on". This is for firmware version 1.4.3 and also for the brand new version 1.4.5 and it is the same within the new activity groups. What is wrong on my side, what do I have to configure that the on-sequence of an activity will always run if I call an activity?

zehnm commented 1 year ago

The on-sequence will just run if the state of the activity is "off", but will not be executed if I call the activity again when the activity state is already "on"

This is intended behaviour. The activity needs to be turned off first, before the on-sequence runs again. Press the power button and a list of running activities is shown, which can be turned off.

hprotter commented 1 year ago

This is intended behaviour. The activity needs to be turned off first, before the on-sequence runs again

But if it's intended then it is against Martons explanation about activity group workflow/management:

"If you start the Watch TV activity, the on-sequence will run. After that if you exit the activity UI (and not switching off the activity) and start the Play videogames activity, the on-sequence for this activity will run, but skipping the power on for entities that are already turned on. I.e. only steps 4), 5) and 6) are run."

As he described here: https://github.com/unfoldedcircle/feature-and-bug-tracker/issues/64

And it could not be indended as this would mean, that you has to switch off all devices (= run the off-sequence) when you switch between the activities, otherwise the input channels would not changed. So when I switch from "Watch PVR" to "Watch DVD" I will not switch off my tv. In this case the tv should remain on, but should just change the input channel from pvr to dvd.

zehnm commented 1 year ago

Activity groups is a feature on the roadmap. It's currently being implemented and this issue is tracking it. With 1.4.5 the creation and management of the groups is included, but the power-state logic of the entities included in the activity group is still missing. See my response above:

The entity power command logic, when switching between activities in a group, will be part of a future update.

Activities are still independent and work as described.

hprotter commented 1 year ago

Okay, thanks for your response and the information, than I have to wait for the full implementation. Hopefully, the handling of seamless switching between activities with the possible change of input channels is solved with that implemantation. ;-)

Talkabout commented 1 year ago

Hi all,

I also have concerns about the planned implementation of activity groups. My assumption was that the target of activity groups is to assure that only 1 activity in this group can be on at the same time. It seems that this will not be the case and only the power state of activities will be considered. I want to sketch a use case where I think the planned functionality is not sufficient.

Consider following setup:

  1. Activity "TV" including entities TV, AVR, SATBOX
  2. Activity "Movie" including entities PROJECTOR, AVR, ANDROIDTV, SILVERSCREEN, SHUTTER1, SHUTTER2

Both activities are in the same group as only 1 can be active at the same time.

Starting "TV" turns on TV, AVR and SATBOX. Switching on "Movie" should

  1. Power Off TV, Power Off SATBOX, keep AVR on as also included in "Movie"
  2. Power On PROJECTOR, Power on ANDROIDTV, set SILVERSCREEN to 100%, set SHUTTER1 to 0%, set SHUTTER2 to 0%

Now I want to switch back to "TV" and expect

  1. Power Off PROJECTOR, Power off ANDROIDTV, set SILVERSCREEN to 0%, set SHUTTER1 to 100%, set SHUTTER2 to 100%
  2. Power On TV, Power on SATBOX

This logic will not work with the planned implementation but would work great if you would include the Off-Sequences. The logic would be as follows:

Power Off Sequence of "Movie" would include

As "TV" includes "AVR" also, this entity is skipped during the off sequence of "Movie".

I think that use cases like that are quite common. It would be a pitty if we would not be able to cover such use cases and have the freedom to configure our grouped activities with more than "POWER_OFF". Please make this possible as for me it is essential to have it working this way!

Thanks!

Talkabout commented 1 year ago

Hi @martonborzak , @zehnm ,

any chance to get feedback on my previous post? Do you think it is possible to integrate the flexibility mentioned there?

Thanks!

zehnm commented 1 year ago

The initial implementation of activity groups has just been released in the BETA group and will be available soon, depending on feedback and if there are no showstoppers.

The power-off logic for devices in the old activity is selectable with the following options:

Running the original power-off sequence of the old activity (with skipping power-off commands of devices used in the new activity) is currently not yet possible, but planned as an additional option. More features are planned as well, this is only the start :-) For example a simple mode with sensible defaults, since the current implementation is more an expert-mode with many knobs. Plus more convenience features for creating individual activities, "functionality-selection" for included devices (volume control, channel switching, ...) with default mappings for buttons and UI screens (as done for remote-entities).

Talkabout commented 1 year ago

Hi @zehnm ,

thanks for the information! This means, at least for me, that the activity groups will not cover my required use cases yet. Still have to wait to use the remote productively... Hoping for a fast feature update for the activity groups! Any rough estimate on when the mentioned option is planned to be added?

Talkabout commented 1 year ago

By the way, doesn't that mean that even a very simple use case like switching the HDMI Input on a receiver when switching activities within a group will not be possible? I think this is something most people will require...

Edit: it will work because the on-sequence will be executed

zehnm commented 1 year ago

@Talkabout best case timeframe to support running the original power-off sequence: next week. Otherwise this month.

Talkabout commented 1 year ago

@zehnm this is way more than I expected, thank you very much for this information!

zehnm commented 11 months ago

First guide for the upcoming public release: https://support.unfoldedcircle.com/support/solutions/articles/101000508015-activity-groups

Talkabout commented 11 months ago

@zehnm looks good so far! Waiting for the power-off sequence execution now :)

Talkabout commented 11 months ago

@zehnm today I played around with activity groups and can confirm that for simple use cases it works for me. Devices are turned off when swichting. Keeping fingers crossed for power off sequence feature :)

zehnm commented 11 months ago

@Talkabout thank you for the feedback and I'm glad it's already working for your simple use cases. Support for running the off-sequence of the old activity will come, it's right behind the infrared repeat support for the internal IR blaster and fixing the IR toggle bit. ETA: still this December.

I'm closing this roadmap issue: initially planned features are implemented in v1.5.2

apgr commented 11 months ago

I've been playing with this a bit and have found a couple of issues:

My use case is three activities - all in the same group.

The Apple TV and Fire TV;s each have their own HDMI input on mu LG TV. The Blu-ray goes to HDMI2 but via an AwakeLion HDMI switch.

When I move from Fire TV to Blu-ray things work well. The delays are removed and it works perfectly. However when I leave the watch blu-ray activity to go to either other activity then both the blu-ray player and the HDMI switch box are left powered on. Looking at the logs I see

2023-12-17 09:43:57.623033 +00:00 core NOTICE [Living Room] entities to power off: [] 2023-12-17 09:43:57.612115 +00:00 core NOTICE [Living Room] found running activity 'Watch Blu-ray' (uc.main.c218c8e4-b8b8-4d6f-bc25-e68b2e9a0b19) in the same activity group 2023-12-17 09:43:57.610921 +00:00 core NOTICE Starting activity 'Watch Apple TV' (uc.main.2a944d49-6112-41d7-8684-3281670f23ab) in activity group: 'Living Room' (193d129e-c077-4ab0-8e1a-244f84472fbe)

My second problem is that when ever I leave the watch Apple TV activity, the log shows

[Living Room] entities to power off: ["Apple TV Living Room (uc_appletv_driver.main.C0:95:6D:7C:DF:1B) PAUSED"]**

and some kind of off command is sent to the Apple TV, which then turns off the LG TV via CEC! The power off instructions in the "Watch Apple TV" activity setup is simple to turn off the LG TV.

Unfortunately I can't turn off the CEC control on the LG TV because it has to be on to send audio over HDMI to my SONOS Arc sound bar.

Conclusion: I think that the concept of an "always on" definition for devices is needed and needs to be added to the activity groups logic.

Sledgehamma commented 10 months ago

Is the restriction "IR remote-entities require the power buttons to be named POWER_ON & POWER_OFF (or POWER_TOGGLE for "dumb" devices)." still valid for FW 1.6.4? Its not working for me, so just wanted to be sure that I'm not the issue :D

fbutler commented 5 months ago

There is no mention of the "Run modified off-sequence" option in the "Turn off unused entities" section of the Activity Groups guide at: https://support.unfoldedcircle.com/hc/en-us/articles/13215168236188-Activity-groups