Skip to content

A bridge to connect HTTP-based IoT devices to MQTT

License

Notifications You must be signed in to change notification settings

maxkueng/http2mqtt

Repository files navigation

http2mqtt

A bridge to connect HTTP-based IoT devices to MQTT. Supports Home Assistant discovery.

Note: This project is still in development and new releases might introduce unannounced breaking changes regularly.

Supported Devices

NOTE: If your Edimax plug uses recent firmware (v3) and you don't know your plug's password, please refer to this guide on how to factory-reset your plug and obtain its auto-generated password during setup.

Home Assistant Discovery

Note that Device Triggers won't show up as entities under the device. They are, however, available as triggers in the automation editor UI.

myStrom WiFi Button

Name Device Type Trigger Type Trigger Subtype Value Units
Single Press Device Trigger button_short_press button_1
Double Press Device Trigger button_double_press button_1
Long Press Device Trigger button_long_press button_1
Battery Sensor Battery level %

myStrom WiFi Button Plus

Name Device Type Trigger Type Trigger Subtype Value Units
Single Press Device Trigger button_short_press button_1
Double Press Device Trigger button_double_press button_1
Long Press Device Trigger button_long_press button_1
Touch Device Trigger button_short_press button_2
Wheel Sensor Number between wheelMin and wheelMax
Wheel Final Device Trigger button_short_press button_3
Battery Sensor Percentage level %

myStrom WiFi Switch

Name Device Type Value Units
Relay Switch
Power Sensor Power usage W
Temperature Sensor Temperature °C

Edimax Smart Plug

Name Device Type Value Units
Relay Switch
Power Sensor Power usage W
Amperage Sensor Power current / amperage A

Shelly 1PM

Name Device Type Value Units
Relay Switch
Power Sensor Power usage W
Temperature Sensor PCB Temperature °C

Note that the temperature is the operating temperature of the device i.e. PCB temperature, not the room temperature.

Shelly 1

Name Device Type Value Units
Relay Switch

Configuration

  • logLevel: (optional; default: 'info') Log level. One of "error", "warn", "info", "verbose", "debug", "silly".
  • http.host (optional; default: '0.0.0.0'): Interface IP for the HTTP server to listen on.
  • http.port (optional; default: 8321): Port for the HTTP server to listen on.
  • mqtt.broker (required): MQTT Broker URL.
  • mqtt.username (optional): MQTT broker username.
  • mqtt.password (optional): MQTT broker password.
  • mqtt.homeAssistant.discovery (optional; default: false): Enable publishing discovery information for Home Assistant.
  • options.PLUGIN_NAME (optional): Plugin-specific options

myStrom Buttons Plugin Options

  • mystrom-buttons.route (optional; default: "/mystrom-buttons"): Route path under which to handle actions from the buttons
  • mystrom-buttons.mqttTopic (optional; default: 'http2mqtt/mystrom/wifi_buttons'): MQTT topic prefix under which to publish button states
  • mystrom-buttons.buttons (required): Configuration for each button. Only buttons configured here will be handled.

Button Configuration

  • mac (required): MAC address of the button
  • name (required): A friendly name for the button
  • type (required): Either "button" or "button-plus" for myStrom Wifi button or myStrom Wifi Button Plus respectively
  • wheelMin (button-plus only; required): Minimum value for the wheel
  • wheelMax (button-plus only; required): Maximum value for the wheel
  • wheelSpeed (button-plus only; optional; default: 1): Multiplier for the wheel value. Higher number means fewer rotations to go from wheelMin to wheelMax and vice versa

myStrom Switch Plugin Options

  • mystrom-switch.mqttTopic (optional; default: 'http2mqtt/mystrom/wifi_switches'): MQTT topic prefix under which to publish switch states
  • mystrom-switch.switches (required): Configuration for each switch. Only switches configured here will be handled.

Switch Configuration

  • host (required): Host or IP address of the switch.
  • name (required): A friendly name for the switch.

Edimax Plug Plugin Options

  • edimax-plug.mqttTopic (optional; default: 'http2mqtt/edimax/wifi_plugs'): MQTT topic prefix undwe which to publish switch states.
  • edimax-plug.switches (required): Configuration for each switch. Only switches configured here will be handled.

Switch Configuration

  • host (required): Host or IP address of the switch.
  • name (required): A friendly name for the switch.
  • username (optional; default: 'admin'): Username to log in to the switch.
  • password (required): Password to log in to the switch.

Shelly Switch Plugin Options

  • shelly-switch.mqttTopic (optional; default: 'http2mqtt/shelly/wifi_relays'): MQTT topic prefix undwe which to publish switch states.
  • shelly-switch.switches (required): Configuration for each switch. Only switches configured here will be handled.

Switch Configuration

  • type (required): Either "shelly-1" or "shelly-1pm" for Shelly 1 or Shelly 1PM respectively.
  • host (required): Host or IP address of the switch.
  • name (required): A friendly name for the switch.
  • username (optional; default: 'admin'): Username to log in to the switch.
  • password (optional): Password to log in to the switch.

Example

{
  "http": {
    "host": "0.0.0.0",
    "port": 8321
  },
  "mqtt": {
    "broker": "mqtt://10.13.37.42:1883",
    "username": "user",
    "password": "secret"
  },
  "homeAssistant": {
    "discovery": "yes"
  },
  "options": {
    "mystrom-buttons": {
      "route": "/mystrom/generic",
      "buttons": [
        {
          "mac": "BADA55FA7A55",
          "name": "Kitchen Wifi Button Plus",
          "type": "button-plus",
          "wheelMin": 0,
          "wheelMax": 255,
          "wheelSpeed": 2.5
        },
        {
          "mac": "FA7A55BADA55",
          "name": "Bathroom Wifi Button",
          "type": "button"
        }
      ]
    },
    "mystrom-switch": {
      "switches": [
        {
          "host": "10.13.37.43",
          "name": "Wifi Switch 1"
        },
        {
          "host": "10.13.37.44",
          "name": "Wifi Switch 2"
        }
      ]
    },
    "edimax-plug": {
      "switches": [
        {
          "name": "Edimax Switch 1",
          "host": "10.13.37.45",
          "username": "admin",
          "password": "1234"
        }
      ]
    },
    "shelly-switch": {
      "switches": [
        {
          "type": "shelly-1pm",
          "host": "10.13.37.46",
          "name": "Shelly 1PM",
          "username": "chiefcommander",
          "password": "s3cr3t"
        }
      ]
    }
  }
}

License

Copyright (c) 2020 Max Kueng

MIT License

About

A bridge to connect HTTP-based IoT devices to MQTT

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published