homebridge-minimal-http-blinds is a minimalistic HTTP blinds or roller shutters management plugin for homebridge.
The features:
get_current_position_url
returns the right value, this plugin will update iOS Home app in real time.no_cache_duration_millis
) app detected activity.Anyone who, just like me, don't know much about homebridge but still want a straightforward way to communicate with your own home-made Raspberry Pi blinds/roller shutters controller.
The installation instructions differs depending on how you installed homebridge.
Usually, it's something like "add this to your homebridge's install.sh
"
npm install -g homebridge-minimal-http-blinds
Here is an homebridge's config.json
with the minimal valid configuration:
{
"bridge": {
"name": "DemoMinimalisticHttpBlinds",
"username": "AA:BB:CC:DD:EE:FF",
"port": 51826,
"pin": "123-45-678"
},
"description": "DEV NODEJS MACBOOK",
"accessories": [
{
"name": "Kitchen Blinds",
"accessory": "MinimalisticHttpBlinds",
"get_current_position_url": "http://192.168.1.55/get/current_position/",
"set_target_position_url": "http://192.168.1.55/set/%position%",
"get_current_state_url": "http://192.168.1.55/get/current_state/"
}
],
"platforms": []
}
Beware, I'm a lazy ass!
These three parameters are not checked!
(get_current_position_url
, set_target_position_url
, get_current_state_url
)
If you forgot to write them in your accessory, the module will crash.
Also, in the set_target_position_url
parameter, the placeholder %position%
will be replaced by the value selected in the iPhone's Home App.
There are more configuration options.
The names are self-descriptive.
Here are them all with their default values.
{
"get_current_position_method": "GET",
"set_target_position_method": "POST",
"get_current_state_method": "GET",
"get_current_position_expected_response_code": "200",
"set_target_position_expected_response_code": "204",
"get_current_state_expected_response_code": "200",
"get_current_position_polling_millis": "500",
"get_current_state_polling_millis": "500",
"no_cache_duration_millis": "60000"
}
The three URLs specified in the accessory configuration must have the following data formats:
get_current_position_url
This URL must return the current blinds position in plaintext, from 0 to 100.
(0 being closed and 100 opened)
set_target_position_url
This URL must trigger the blinds movement.
(That's the part you've done with your Raspberry Pi)
The requested opening position is, once again, an integer from 0 to 100.
Please note that is passed directly in the URL. (It's the %position%
placeholder)
Yep, that's it.
Not a single trace of json.
Are we barbarians or are we not?
get_current_state_url
This is the trickiest URL.
It must return one of these three integers in plaintext:
Once again, that's your part of the job, the one you're supposed to implement in your blind manager thingymagic.
Click here to see an example implementation of this HTTP server.