homebridge-http-iot
v1.3.1
Published
Control your IoT device with HTTP requests.
Downloads
28
Maintainers
Readme
Homebridge HTTP IoT
Control your IoT device with HTTP requests.
Type of Accessory:
- Lightbulb
- Switch
- Outlet
Type of IoT devices:
- Arduino with own IoT API (response as a plain text)
- Tasmota (response as a json string)
- Shelly (response as a json object)
Configuration:
- Main Configuration
- Lightbulb On Configuration
- Lightbulb Brightness Configuration
- Lightbulb Hue Configuration
- Lightbulb Color Temperature Configuration
- Lightbulb Example Configuration
- Switch Configuration
- Outlet Configuration
Installation
- Install homebridge using instruction from: Homebridge WiKi
- Install this plugin in your homebridge
- Update your configuration file with code like the sample below
HTTP IoT Main Configuration Parameters
Name | Value | Required | Notes
------------------------ | ------------------- | -------- | ------------------------
accessory
| "HTTP-IoT" | yes | Must be set to "HTTP-IoT"
.
name
| (custom) | yes | Name of accessory that will appear in homekit app.
type
| "lightbulb" | no | Type of accessory "lightbulb"
, "switch"
or "outlet"
, default is: "lightbulb"
.
updateInterval
| 0 | no | Auto Update Interval in milliseconds, 0 = Off
debugMsgLog
| 0 | no | 1 - Displays messages of accessories in the log.
Lightbulb On Configuration Parameters
The Lightbulb On Characteristic supports text
and json
as respons.
Name | Value | Required | Notes
------------------------ | --------------------------- | -------- | ------------------------
lightbulbGetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to get the state.lightbulbGetOn.method
| "GET" | yes | The HTTP method.lightbulbGetOn.pattern
| "power: 1" | yes | The response for a on
or 1
lightbulbGetOn.json
| "ison" | no | The json item, if the response is a json object.lightbulbSetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set ON.lightbulbSetOn.method
| "POST" | yes | The HTTP method.lightbulbSetOff.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set OFF.lightbulbSetOff.method
| "POST" | yes | The HTTP method.
Lightbulb Brightness Configuration Parameters (is Optional)
Name | Value | Required | Notes
-------------------------------------- | --------------------------- | -------- | ------------------------
lightbulbGetBrightness.url
| "http://10.0.0.100/api/..." | yes* | The url for brightness control, to get the state.lightbulbGetBrightness.method
| "GET" | yes* | The HTTP method.lightbulbGetBrightness.removeBefore
| "brightness: " | no | Remove this string in the response before the value.lightbulbGetBrightness.removeAfter
| "" | no | Remove this string in the response after the value.lightbulGetBrightness.json
| "brightness" | no | The json item, if the response is a json object.lightbulbSetBrightness.url
| "http://10.0.0.100/api/..." | yes* | The url for brightness control.lightbulbSetBrightness.method
| "POST" | yes* | The HTTP method.lightbulbSetBrightness.replaceNumber
| "%brightness%" | no | This string is replace with the value in the url. If not set, the value is add to the url.
Lightbulb Hue Configuration Parameters (is Optional)
Name | Value | Required | Notes
------------------------------- | --------------------------- | -------- | ------------------------
lightbulbGetHue.url
| "http://10.0.0.100/api/..." | yes* | The url for hue control, to get the state.lightbulbGetHue.method
| "GET" | yes* | The HTTP method.lightbulbGetHue.removeBefore
| "hue: " | no | Remove this string in the response before the value.lightbulbGetHue.removeAfter
| "" | no | Remove this string in the response after the value.lightbulbGetHue.json
| "hue" | no | The json item, if the response is a json
lightbulbSetHue.url
| "http://10.0.0.100/api/..." | yes* | The url for hue control.lightbulbSetHue.method
| "POST" | yes* | The HTTP method.lightbulbSetHue.replaceNumber
| "%hue%" | no | This string is replace with the value in the url. If not set, the value is add to the url.
Lightbulb Color Temperature Configuration Parameters (is Optional)
The Home app in IOS crashes when trying to change this value as a color instead of the color temperature. (10'2023)
Name | Value | Required | Notes
-------------------------------------------- | --------------------------- | -------- | ------------------------
lightbulbGetColorTemperature.url
| "http://10.0.0.100/api/..." | yes* | The url for color temperature control, to get the state.lightbulbGetColorTemperature.method
| "GET" | yes* | The HTTP method.lightbulbGetColorTemperature.removeBefore
| "color_temp: " | no | Remove this string in the response before the value.lightbulbGetColorTemperature.removeAfter
| "" | no | Remove this string in the response after the value.lightbulbGetColorTemperature.json
| "color_temp" | no | The json item, if the response is a json
lightbulbSetColorTemperature.url
| "http://10.0.0.100/api/..." | yes* | The url for color temperature control.lightbulbSetColorTemperature.method
| "POST" | yes* | The HTTP method.lightbulbSetColorTemperature.replaceNumber
| "%color_temp%" | no | This string is replace with the value in the url. If not set, the value is add to the url.lightbulbSetColorTemperature.unit
| "kelvin" | no | Set unit to "kelvin"
if the device supports Kelvin instead of HomeKit unit Mired. (Mired = 1,000,000 / Kelvin)
Lightbulb Example Configuration
"accessories": [
{
"accessory": "HTTP-IoT",
"name": "Spöka 2.0",
"type": "lightbulb",
"updateIntervall": 10000,
"debugMsgLog": 1,
"lightbulbGetOn": {
"url": "http://10.0.0.100/api/v1/led?power",
"method": "GET",
"pattern": "power: 1"
},
"lightbulbSetOn": {
"url": "http://10.0.0.100/api/v1/led?power=1",
"method": "POST"
},
"lightbulbSetOff": {
"url": "http://10.0.0.100/api/v1/led?power=0",
"method": "POST"
},
"lightbulbGetBrightness": {
"url": "http://10.0.0.100/api/v1/led?brightness",
"method": "GET",
"removeBefore": "brightness: "
},
"lightbulbSetBrightness": {
"url": "http://10.0.0.100/api/v1/led?brightness=%brightness%",
"method": "POST",
"replaceNumber": "%brightness%"
},
"lightbulbGetHue": {
"url": "http://10.0.0.100/api/v1/led?hue",
"method": "GET",
"removeBefore": "hue: "
},
"lightbulbSetHue": {
"url": "http://10.0.0.100/api/v1/led?hue=%hue%",
"method": "POST",
"replaceNumber": "%hue%"
},
"lightbulbGetColorTemperature": {
"url": "http://10.0.0.100/api/v1/led?color_temp",
"method": "GET",
"removeBefore": "color_temp: ",
"unit": "kelvin"
},
"lightbulbSetColorTemperature": {
"url": "http://10.0.0.100/api/v1/led?color_temp=%color_temp%",
"method": "POST",
"replaceNumber": "%color_temp%",
"unit": "kelvin"
}
},
{
"accessory": "HTTP-IoT",
"name": "Tasmota WLan lightbulb",
"type": "lightbulb",
"updateIntervall": 10000,
"debugMsgLog": 1,
"lightbulbGetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Status",
"method": "GET",
"pattern": "{\"POWER\":\"ON\"}"
},
"lightbulbSetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20On",
"method": "POST"
},
"lightbulbSetOff": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Off",
"method": "POST"
}
},
{
"accessory": "HTTP-IoT",
"name": "Shelly Dimmer",
"type": "lightbulb",
"updateIntervall": 10000,
"debugMsgLog": 1,
"lightbulbGetOn": {
"url": "http://10.0.0.103/light/0",
"method": "GET",
"pattern": "true",
"json": "ison"
},
"lightbulbSetOn": {
"url": "http://10.0.0.103/light/0?turn=on",
"method": "GET"
},
"lightbulbSetOff": {
"url": "http://10.0.0.103/light/0?turn=off",
"method": "GET"
},
"lightbulbGetBrightness": {
"url": "http://10.0.0.103/light/0",
"method": "GET",
"json": "brightness"
},
"lightbulbSetBrightness": {
"url": "http://10.0.0.103/light/0?brightness=%brightness%",
"method": "GET",
"replaceNumber": "%brightness%"
}
}
]
Switch Configuration Parameters
The Switch On Characteristic supports text
and json
as respons.
Name | Value | Required | Notes
----------------------| --------------------------- | -------- | ------------------------
switchGetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to get the state.switchGetOn.method
| "GET" | yes | The HTTP method.switchGetOn.pattern
| "power: 1" | yes | The response for a on
or 1
switchGetOn.json
| "ison" | no | The json item, if the response is a json object.
switchSetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set ON.switchSetOn.method
| "POST" | yes | The HTTP method.switchSetOff.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set OFF.switchSetOff.method
| "POST" | yes | The HTTP method.
"accessories": [
{
"accessory": "HTTP-IoT",
"name": "HTTP Switch",
"type": "switch",
"updateIntervall": 10000,
"debugMsgLog": 1,
"switchGetOn": {
"url": "http://10.0.0.100/api/v1/led?power",
"method": "GET",
"pattern": "power: 1"
},
"switchSetOn": {
"url": "http://10.0.0.100/api/v1/led?power=1",
"method": "POST"
},
"switchSetOff": {
"url": "http://10.0.0.100/api/v1/led?power=0",
"method": "POST"
}
},
{
"accessory": "HTTP-IoT",
"name": "Tasmota WLan Switch",
"type": "switch",
"updateIntervall": 10000,
"debugMsgLog": 1,
"switchGetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Status",
"method": "GET",
"pattern": "{\"POWER\":\"ON\"}"
},
"switchSetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20On",
"method": "POST"
},
"switchSetOff": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Off",
"method": "POST"
}
},
{
"accessory": "HTTP-IoT",
"name": "Shelly Switch",
"type": "switch",
"updateIntervall": 10000,
"debugMsgLog": 1,
"switchGetOn": {
"url": "http://10.0.0.102/relay/0",
"method": "GET",
"pattern": "true",
"json": "ison"
},
"switchSetOn": {
"url": "http://10.0.0.102/relay/0?turn=on",
"method": "GET"
},
"switchSetOff": {
"url": "http://10.0.0.102/relay/0?turn=off",
"method": "GET"
}
},
]
Outlet Configuration Parameters
The Outlet On Characteristic supports text
and json
as respons.
Name | Value | Required | Notes
----------------------| --------------------------- | -------- | ------------------------
outletGetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to get the state.outletGetOn.method
| "GET" | yes | The HTTP method.outletGetOn.pattern
| "power: 1" | yes | The response for a on
or 1
outletGetOn.json
| "ison" | no | The json item, if the response is a json object.
outletSetOn.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set ON.outletSetOn.method
| "POST" | yes | The HTTP method.outletSetOff.url
| "http://10.0.0.100/api/..." | yes | The url for power control, to set OFF.outletSetOff.method
| "POST" | yes | The HTTP method.
"accessories": [
{
"accessory": "HTTP-IoT",
"name": "HTTP Outlet",
"type": "outlet",
"updateIntervall": 10000,
"debugMsgLog": 1,
"outletGetOn": {
"url": "http://10.0.0.100/api/v1/led?power",
"method": "GET",
"pattern": "power: 1"
},
"outletSetOn": {
"url": "http://10.0.0.100/api/v1/led?power=1",
"method": "POST"
},
"outletSetOff": {
"url": "http://10.0.0.100/api/v1/led?power=0",
"method": "POST"
}
},
{
"accessory": "HTTP-IoT",
"name": "Tasmota WLan Outlet",
"type": "outlet",
"updateIntervall": 10000,
"debugMsgLog": 1,
"outletGetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Status",
"method": "GET",
"pattern": "{\"POWER\":\"ON\"}"
},
"outletSetOn": {
"url": "http://10.0.0.101/cm?cmnd=Power%20On",
"method": "POST"
},
"outletSetOff": {
"url": "http://10.0.0.101/cm?cmnd=Power%20Off",
"method": "POST"
}
},
{
"accessory": "HTTP-IoT",
"name": "Shelly Outlet",
"type": "outlet",
"updateIntervall": 10000,
"debugMsgLog": 1,
"outletGetOn": {
"url": "http://10.0.0.102/relay/0",
"method": "GET",
"pattern": "true",
"json": "ison"
},
"outletSetOn": {
"url": "http://10.0.0.102/relay/0?turn=on",
"method": "GET"
},
"outletSetOff": {
"url": "http://10.0.0.102/relay/0?turn=off",
"method": "GET"
}
},
]
Test Homebridge HTTP IoT
- Download or clone Homebridge-HTTP-IoT.
- Install:
$ npm install
- Build:
$ npm run build
- Run:
$ homebridge -D -P ~/Homebridge-HTTP-IoT