Fibaro HC3 and QuickApp's

Hi Bill
I used ID30 (which is a switch) only to test the command. It is also true that my QuickApp is based on a QA that can act as a switch, but that is only because I want to be able to see the status change when my car heater is active (the heat button should change image).

I could send a “turnOn” command to start the heater, but then all the intelligence in it is lost because the start time is calculated based on the outdoor temperature.
It should also be easy to program the start time, which is done in the QA heater interface.

The “callUIEvent” command does not come from ImperiHome because that app does not support HC3. It is also for this reason that I and many others are looking for a similar app with HC3 support.

If your creation HR can easily handle buttons and read a Label in a QA, I know that many of my friends on the Swedish forum would be interested because automatic car heaters are very common here in “cold” Sweden (and many other applications).
Creating a scene with the same features is not interesting, because a scene has no interface with buttons and labels.

EDIT:
The new HC3 command comes from another member with extensive knowledge of Fibaro, cag014.
Here is a link to his answer of how to press a button:
https://forum.fibaro.com/topic/49405-scene-launch-via-api/?do=findComment&comment=203120

Hi again Bill
Now I’m starting to understand what you’re asking about “Call UiEvent Action”.
I found something called Swagger in Fibaron’s interface.
Under the heading “GET /plugins/callUIEvent” I found the information that you can read about in the attached PDF documents.
I entered my values in the example and got the answer as you see in my PDF. Tell me if you need more info and I will copy it for you.

This might solve how to press the QA app’s buttons, but the problem of reading the value in a Label remains.
Jang on the forum suggested that in my QA I should send the value to a global variable, and in HR read off this variable.
Is there anything that can be done, if so ,how?

Unable to send PDF so I renamed the file to a txt file.

Fibaro HC3 Plugins API.pdf.txt (600.1 KB)

Thanks for the info. I’ll add support for sending “callUIEvent” commands to the next release.

Have you looked through that file you attached earlier to see if the value you wish to read is in the JSON?

I see there are some “quickAppVariables”

Do you mean I can read a variable that is in my QuickApp?
In that case, I can easily add a variable that contains the information from the Label that I want to read.

Feel free to explain to me how I can do that. For example, a variable that I call “Departure_Time”.

I was just saying that we might not need global variables. It might exist in the device JSON that we are already polling. I don’t see Departure_Time in that data you posted the other day so we may need global variables.

If you need global variable support there is a plugin you can use. That’s another endpoint we’d be polling though. Since we are already polling the “devices” endpoint it’d be a little bit more efficient to use its data. Again, that may not be possible. You may have no choice but to use global variables.

Information about the global variables plugin can be found here.

It appears so. Did you look at that screenshot I shared earlier?

It has “quickAppVariables” in that JSON you sent me. The problem is, I don’t see Departure_Time.

I’m sorry there was a misunderstanding here.
I had not yet added the variable Departure_Time.
But if the variable could be used in HR, I could easily add it.

But now I have added a variable called “Dep_Status” and it is included in the json file (I changed to a more appropriate name).
{
“name”: “Dep_Status”,
“value”: “Standby”
}
I added the variable in HR (Label) as an “Attributes: Dep_Status”, and linked “CarheaterCar_Yh.Dep_Status” (with Device binding :).
Unfortunately it did not work, maybe I’m wrong?
Can you give me a tip on how to do this? I’ve looked in your documentation, but I can’t find anything that help me. Many thanks for your help.

My_label

EDIT:
Regarding “callUIEvent” and the buttons for the car heater.
If it is of any help, I get this message in HC3 when I press the button “Auto” in HR.

onAction: {“actionName”:“setBtn_auto”,“args”:[""],“deviceId”:191}
[WARNING] [QUICKAPP191]: Class does not have setBtn_auto function defined - action ignored

The app does not currently support nested properties. All I was having you do now is just verify the data is available in the “devices”. And based on your findings, it is there. What you have will not work because you’ll have to provide the entire property path. What I will try to add in next release is the ability to add attributes like quickAppVariables.Dep_Status. Again, this isn’t going to work right now. You’re going to have to wait until the next release. This is going to be a new feature.

Thanks Bill!
If this is for your help, I will attach the entire json file with API Plugins.
Tell me if you want more API files, such as devices, scenes, alarms / devices, voip, weather and so on, there are many of them.
Fibaro_HC3_API_Plugins.json.txt (73.9 KB)

I don’t really need anything else. I made the changes yesterday on my development machine. They will be included in the 3.15.0 release which should be out in a couple days.

I will receive the HC3 in 2 weeks I could be in reinforcement on this box with HR!

Version 3.15.0 is available everywhere except the Apple App Store. It’s waiting for Apple review there.

Attached is a project demonstrating how to use these new Quick App features. This was built using the sample data you provided earlier. All you should need to do to get this example working is update the Password on the Fibaro source.

Fibaro_QuickApp.hrp (3.9 KB)

Hi Bill
Now the buttons work perfectly, but there are some problems with updating the Label (“quickAppVariables.Dep_Status”).
When I start the app, the Label is updated with the correct information, but if I then press the buttons, the Label does not react with the new information.

If it is to work properly, this label must also respond to changes from QuickApp’s variables. For example. in Manual mode, “quickAppVariables.Dep_Status” is continuously updated every minute until a certain time has elapsed.
When programming the time in the HR app, the response to this Label must be immediate without delay.
Now it seems that the communication with my QuickApp is one-way.

I have also tried adding different Triggers to the Label, but it has not worked (or I have done wrong).

Manual start and 9 minutes left.

The Home Remote only does a full refresh on startup. After that, it monitors changes using “/api/refreshStates?last=”. This helps keep things fast & efficient. Sounds like your quick app is not sending notifications that the device has changed. Check the Fibaro forum for support on this one. Quick Apps are still new to me so I don’t know what you need to do to enable these.

Bill, thanks for all the help.
Now the car heater works the way I want it to work.
I could not use QuickApp’s own variable so I created a Global variable where HR Label can retrieve information.

A final detail that would increase clarity is that the “Auto” and “Manual” buttons change the background color when the button (command) is active. I have tried, but it did not work because those buttons are not switches. I had thought that the background color would be controlled by a variable that can have the value “Auto” or “Manual”, but I have not succeeded.

The picture shows an HR app intended for my wife’s mobile.

You can use DataTriggers to update the Background on your Button controls.

Hi Bill
First I want to say that it now works with changing the background color of the buttons. I had accidentally tried to use QuickApp’s local variable which did not work.

Then I would like you to take a closer look at the problem with QuickApp’s local variables.
I have asked the expert “jang” on Fibaro’s forum about this and his answer is that it should work to use them. Here is jang’s answer:

If you set a QA’s quickAppVariables with “self:setVariable(name,value)” (which I have done), a trigger is generated in the HC3 that can be captured with “/refreshStates”.
The condition is that it is a new value, ie differs from the value that the variable currently has.

Since HR seems to be able to capture it at startup, it should work later as well.
Fibaro HC3 posts all quickAppVariables for a QA when a variable changes value.

I have also done tests with the command “http://192.168.1.27/api/refreshStates?last=1” several times.
I changed the local QA variables several times, and each time the command was executed I saw that the variables in the json file changed.
So the Label in HR should be updated, because the json file was updated correctly.

I would be grateful if you would review your code again to see if the issue can be resolved.
Since a QuickApp has its own variables, it would be great if you could use them. It’s like “crossing the river for water” if you have to use Fibaro’s Global Variables.

Calling “refreshStates?last=1” is not a valid test. It’s important to understand how that request actually works. “last” is an ID field that represents the data version of the JSON. “1” is the very first version so almost everything has probably changed since version “1”. The controller will likely return every device you have from that request. The current data version the controller is going to be much newer. To do an accurate test, you need to call refreshStates, get the current actual “last” value. Then call refreshStates again with the “last” value you obtained from the previous request.

The “last” value that is used is constantly changing. Each time “refreshStates” is called, we read the new “last” value that was returned & then use it for the next call. That loop repeats itself over & over. To test this accurately you need to be doing the same.

You should spot “last” near the top of the returned JSON data. After you make a call, copy that value & paste it into the search bar for your next call. Make sure you are always updating that parameter.