Combine Status of Multiple Sensors

So I got a few Zigbee contact sensors now, my idea was to have a more sure way to know what position my garage doors are in.
But now I’m missing a way to have a good way to show what their status is.

I’d need a tile that can trigger a device (the door) and set the colour/icon to another device. That way I can open and close the door with a tile that can show the door is closed, open or somewhere in between.

How would I go around achieving that? When setting variables to the different states, I can’t create a variable tile to hold other variables as well.

@Sgt.Flippy_PJ if I understand your need correctly, you can do so by adding the contact sensor to the dashboard, change it to Hero Attribute layout, and configure its tap action to Open Hyperlink and use the $.runRule() syntax to trigger the execution. (You can get the rule id from the last section of the URL when editing the rule.)

Then in the rule, you can use an IF condition to check the contact sensor’s current state to determine if it should open or close the garage door.

1 Like

That’s nice, but not fully what I meant.

The thing is that I want the tile to reflect the state. But there is a sensor closed when the gate is open and another sensor is closed when it is open.

So what I would want to do, is to add the tile for my garage opener, but have that tile reflect the status of both sensors. When the closed sensor is closed and not open, the tile can turn green, when the open sensor is closed, it can turn red. When both sensors are open, show yellow for the time it should take the door to open/close and start flashing with a warning label or something when it stays in that state for too long.

In other words, a rule based system for a tile’s appearance. Maybe it’s something that can be used for lots of people. A tile on which you can set a tap action to activate any “thing”, but the appearance can be rule based. Would be very interesting for people with alarm/security systems as well.

Is this what your describing?

If sensor 1 == closed and sensor 2 == open then Set tile.color = Red.

If sensor 1 == open and sensor 2 == Closed then Set tile.color = Green.

If sensor 1 == open and sensor 2 == open then Set tile.color = Yellow.

2 Likes

Yes, but I haven’t found a way to use multiple devices in 1 tile for this. I know you can set it like that when set to hero attribute, but that only allows to set a color for 1 sensor.

Or am I so blatently missing something?

I believe you are correct. I know you can set multiple color states using the hero attribute for the title. However I am uncertain if a second Thing can influence a tile. @josh or @James are the one that will be able to better answer this question. If it’s not possible I would suggest adding it to the feature request.

You can use a rule to aggregate the status of multiple Things into a variable (or virtual thing).

Using that concept, the rule might be something like:

Triggers:

Contact1 changes to "open"
Contact1 changes to "closed"
Contact2 changes to "open"
Contact2 changes to "closed"

Flow:

IF (contact1 == "closed" AND contact2 is "open")
THEN 
   Set $doorState = "closed"

IF (contact1 == "open" AND contact2 is "closed")
THEN 
   Set $doorState = "open"

IF (contact1 == "open" AND contact2 is "open")
THEN 
   Set $doorState = "partially open"

IF (contact1 == "closed" AND contact2 is "closed")
THEN 
   Set $doorState = "sensor error"

(Just an example without knowing the intricacies of your setup, but you could adapt as needed)

Then you would add the variable to your dashboard and you could style it based on your known combined states. You could set the tile’s action to Hyperlink and use the $.runRule() syntax to trigger whatever actions you wanted (in a separate rule).

3 Likes

I haven’t used string variables before, great idea, thanks a lot!
Gonna try it out, but looks like it’ll work like that :smiley:

PS: I had thought about using a virtual switch, like a multisensor, which would have a bunch of different outputs. But how do you set the virtual sensor’s “outputs”?

Okay, it’s working almost perfectly, I only have 1, albeit cosmetic, issue with this. I searched for it and found other people asking the same.

Now the tile shows an icon and the text. I don’t need the text of course.

PS, fixed that with css, but don’t know yet if that might screw with other tiles as well.

We have a feature in Beta called Super Tiles which enables you to build your own custom tile layouts. So you could add just the variable icon and not show the variable value at all if you’d like. I’d be happy to get you added to the beta if you’re interested?

Sure, would love to try it out!

Now it’s all up and running, I just need my sensors to read :rofl: From one thing to another!

Sent you a PM with the invitation!

1 Like