Creating a Schedule of Device Assignments

Are there any plans to support schedule of device assignments so that way a screen can have a different setup assigned to it at different times in an automated fashion? We would like to be able to automatically have the same three different setups show up on a different screen (rotate assignments) each day of 3 screens that are attached side-by-side.

2022 Update: The solution below is most likely no longer required. Have a look at Setup scheduling beta test instead.

No such feature is planned at the moment, but it’s certainly something worth looking into. At the moment the only way to solve this in an automated way is to use the API. I actually managed to automate exactly what you suggested using pipedream.com. I’ll create a visual walkthrough on how that works tomorrow.

I was about to ask almost the same question, On my part, my wish is to have assigned a specific setup on a schedule on a player, and at a given time the player should use another setup.
Simply put, from let’s say 10:00 to 14:00 player displays a full browser setup and after that player shows a setup with a looped scheduled content.
Would be this possible?

Walkthrough for automatically cycling setups

This example is using an external service for automatically using the info-beamer API to cycle through setups on a group of devices.

Preparing info-beamer hosted

API usage needs an API key for authorization and we don’t want (or need) to allow the external service to change everything in the account. Instead we create an API that’s limited to only assigning new setups to devices. For that, go to Permission > Policies and click on Create Policy. Enter the following policy:

{
  "Statements": [{
      "Action": "device:update:setup",
      "Effect": "allow"
    }],
  "Version": 1
}

like this:

image

click on Save. Then on ACL (Access Control List) and Create ACL, give the ACL a name (like For Pipedream). Then click on the + button next the the Policy created above to add it to the ACL. Alternatively drag and drop it from the right colum to the ACL on the left. Then click on Save:

Next create a Self-access to your account: Click on Access to account, then on Create Access. Select access to own account, give it a name (like API Key for Pipedream) and select the ACL created above:

image

Finally in the list of accesses to your account, click Access actions on the newly created access and select View API Key:

Note the value as it’s needed for the next step.

Automating with Pipedream

Sign up for a free account on pipedream.com. Select workflow on the left, then click on New +:

In the Select a trigger dialog, select Schedule:

This will add a trigger step to the workflow where you can configure how often your automation should run. As it should run once per day, select Cron Expression, use 0 6 * * * as value (which translates to “at 6:00 every day”, see here) and specify your timezone:

Next click on + at the bottom to add the next step. Select Run Node.js code:

In the code editor, enter the following code:

async (event, steps, params) => {
  const device_ids = params.device_ids.split(",").map(v => parseInt(v))
  const setup_ids = params.setup_ids.split(",").map(v => parseInt(v))
  const cycle = ($checkpoint ?? 0) + 1
  $checkpoint = cycle
  const api_key = params.api_key
  for (let idx in device_ids) {
    idx = parseInt(idx)
    const device_id = device_ids[idx]
    const setup_id = setup_ids[(idx + cycle) % setup_ids.length]
    $send.http({
        method: 'POST',
        url: `https://info-beamer.com/api/v1/device/${device_id}`,
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded',
            'Authorization': `Bearer ${api_key}`,
        },
        data: `setup_id=${setup_id}`,
    })
  }
}

This will create three new form fields above the code you entered and the window should look like this now:

In the Device ids field, enter the comma-separated device ids of devices you want to automatically change. You can find the device ID in the URL when you navigate to one of your devices:

image

Next, enter the same number of setup IDs in the Setup ids form field. Also comma separated. Similar to the device ID you can find the setup ID in the URL when you navigate to one of your setups.

Finally in the Api key field, enter the API created in the first step of this tutorial. The form should now look similar to this (with your own setup IDs, device IDs and API Key:

Finally click on Deploy:

image

That’s all: The code will now run at 6am every morning and will switch between all the setups on the specified devices. If you want to trigger the automation manually, click on the RUN NOW button within the schedule section of the trigger step:

Hello Florian, a big thank you for providing al the steps to make it posible.
I followed all the steps to the letter and created a mock deployment.
However, it didn’t work., although I followed all the steps without any error. Where to look to find the culprit ?
I have several questions:
In what order one needs to specify the setups and correlated that with the cron job?
How can we know if there is an error and where to find a log or some info to find quickly a solution?
If one of the setups chosen to deploy using cron is a scheduled player, how can this coexist) Or better to use a simple HD Player, because cron will switch it anyway?
Thanks in advance for your time
Cheers

