Dear community,
I have a question regarding my Fibaro HC2. For the control I use a lot of variables. Is it possible to read and change this variables with the Home Remote?
have a nice day.
I presume you are talking about “Global Variables”? If so, yes. I just posted a Plugin I wrote that can read & write to those variables.
Hi Bill,
thank you for the support.
I use this Plugin and can read the Global Variable. The toggle switch is on if the variable is ‘2’ and off if the variable is ‘1’. That means that the data trigger runs, but the event trigger not. I can´t set the variable. Do I have to pay attention to anything special?
Try using the Clicked event of a standard button so we know it’s not an issue with your Toggle configuration. Buttons only need 1 trigger vs the 4 you need for a toggle.
If it doesn’t work with a standard button, try adding “.toString()” to the value in the HTTP PUT request.
http.put(baseURL + "/globalVariables/" + device.Id, { name: device.Id, value: value, readOnly: false, isEnum: false }, { auth: credentials, headers: { 'content-type': 'application/x-www-form-urlencoded' } });
http.put(baseURL + "/globalVariables/" + device.Id, { name: device.Id, value: value.toString(), readOnly: false, isEnum: false }, { auth: credentials, headers: { 'content-type': 'application/x-www-form-urlencoded' } });
Hi Bill,
I Downloaded the script and the tile.
I used my fibaro admin credential and I can sync and read the GlabalVariables.
But When I want to write a GlobalVarialble I get the message:
Response status code does not indicate success: 500 (Internal Server Error).
I get this with your original script and also when I add “.toSting()” as you suggested above.
What Could be wrong?
Try the attached file. This forces the plugin to use Basic authorization:
FibaroGlobalVariables_v2.plugin (2.0 KB)
function onConnect() {
baseURL = "http://" + plugin.Settings["Host"] + ":" + plugin.Settings["Port"] + "/api";
credentials = {
username: plugin.Settings["Username"],
password: plugin.Settings["Password"],
authType: "basic"
}
}
I just tried it. The result is still the same.
Before import I deleted the GlobalVariables AND the old script.
After importing the new script I synchronized the GlobalVariables with success but I still can’t write the variables.
For now I have found a workaround via Fibaro scenes. One for increasing a set point, one for decreasing the set point and another scene for start using that variable.
Did this just break for you recently or were you never able to write to a global variable? I remember I wrote that for you a while back & I don’t recall this issue being brought up then.
No, I didn’t need to write a GlobalVariable until now and for the moment it is just one variable.
As far as I know you need admin rights to write global variables via the API and that is something I don’t want to do, using admin priveleges in 3rd party software.