homebridge-fireswitch
v0.0.4
Published
Homebridge Switch Plugin for Firebase
Downloads
1
Maintainers
Readme
homebridge-fireswitch
Homebridge plugin to set/get values in Firebase.
Installation
npm install -g homebridge-fireswitch
Configuration
Add this to your '~/.homebridge/config.json' as an accessory:
{
"accessory": "FireSwitch",
"name": "My Switch",
"server": "https://myserver.firebaseio.com",
"path": "/path/to/my/on_off/value",
"on_value": "turn_it_on",
"off_value": "turn_it_off",
"auth_method": "password",
"auth_credentials": {
"email": "[email protected]",
"password": "very_secret_password"
}
}
- server: This is the database server hostname assigned to your Firebase instance.
- path: This is the path in the database reference. This can use variable expansion.
- on_value: This is the value to set when the switch is turned on. If this is blank "on" events are ignored.
- off_value: This is the value to set when the switch is turned off. If this is blank "off" events are ignored.
- auth_method: This is the authentication method used to authenticate against the Firebase instance. Options are:
- "password" to use authWithPassword()
- "customtoken" to use authWithCustomToken()
- "anonymously" to use authAnonymously()
- auth_credentials: This is the authentication credentials to use with auth_method. For:
- "password" this should be a JSON object containing the email and password values.
- "customtoken" this should be a string containing a token generated in the Firebase console.
- "anonymously" this is ignored.
Variables
Variables in the path are set in curly braces like:
{$var_name}
Variables are expanded after authorization is complete.
Supported Variables
- {$uid} - The result of firebase_database.getAuth().uid
Tutorial
The project wiki has a simple tutorial that demonstrates how to create and control a widget with this project.
Notes
Currently this works only with Firebase libraries < 3.0.0
See this conversation in the Firebase Google Groups. For Firebase >= 3.0.0 in NodeJS only custom token authentication is supported. However, the 2.4.1 libraries for NodeJS work well with Firebase 3.x.