Skip to content
Example to forward BLE beaconing sensors into MagicMirror² platform
JavaScript Python Shell
Branch: master
Clone or download
Latest commit a841c4b Oct 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
documentation documentation for readme Oct 16, 2019
firmwares add firmware for movesense state changer Oct 17, 2019
gateway
images
scripts add screen set on / off script Oct 16, 2019
translations commit1 Oct 15, 2019
LICENSE Initial commit Oct 15, 2019
MMM-SensorGateway.js
README.md
install.sh add screen script copy to install Oct 16, 2019
node_helper.js fix on / off Oct 16, 2019
package-lock.json package-lock.json Oct 16, 2019
package.json

README.md

MMM-SensorGateway

Want to get Live Sensor data to your mirror without touching the Pi hardware? This module enables taking a shortcut by utilizing the BLE advertisment beacons from sensors and route that info via gateway into MagicMirror² platform.

MagicMirror² platform

MagicMirror² 3rd party modules

Movesense

Ruuvi

Example UI of module installed

Example UI

  • RuuviTag(s) environment information is routed to MagicMirror platform.
  • (optional) Movesense tag is used as a control platform / "poor man's" power switch for demo purposes

Installation guide

Out of scope

Clone and configure module

  • Clone MMM-SensorGateway under modules in the MM2 platform as all 3rd party modules
  • run npm install in module's directory to install websocket and exec modules.
  • Configuration (into config/config.js) :
		{
			module: "MMM-SensorGateway",
			position: "bottom_bar",
			config: {
					controlsensor:
					{
						type: "movesense",
						MAC: "01:11:12:C2:18:04"
					},
					envsensors: [
						{
							type: "ruuvi",
							location: "Living room2",
							MAC: "FE:11:11:1C:11:11"
						},
						{
							type: "ruuvi",
							location: "Bedroom",
							MAC: "D3:21:CC:34:DF:95"
						},
						{
							type: "ruuvi",
							location: "Balcony",
							MAC: "CE:90:63:D7:33:60"
						}
					]
			}
 }

controlsensor is optional configuration block

MAC please note all MAC ADDRESSES are in UPPERCASE

location is arbitrary string

type is for future development

Install script for Gateway

  • run install script with root priviledges : MagicMirror/modules/MMM-SensorGateway $ sudo ./install.sh
    • This will setup an service that will kick in during RasPi boot-up
  • Expected output
Remove existing service
Removed /etc/systemd/system/default.target.wants/local_blegateway.service.
Creating service
Write service file
Write launcher file /usr/share/local_blegateway/local_blegatewaykickstart.sh
Enable service
Created symlink /etc/systemd/system/default.target.wants/local_blegateway.service → /lib/systemd/system/local_blegateway.service.

If everything went well, service can be started, stoped and status checked
by normal service commands, like:
   sudo service local_blegateway start
   sudo service local_blegateway status
   sudo service local_blegateway stop
  • Start service (or reboot Pi) : sudo service local_blegateway start
    • (optional) verify that service is running:
sudo service local_blegateway status

--> you should expect seeing the packets routed:

Oct 16 19:45:40 raspberrypi local_blegatewaykickstart.sh[962]: {'temp': 22, 'battery': 0, 'state': 1, 'packet': 189, 'MAC': '0A:1C:1C:12:18:04', 'type': 'movesense'}
Oct 16 19:45:40 raspberrypi local_blegatewaykickstart.sh[962]: {'acceleration': 1003.0807544759296, 'pressure': 1008.86, 'temperature': 20.17, 'acceleration_y': -9, 'acceleration_x': -9, 'battery': 3043, 'acceleration_z': 1003, 'data_for

Troubleshooting

  • Gateway and MM2 module uses TCP port 8001 for communicating (check if another software is using this)
  • Gateway can be changed to route beacons to local network (for example debugging from PC). See def _main(argv): in bleAdvWebSocket.py
  • Run gateway manually go to gateway folder and sudo python bleAdvWebSocket.py
  • Check that MAC ADDRESSES are in UPPERCASE in configuration
  • RuuviTags are broadcasting with Data Format 3 Protocol Specification (RAWv1)

Special thanks

You can’t perform that action at this time.