ilcato / homebridge-Fibaro-HC2

Homebridge plugin for Fibaro Home Center 2 (and Home Center Lite ...)
Apache License 2.0
67 stars 27 forks source link

Admin Credentials to set Global Variables #204

Closed Krillle closed 3 years ago

Krillle commented 3 years ago

While it is helpful to use an explicit Fibaro user for Homebridge's read access to select a subset of devices, this no-admin user can't set the as well very helpful global variables acting as a bistable switch. Therefore it would be nice to add separate user credentials for this task:

"switchglobalvariables": "PUT A COMMA SEPARATED LIST OF HOME CENTER GLOBAL VARIABLES ACTING LIKE A BISTABLE SWITCH",
"adminUsername": "PUT ADMIN USERNAME OF YOUR HC2 HERE TO SET GLOBAL VARIABLES",
"adminPassword": "PUT ADMIN PASSWORD OF YOUR HC2 HERE TO SET GLOBAL VARIABLES",

Changes could be like that: https://github.com/ilcato/homebridge-Fibaro-HC2/pull/205

crissmil commented 3 years ago

Great idea! If only it could be implemented...

Krillle commented 3 years ago

It’s implemented in my pull request #205

crissmil commented 3 years ago

Found it thanks! By the way, did u manage to make it work with latest homebridge version 1.3.0?

crissmil commented 3 years ago

I've tried it but keep getting this error when I try to modify the switch from iPhone: "There was a problem setting variable: XXX to true" If I change the variable value from HC2 it is working on homekit but from homekit to HC2 not. homebridge 1.3.0 any ideea?

Krillle commented 3 years ago

@crissmil The error looks like it's still not using the admin login. Did you add these lines in config.json?

"adminUsername": "PUT ADMIN USERNAME OF YOUR HC2 HERE TO SET GLOBAL VARIABLES",
"adminPassword": "PUT ADMIN PASSWORD OF YOUR HC2 HERE TO SET GLOBAL VARIABLES",

I did not check it with homebridge version 1.3.0. But there is no reason why it should not work out.

crissmil commented 3 years ago

yes I did. I am using same credentials for changing variables from raspberry python apps and are working...

ilcato commented 3 years ago

@crissmil, @Krillle does it works on 1.3? My I merge the PR? I cannot test on HC2.

Krillle commented 3 years ago

@ilcato I am going to test the it on Homebridge 1.3. I would need some support for that. I sent you a PM on Homebridge discord.

ilcato commented 3 years ago

@ilcato I am going to test the it on Homebridge 1.3. I would need some support for that. I sent you a PM on Homebridge discord.

@Krillle, I'm not able to see your PM.

Krillle commented 3 years ago

@ilcato No problem. It's obsolete. I am about to test it in a fresh install.

Krillle commented 3 years ago

@ilcato The added feature to switch global variables with seperate admin user is working in Homebridge v1.3.1. Additionally I added Hombridge UI settings schema. Minor change: I found in code pollerperiod default is 5. I corrected this in config.json comments.

However the new feature seems to break the polling and setting of normal devices. Despite checking and investigating for hours, I could nod find the reason for this. Maybe you will see the reason having have a look on the lines of code I changed.

It might be a side effect, as I was not able to install the plugin from my local Git. I had to copy the compiled files manually. Would need some support here.

Krillle commented 3 years ago

@ilcato I found the reason: I needed to merge your latest changes from upstream/master.

Everything works fine under Homebridge 1.3.1. You can safely merge the pull request #205