homebridge-wssensor

Homebridge platform plugin that support's a network of nodemcu's to display Temperature and Humidity.

Usage no npm install needed!

<script type="module">
  import homebridgeWssensor from 'https://cdn.skypack.dev/homebridge-wssensor';
</script>

README

homebridge-wssensor

Plugin for NodeMCU Based sensors using WebSockets for realtime updates

Design Concept

  • Realtime device communications via WebSockets, and device discovery via mDNS
  • Homebridge Plugin creates a websocket server to receive updates from nodemcu devices.
  • Plugin advertises websocket server onto network via mDNS
  • NodeMCU discovers server by watching for mDNS advertisement
  • NodeMCU sends message to plugin containing sensor config
  • Plugin creates HK accessory for sensor ( Have ability to alias sensor name in config.json )
  • Plugin sends sensor state changes in realtime to plugin via WebSockets
  • Default publishing every minute?
  • Have sensor support multiple websocket servers?
  • Support for Legacy mcuiot mode?
  • Support for data logging to mcuiot-logger?

Supported configurations

  • AM312 or HC-SR501 Motion Sensor and BME280 or DHT22 Temperature sensor
  • MPU6050 Gyro / Acceleration sensor
  • Garage Door monitor / control
  • YL-69 Moisture Sensor / BME-280
  • Standalone BME280 Temperature Sensor

Supported sensors

Backlog - Plugin

  • Homebridge Plugin creates a websocket server to receive updates from nodemcu devices.
  • Plugin advertises websocket server onto network via mDNS
  • Plugin creates HK accessory for sensor ( Have ability to alias sensor name in config.json )
  • Plugin sends sensor state changes in realtime to HomeKit
  • Plugin sets Low Battery when sensor has an error
  • Plugin sets "No Response" when device is no longer responds on the network
  • Default publishing every minute?
  • Remove redundant code from plugin
  • Support fakeGato
  • Switch to event based model
  • Support for Legacy mcuiot mode?
  • Support for data logging to mcuiot-logger?

Backlog - NodeMCU

  • NodeMCU discovers server by watching for mDNS advertisement
  • NodeMCU sends message to plugin containing sensor config
  • Sensor sends state changes in realtime to plugin via WebSockets
  • Allow sensor to warm up before publishing, I believe I read 1 minute
  • Have sensor send not available status during warm up period -- Not required
  • Support for OTA Updates
  • Have sensor support multiple websocket servers
  • Support for Legacy mcuiot mode
  • Stop committing passwords to github!! -- Done

Installation - homebridge-wssensor

sudo npm install -g homebridge-wssensor

Configuration - homebridge-wssensor

{
  "platform": "wssensor",
  "name": "wssensor",
  "port": 4050,
  "refresh": "60",
  "storage": "fs",
  "leak": "10",
  "aliases": {
    "NODE-2BA0FF": "Porch Motion"
  }
}
  • port - Listener port for sensor to send data to
  • refresh - Polling frequency, defaults to 60 seconds
  • storage - Storage of chart graphing data for history graphing, either fs or googleDrive, defaults to fs
  • leak - Leak sensor alarm trigger percentage, defaults to 10%
  • service - Bonjour service name for discovery, defaults to "wssensor"
  • duration - Duration of motion sensor events, defaults to 10 seconds
  • aliases - Friendly names for your sensor's

Configuration - NodeMCU

See README in nodemcu directory

Credits

  • cflurin - Borrowed websocket implementation from homebridge-websocket
  • Frank Edelhaeuser - Borrowed lua mDNS Discovery code, and updated to support NodeMCU