Connect Global Variables to Dashboards

Solved, as it take time for proper device to shop up in dashboard device list, just need to be patient and it has come up, device name for dashboard should be same as child device of Rule Engine Connectors, for example:

Device list
image

Dashboard devices
image

Can anybody tell me if this is the correct behavior? Seems odd....

Added two GVs, each with a connector. I added the first GV as a number (which is what I want) and then created a Variable connector. Second, I added another GV, but this time as a Decimal, and again created a Variable connector. In the first case, no connector shows up (see pic below) and it is not listed in the "Delete Connectors" drop down. HubConnect won't send it across to another hub either. The second GV shows up and functions as expected.

Huh?

Looks like the first connector creation didn't complete.

Makes sense, thanks. In fixing the prob, I now appear to have a couple orphaned connectors (variable deleted, but corresponding connector still shows up in device list under RM). Any way for me to clean that up (if it matters)?

1 Like

I have setup a few apps with connector variables. I added them to a dashboard to help me debug an issue I am having with them, and I am seeing something strange...

  1. One of the variables is a Boolean and was setup as a Presence connector. I expect that it will be "Not Present" when false and "Present" when true. However, I am not seeing it switch to false in the dashboard when I set it to "false" and then to "true" after a 5 second delay. (Note that in further tests, I was able to see it toggle when I set it to "not" it's value, so I don't understand what is going wrong...)
  2. When I "Run Actions" on the code (below) and the first IF statement is true, the dashboard goes crazy (values change over and over again - see video below). This doesn't occur when the "Else" condition is triggered.

Here is a screenshot of my app:

Here is a the video showing the dashboard behaviour:

Is there something I am doing wrong, or is there a bug somewhere?

I have connector variables set up as well, for similar purposes. I am using every type and they all work except for the String variable. For me, it never updates in the dashboard.

Have you tried Variable String to display the variable in your Dashboard? That is the only one, of the few I tried, that Ā« worked Ā» for me. I just wish I knew why it is acting up... Other than that, it is such a great feature, isnā€™t it!?

I will debug further this weekend and contact support if I canā€™t resolve with the community.

Support won't be able to help you with this. Ping me if you can't resolve it.

1 Like

Thanks @bravenel! I spent several hours working on this today. I am finding that the behavior seems inconsistant, which is odd. Further testing makes it look like there is some kind of feedback loop in the connector. It seems to be dependent on the delay between 2 runs.

I was able to isolate the cause of the issue. It only seems to occur when I have code that modifies the variable by adding %itself% to the new value or by executing a ā€œReplaceā€ on it.

Here is the new code I used to test:

Here is the log of the first run:

Here is the log of the 2nd run:

3rd run:

4th run:

I can bypass the issue by writing to the variable only once at the end. Is that the way it is suppose to work? I stayed up way too late trying to figure this out last night, and my brain is mush today, so hopefully, I didnā€™t miss something obvious!

Code that works:

Another related issue I am encountering is with the Boolean variable ā€œtestDoorMessageCompleteā€ that is setup as a Presence connector.
I am finding that when I set the variable to False at the beginning and then True at the end (even with a 5 second delay), the dashboard never shows ā€œNot Presentā€. The only way I could get it to change is by setting it to ā€œnotā€ itself once either at the beginning or at the end of the rule. That seems odd to me...

Thank you very much for taking the time to look into this! I really appreciate it!

This is my dashboard:

The variable string shows Unknown. It should be Echo - Office. It simply shows the last echo that was spoken to. I had created it just as an easy way to look at the variable.
This is a screen capture of the current variable value in RM.

The variable is set to unknown each time the RM rule is triggered, and then gets changed to the name of the last echo device spoken to. The variable and the rule are working fine, but the dashboard variable never changes from Unknown.

Odd... The setup seems to be exactly the same as I have for my test dashboard. I do have one Variable String as ā€œUnknownā€ too, but that one is not linked to a variable. Is there some way that it might not be linked correctly?

Iā€™m curious... How can you tell which was the last echo spoken to?

It would be great if you could actually use these GVs in trigger and conditions for other apps like motion lighting.

1 Like

These are purely internal to Rule Machine. Notice that you can use Global Variable Connectors (virtual devices tied to Global Variables), and these can be used in other apps.

They create virtual devices. Create one and look in your Devices list. They will be under "Rule Machine Connectors". As devices, they can be used in any context a device with that capability can be used.

It is. It supports a command: setVariable(string), and an attribute variable, also a string. So you can pass strings into and out of a rule to/from an app.

Perhaps if you show your use case instead of making assertions about what can and cannot be done, we could benefit from facts.

Variables are exposed indirectly through connector devices. That's how this feature works. It allows apps to fully interact with variables. Anything that can be done with a variable in a rule can be done with that same variable in an app, by using the connector device as the intermediary.

2 Likes

You can't use %on_state% in an app. You have to have the connector device selected so you can send commands to it. Instead of your input with %on_state& you would need this selector:

input "color1", "sensor", title: "Select connector for Color 1"

Then, to set it:

color1.setVariable("$color1AttributeValue")

1 Like

@bravenel

I am trying to create a variable named "BANNER" type string and assigned it to a Variable connector. It shows up in the Create Global Variables page, but there is no virtual device created.

The screens you show in the initial post are different than what I see, and I assume you made some updates to this area in a recent firmware update.

Just wondering why no virtual device was created?

Here is a screenshot

image

You may be looking in the wrong place on the devices list. The virtual device will be under Rule Machine Connectors.

Show a screenshot of your devices list capturing the R portion of the list.

Thanks, I just found it a few minutes ago.