npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

homebridge-http-iot

v1.3.1

Published

Control your IoT device with HTTP requests.

Downloads

28

Readme

Homebridge HTTP IoT

npm version verified-by-homebridge npm donate

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:

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

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

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