1.1.0 • Published 4 years ago

homebridge-mqtt-power-strip v1.1.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

Homebridge MQTT Power Strip

npm version License: MIT

A Homebridge plugin to create grouped switches to control a power strip through MQTT.

Installation

Run npm install homebridge-mqtt-power-strip -g

Configuration

Note: The {id} string in the topics is replaced by a number (starting by one) representing each relay. So for the first relay the {id} will be replaced by 1 and so on. The maximum number is relayCount.

KeySubkeyRequiredDefault ValueNote
accessoryYesMust be 'mqttPowerStrip'.
nameYesThe name of your power strip.
manufacturerNoOxixesThe manufacturer of the power strip.
modelNoMQTT Power StripThe model of the power strip.
serialNo00N00The serial number of the power strip.
relayCountYesThe amount of relays your power strip has (as int).
mqttYesThe MQTT configuration.
hostYesThe MQTT host.
portYesThe MQTT port (as int).
usernameNoThe username to log in.
passwordNoThe password to log in.
qosNo1The Quality Of Service (subscribe and pusblish).
reconnectIntervalNo2000 (ms)The time between reconnections when the connection is lost with the broker (in ms).
connectTimeoutNo10000 (ms)The time to timeout with the broker (in ms).
maxErrorCountNo10Maximum time of reconnection attempts with the broker until the plugin gives up. You can use -1 to disable it.
topicsYes (at least one topic is needed)An object with the topics.
setOnNoThe topic to set a relay state. Use {id} in the topic for it to be replaced with a number from 1 - relayCount (see config. example).
getOnNoThe topic to get a relay state. Use {id} in the topic for it to be replaced with a number from 1 - relayCount (see config. example).
retrieveNoAn object that contains the topics needed to retrieve the state of the relays at boot.
notify (inside retrieve)NoA topic to sent a message to retrieve the data. You can use {id}.
get (inside retrieve)NoA topic to receive the state of each relay. You can use {id} and if it's the same topic as the getOn, you don't need to specify it.
message (inside retrieve)NoThe message to be sent on the notify topic. If it is not specified an empty message is sent.
namesNoAn array with "{name} Switch {id}" i.e. Test power strip Switch 1An array that contains the name for each id IN ORDER, so the first element is the first id and so on.
idsNoAn array with the numbers 1 to relayCountAn array that contains the IDs for each device IN ORDER, so the first element is the first name and so on.
onValueNo"true"The value the device sends as 'on'.
offValueNo"false"The value the device sends as 'off'.

Roadmap

  • Add support for SSL on the MQTT connection.
  • Allow to specify custom ids instead of numbers from 1 - relayCount.
  • Log less errors when something occurs.
  • Add ability to detect when the power strip goes online or offline.
  • Add UI support.

Bugs

If you discover a bug, please open an issue and I will try to solve it as fast as I can. Please provide the logs (the console output) and configuration file (only the relevant part) and be careful to not provide the MQTT username and password (replace those values with other ones) when submitting the issue.

Acknowledgment

This plugin was heavily inspired by homebridge-mqttthing.

License

MIT

1.1.0

4 years ago

1.0.0

4 years ago