Organization | Dashboard

Hi,

I created an Organisation yesterday. I wanted to model a house so I created a parent group and added some sub-groups as rooms. After that I connected a couple of ressources.

When I came back to continue, the Organisation was empty. The House wasn’t showing up anymore. The resources where still there though.

Has anybody experienced the same issue before?

Greetings

I fixed the problem myself with a PATCH via bash. For some reason, the tag “group” was deleted from the group highest in hirarchy (the building itself).

I have a new question though. Since I don’t want to set up each resource individually, I started using the provisioning solution in the lab.

I got everything to work except the tags column. I tried different versions: Test, [“Test”], “Test”… What is the correct format?

Greetings

I just solved it. I forgot to set the tags column to object. Then [“Test”] works :slight_smile:

Another problem just came up. Lets imagine we have a big terminal in an airport. There are multiple WC/toilet-rooms for this terminal. In WC_a there are 4 toilets in WC_b there are 6 toilets… To organize all the toilets I create a group called: toilets for each WC. Dependend on the WC there are different amounts of toilets in it.

In a template I want to be flexible when it comes to connected resources. So firstly I create a getChildren Sensor. With this node I can get all ChildrenIds. Sensors check if the toilets are dirty. If 2 thirds are dirty an alarm is send. Ideally I would just set the resource in the template Configuration to WC_a and through getChildren it finds all Children and checks how many are dirty, regardless if the parent resource has 3 or 30 childs. Is something like this possible?


Greetings

Hey Friedrich,

Yes the right format for tags is an array of strings like ["test1", "test2"].

For your last question: you can use declarative binding to set your Resource parameter to ${task.RESOURCE}. This will be substituted by the resource that is bound to the task.

I would first make a task for your toilets that determines if they are dirty and saves that in a new metric. This task can work reactively so it runs every time data comes in for the toilets.

Than you can create a custom plugin that checks all toilets like this:

async function execute() {
  // Get the array of resource ids
  const resources = options.requiredProperties.resources;
  let totalDirty = 0;

  // Go over each resource and check if it is clean
  for (let resource of resources) {
    const isDirty = await waylay.data.getLastMetric(resource, "dirty");
    totalDirty += isDirty;
  }
  
  // Set the state depending on how many resources were dirty
  if (totalDirty > resources.length * 2.0 / 3.0) {
    send(null, {
      observedState: "dirty"
    });
  } else {
    send(null, {
      observedState: "clean"
    });
  }
}

execute();

Here is some more documentation on creating custom plugins.

1 Like

Hi Sander,

thank you for your answer!

I created the task.

I set up a timewindow with getMetric_01 with ${task.RESOURCE}. Then the condition_1 checks whether the flush has been activated more then 35 times ${nodes.getMetric_1.rawData.series[0][1]} <=35. If the conditions state is set to false, storeMessage_1 stores a Messege with this format: {"Sauberkeit": "dirty"}.
Message_01

I also created a template with a PlugIn like you said. I tried to understand how the plugIn finds the value “dirty”. It seems like I need to add the key “Sauberkeit” somewhere. Would I need to add this somewhere in const isDirty = await waylay.data.getLastMetric(resource, "dirty");?

Dear Community,

well it was once again me not understanding the code. It just needed one adjustments in the task for the individual toilet. I just needed to change the payload to {"dirty": "1"} for dirty and {"dirty": "0"} for clean. Then the PlugIn just counts 0 and 1 and the problem is solved.

Hey Friedrich,

Yes that was indeed what I meant :blush: