Fibaro HC3 and QuickApp's

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.

What you were doing with a fixed value really defeats the whole purpose of using refreshStates. Remember, this should only be returning the changes. We don’t want anything extra that hasn’t changed.

I’m sorry I did not understand what the parameter “last=1” meant, but now I have tested again in the way you described.

I ran the command “http://192.168.1.27/api/refreshStates?last=” several times and each time changed the value of “last” according to your instructions. The QuickApp variable “Dep_Status” then displayed the value “Standby”.

Then I clicked the “Auto” button and ran the command again with the latest “last=” value.
In the json file that I am now attaching, you can see on lines 297 and 625 that the value of “Dep_Status” has been changed from “Standby” to “Avresa: 12:00 / Auto”.

Line 297
“name”: “Dep_Status”,
“value”: “Avresa: 12:00 / Auto”

Line 625
“{“name”:“Dep_Status”,“value”:“Avresa: 12:00 / Auto”}”

The Json file has thus been updated correctly, but the HR app still statically shows the old value, but if I restart the app it will be updated correctly.
So, what is it that causes the HR app not to be updated?
refreshStates_QA_2020-12-23.json.txt (9.6 KB)

I think I may see the issue, or at least 1 issue. The JSON is invalid. Look at line 3. That line with Ändrad till Auto Avresa 12:00 is not formatted correctly. JSON parsers will not be able to load that.

Did you modify this file at all or is this the actual output from “refreshStates”?

Just to be clear, all it takes is 1 bad line to fault the parser. While the rest of the data may be good, it will never be processed because of that bad line at the top.

And where did Dep_Status come from?

It’s not in the “api/devices” you sent me earlier.
http://192.168.1.27/api/devices/191

I’m trying to do my best to emulate your environment but I’m only going to be as good as the data I’m given. If this is a new value you added you need provide post that data too.

It would be best if you could download the “api/devices” data first. Then start your “api/refreshStates” process & make your change.

The way the Home Remote works, is it 1st downloads “api/devices”, then begins its “api/refreshStates” loop. I am using both of these files to emulate your controller: Properties_QA_191.txt & refreshStates_QA_2020-12-23.json.txt. So you should pick a value to change that exists in both.

The addition on line 3 is my own note. I did many tests so I wrote this note to know what I did.
Dep_Status was added when I created the Global variables. I’m sorry if they’ve been misleading to you.
It’s late tonight now but tomorrow I can create new json files for you that you can work with.
As you can see, I’m concerned that there will be good HC3 support for Home Remote. ImperiHome was a fantastic tool, but I see that HR can be even better because you can create the layout you want and that HR also has support for Fibaro HC3.

1 Like

Now I have “cleaned up” my QuickApp and removed the Global variables, so now we forget what I have previously written.
The files I attach only contain local variables and other local QA information.

A QA contains at least 3 parameters that your creation Home Remote must be able to handle, and in my QA it is:
A) Buttons, e.g. btn_Hour (This now works in HR)
B) quickAppVariables, e.g. my variables Dep_Status, Heat_Status and more.
C) Labels, e.g. lbl_Avresetid, lbl_Status
There is also a controller called “slider”, but I do not use it here. (We can add it later)

Attached files:
The file “1_HC3_API_Devices_ID191.txt” is the result of the command “http://192.168.1.27/api/devices/191

The file “2_HC3_refreshStates_Before_Settings.txt” is the result of “http://192.168.1.27/api/refreshStates?last=…” before any parameters in QA have been changed, and contains no info about QA ID191.

The file “3_HC3_refreshStates_Hour_Changed.txt” is the result when I changed the start time from 11:00 to 12:00.

The file “4_HC3_refreshStates_Standby_to_Auto.txt” is the result when I then changed the status from Standby to Auto.

Files number 3 and 4 contain data from both variables and labels that HR could retrieve.

In file 3_HC3 … you will find e.g. the variable “Dep_Hour” on lines 289, 327, 383, 421, 772. And the label “lbl_Avresetid” time on lines 350 and 478.

In file 4_HC3 … you will find the label “lbl_Avresetid” on line 291 and “lbl_Status” on line 181. The variable Dep_Status is found on lines 132, 170, 226, 264, and 475.

So variables and labels are updated correctly in the event of a change, you just have to get them updated in Home Remote.
Let me know if you need more information, I will be happy to help.

1_HC3_API_Devices_ID191.txt (4.6 KB) 2_HC3_refreshStates_Before_Settings.txt (1.9 KB) 3_HC3_refreshStates_Hour_Changed.txt (10.8 KB) 4_HC3_refreshStates_Standby_to_Auto.txt (6.4 KB)

Hi Roy,
Thats look very good. do you mind share your quick app. Then i would try to change it so it works for my Webasto if thats possible or if you have any idea.
Great work.
Thanks in advanced.
Martin

OK Roy, I think I see the issue here. It looks like the controller is sending these “changes” as string values. So I need to parse that string to load the array. The code that processes the changes was skipping this because it was expecting an actual array, not a string. I’ll get this fixed in the next release.

Thanks Bill, I’m looking forward to the next release.
When you create a QuickApp, you can choose which type of QA to use (Binary sensor, Binary switch, Multilevel sensor, Wind sensor and more) yes there are 23 different variants to use.

We can only hope that HR can retrieve data from these with the same method. In addition to my own QA, I also have a QA Wind sensor and a QA Multilevel sensor to test this on. Then there are QuickApp child devices that I do not yet know how to use.

Here are some links to Fibaro’s manuals.
https://manuals.fibaro.com/home-center-3-quick-apps/
https://manuals.fibaro.com/knowledge-base-browse/hc3-quick-apps-managing-child-devices/

Hi again Bill, I just want to remind you that QuickApp’s Label should also be read out. It contains data that is very useful in most QuickApp’s.
The last line of text string contains only “quickAppVariables”.