If you click on the RUN NOW button, the individual steps should update and show what they are doing and whether or not there is an error somewhere. On the left side you should see the result of each individual run and within that, each step will show the result of its execution:

image

That said: I just clicked on run manually and nothing happens for me as well. Seems the execution is stuck or not started at all on my first attempt. Weird. Hm. I guess at some point info-beamer should include this feature natively.

If you switch between two scheduled player setups, essentially what happens on the device is that only the schedule players configuration is changed. Same as if you would edit one setup and save a new configuration. Not sure if that answers the question.

Just wanted more clarifications.
To ease the answer, I imagine these situations:

Situation 0
Let’s say that the player has already assigned a setup, the Browser one displaying a webpage.
Now, in Pipedream one configures the both setups Browser and Scheduled Player and the script executes itself at 16:00.
Once run, the script assigns the new setup to the player (Browsers changed with Scheduled Player)

Situation 1
The player has no player setup assigned.
The scripts executes , assigns the first ID_setup, then at the next script execution , the next ID_setup is assigned?

Sorry for asking so many questions, I want to automatice this switching setups as quickly as it is feasible. I need it, really.

Your workflow at https://pipedream.com/@/p_7NCKpbV?e=21KBgQh0kS18v7to8
generated the following error at 3:06:48 PM UTC on Tuesday, November 23rd, 2021:

10 — Rate limit exceeded for endpointId: p_7NCKpbV

That message was in my inbox today.

For both situations you describe exactly what should happen. The code doesn’t care what setup is currently running. It only cycles through the configured list of setups and applies that to your devices. If you have two devices and two setups, they will get swapped each time.

Can you email me, so we can continue this via email?

Hello
For those who are curious or those who followed this thread and wanted to know the solution, assuming that there is one, I’ll explain the steps taken in order to solve this problem.
First and foremost, a warm thanks to @infobeamer-fw, his guidance and support was crucial in getting a reliable and fast solution.

Now, onto the problem at hand.
The problem: How to have different setups running on the same player, but in a automated and scheduled way?

First, identify the played by its ID, it is last number in the URL when you click on the device from the webportal.

Second, identify the setups you want and create those setups and also identify their IDs, as above.
For the sake of compartimentation and not interfering with what is already working as it should, create separate setups for this task, so if things are not working as they should or anything else, will not affect the production players.

Third open an free account on PipeDream and follow the steps above in this thread.

Now, in order for things to work, create workflows for each time defined trigger. Let’s say, one wants the browser setup at 10:00 but the video setup at 16:00 and at 23:00 the live camera setup.I use the work setup loosely, I mean by that the setup configured using the provided packages.

Assuming that one wants different setups switching on the same player in the steps.nodejs window of each Pipedream workflow use this code:

const device_ids = params.device_ids.split(",").map(v => parseInt(v))

for(let device_id of device_ids) {

$send.http({

    method: 'POST',

    url: `https://info-beamer.com/api/v1/device/${device_id}`,

    headers: {

        'Content-Type': 'application/x-www-form-urlencoded',

        'Authorization': `Bearer ${params.api_key}`,

    },

    data: `setup_id=${params.setup_id}`,

})

}

Choose one ID device, one setup ID, and the cronjob expression for each time trigger, so for each setup scheduled to run on the player, one needs to create a workflow.

In the end one has to have the same amount of workflows identical with the time triggers wanted, and amount of setups. In all workflow the ID device is identical, only the ID setup differs for each time trigger.

It works, I posted this information for confirming it and add some additional information.
Hope that helps someone out there!
Kind regards!

Have a look at the new scheduling feature released as a beta yesterday. You can now automate switching between setups within the info-beamer dashboard: Setup scheduling beta test.

1 Like