Skip to content

Repository files navigation

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

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 : MMM-SensorGateway $ sudo ./install.sh
    • This will install required bluetooth, Ruuvi and websocket related packages (see the script for details)
    • This will also setup an service that will kick in during RasPi boot-up
  • Expected final 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

About

Example to forward BLE beaconing sensors into MagicMirror² platform

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages