1.2.0 • Published 7 months ago

homebridge-http-iot v1.2.0

Weekly downloads
-
License
-
Repository
github
Last release
7 months ago

Homebridge HTTP IoT

npm version verified-by-homebridge npm donate

Control your IoT device with HTTP requests.

Type of Accessory:

  • Lightbulb
  • Switch
  • Outlet

Configuration:

Installation

  1. Install homebridge using instruction from: Homebridge WiKi
  2. Install this plugin in your homebridge
  3. Update your configuration file with code like the sample below

HTTP IoT Main Configuration Parameters

NameValueRequiredNotes
accessory"HTTP-IoT"yesMust be set to "HTTP-IoT".
name(custom)yesName of accessory that will appear in homekit app.
type"lightbulb"noType of accessory "lightbulb", "switch" or "outlet", default is: "lightbulb".
updateInterval0noAuto Update Interval in milliseconds, 0 = Off
debugMsgLog0no1 - Displays messages of accessories in the log.

Lightbulb On Configuration Parameters

The Lightbulb On Characteristic supports text and json as respons.

NameValueRequiredNotes
lightbulbGetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to get the state.
lightbulbGetOn.method"GET"yesThe HTTP method.
lightbulbGetOn.pattern"power: 1"yesThe response for a on or 1
lightbulbSetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to set ON.
lightbulbSetOn.method"POST"yesThe HTTP method.
lightbulbSetOff.url"http://10.0.0.100/api/..."yesThe url for power control, to set OFF.
lightbulbSetOff.method"POST"yesThe HTTP method.

Lightbulb Brightness Configuration Parameters (is Optional)

NameValueRequiredNotes
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: "noRemove this string in the response before the value.
lightbulbGetBrightness.removeAfter""noRemove this string in the response after the value.
lightbulbSetBrightness.url"http://10.0.0.100/api/..."yes*The url for brightness control.
lightbulbSetBrightness.method"POST"yes*The HTTP method.
lightbulbSetBrightness.replaceNumber"%brightness%"noThis 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)

NameValueRequiredNotes
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: "noRemove this string in the response before the value.
lightbulbGetHue.removeAfter""noRemove this string in the response after the value.
lightbulbSetHue.url"http://10.0.0.100/api/..."yes*The url for hue control.
lightbulbSetHue.method"POST"yes*The HTTP method.
lightbulbSetHue.replaceNumber"%hue%"noThis 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)

NameValueRequiredNotes
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: "noRemove this string in the response before the value.
lightbulbGetColorTemperature.removeAfter""noRemove this string in the response after the value.
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%"noThis string is replace with the value in the url. If not set, the value is add to the url.
lightbulbSetColorTemperature.unit"kelvin"noSet 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"
            }
        }
    ]

Switch Configuration Parameters

The Switch On Characteristic supports text and json as respons.

NameValueRequiredNotes
switchGetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to get the state.
switchGetOn.method"GET"yesThe HTTP method.
switchGetOn.pattern"power: 1"yesThe response for a on or 1
switchSetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to set ON.
switchSetOn.method"POST"yesThe HTTP method.
switchSetOff.url"http://10.0.0.100/api/..."yesThe url for power control, to set OFF.
switchSetOff.method"POST"yesThe 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"
            }
        }
    ]

Outlet Configuration Parameters

The Outlet On Characteristic supports text and json as respons.

NameValueRequiredNotes
outletGetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to get the state.
outletGetOn.method"GET"yesThe HTTP method.
outletGetOn.pattern"power: 1"yesThe response for a on or 1
outletSetOn.url"http://10.0.0.100/api/..."yesThe url for power control, to set ON.
outletSetOn.method"POST"yesThe HTTP method.
outletSetOff.url"http://10.0.0.100/api/..."yesThe url for power control, to set OFF.
outletSetOff.method"POST"yesThe 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"
            }
        }
    ]

Test Homebridge HTTP IoT

  1. Download or clone Homebridge-HTTP-IoT.
  2. Install: $ npm install
  3. Build: $ npm run build
  4. Run: $ homebridge -D -P ~/Homebridge-HTTP-IoT
1.2.0

7 months ago

1.1.3

7 months ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago