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

Activity groups #64

Closed
martonborzak opened this issue Sep 27, 2023 · 19 comments
Closed

Activity groups #64

martonborzak opened this issue Sep 27, 2023 · 19 comments
Labels
roadmap Planned roadmap feature

Comments

@martonborzak
Copy link
Contributor

martonborzak commented Sep 27, 2023

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:

  • name
  • list of included activities

How do activity groups work?

Let's look at an example with 2 activities:

  • Watch TV
  • Play videogames

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

  • One activity can only be part of one activity group.
  • Only one activity can be in state "ON" in an activity group.
  • Keeping track of IR devices' states is best-effort, due to the nature of the protocol.
  • IR remote-entities require the power buttons to be named POWER_ON & POWER_OFF (or POWER_TOGGLE for "dumb" devices).
    Otherwise, the power state cannot be controlled when switching activities.
  • When starting an activity while another activity is already on, the delay steps in on-sequences of the new activity
    are only removed if the previous power-on command is skipped.
    We might make this a configuration option in the activity group, if delays should be skipped as well.

UI

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

@martonborzak martonborzak added the roadmap Planned roadmap feature label Sep 27, 2023
@martonborzak martonborzak added this to the Roadmap October 2023 milestone Sep 27, 2023
@zehnm
Copy link

zehnm commented Nov 3, 2023

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
Copy link

hprotter commented Nov 3, 2023

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
Copy link

zehnm commented Nov 3, 2023

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
Copy link

hprotter commented Nov 3, 2023

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:
#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
Copy link

zehnm commented Nov 3, 2023

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
Copy link

hprotter commented Nov 3, 2023

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
Copy link

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

  • Power Off PROJECTOR
  • Power off ANDROIDTV
  • Power off AVR
  • set SILVERSCREEN to 0%
  • set SHUTTER1 to 100%
  • set SHUTTER2 to 100%

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
Copy link

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
Copy link

zehnm commented Dec 1, 2023

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:

  • never (keep all devices powered on).
  • all unused devices in the new activity.
  • only unused devices which are in the power-off sequence of the old activity with a power-off command.

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
Copy link

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
Copy link

Talkabout commented Dec 1, 2023

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
Copy link

zehnm commented Dec 1, 2023

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

@Talkabout
Copy link

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

@zehnm
Copy link

zehnm commented Dec 11, 2023

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

@Talkabout
Copy link

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

@Talkabout
Copy link

@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
Copy link

zehnm commented Dec 14, 2023

@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

@zehnm zehnm closed this as completed Dec 14, 2023
@apgr
Copy link

apgr commented Dec 18, 2023

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.

  • watch Apple TV (LG on, delay, LG input HDMI4)
  • watch Fire TV (LG on, delay, LG input HDMI1)
  • watch Blu-ray (LG on, delay, , Blu-ray on, delay, HDMI switch box on, LG input HDMI2, HDMI switch box input 1)

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
Copy link

Sledgehamma commented Jan 22, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
roadmap Planned roadmap feature
Projects
None yet
Development

No branches or pull requests

6 participants