This projects combines the MagicMirror² project with the balenaCloud platform. It drastically improves management of multiple MagicMirror² devices.
Requirements
Free Balena Cloud Account (Depending on how many devices you want to manage)
Raspberry Pi (Not the Zero)
How to setup
Clone this repository to your local PC
Initialize submodules
execute git submodule update --init --recursive
Add your config.js
The config.js file defines the content of your MagicMirror. Modify the existing config.js file in MagicMirror/config as you like.
Mandatory fleet configuration
You need to set the GPU memory to something suitable for hardware accelerated graphics. You can set only one of the following if you know how much RAM your Pi has or you can set all of them and your Pi will autoselect based on its memory.
Checkout the balena-wpe project for more information, it is used to display the MagicMirror² interface
Key
Value
RESIN_HOST_CONFIG_gpu_mem_256
128
RESIN_HOST_CONFIG_gpu_mem_512
196
RESIN_HOST_CONFIG_gpu_mem_1024
396
Add modules
Modules must be placed in MagicMirror/modules. You can use git submodules or just copy the module into this directory.
Upload to your project
Install the balena CLI tools and push to your project by executing balena push MY_PROJECT
You should see a unicorn if everything is finished
In your balena cloud dashboard you should see your device (or fleet) to update and fetch the just pushed changes
Additional Configuration
Timezone
In Balena Cloud add an environment variable named TZ, as a value add your timezone according to this documentation
The environmental variable can either be added to the whole fleet, or just to an individual device
Rotating Display
Add RESIN_HOST_CONFIG_display_rotate as a custom configuration variable, note the values below.
Description
Value
Normal
0
90°
1
180°
2
270°
3
Things you should know
MagicMirror² Network Port
You can't use the port 8080, it is already used by the "Browser" service.
The default port has been changed to 90 instead.
Known issues
Unstable MagicMirror service (restarting every now and then)
Browser starting before the MagicMirror service has been started resulting in a white screen on rare occasions
Workaround: Just restart the Browser service when this happens
Navigate into the MMM-BalenaWatcher folder with cd ~/MagicMirror/modules/MMM-BalenaWatcher and get the latest code from github with git pull.
If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.
Using the module
To use this module, add the following configuration block as the first element of the modules array in the config/config.js file:
{module: 'MMM-BalenaWatcher'}
License
The MIT License (MIT)
Copyright (c) 2018 David Gölzhäuser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Navigate into the MMM-ENV-Provider folder with cd ~/MagicMirror/modules/MMM-ENV-Provider and get the latest code from github with git pull.
If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.
Using the module
To use this module, add the following configuration block as the first element of the modules array in the config/config.js file:
{module: 'MMM-ENV-Provider'}
Use it in config.js
Add the following function in the config.js file:
functiongetEnv(envKey){if(typeofmodule!=="undefined"){returnprocess.env[envKey];}else{try{varxmlhttp=newXMLHttpRequest();xmlhttp.open("GET","/env",false);xmlhttp.send();if(xmlhttp.status===200){returnJSON.parse(xmlhttp.responseText)[envKey];}else{throw"Unexpected status code!";}}catch(e){console.error(e);returnnull;}}}
Use the function like this:
getEnv("MY_ENV");
License
The MIT License (MIT)
Copyright (c) 2018 David Gölzhäuser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Support controls like Alarm, WindowMonitor, Simple Virtual outputs, Weather in a modular way
Further power saving features (Ability to switch off the monitors AC power via an relay)
Quick overview, whats up in your home
Installation
Navigate into your MagicMirror's modules folder:
cd~/MagicMirror/modules
Clone this repository:
git clone https://github.com/idoodler/MMM-Loxone
Navigate to the new MMM-Loxone folder and install the node dependencies.
npm install
Update the module
Navigate into the MMM-Loxone folder with cd ~/MagicMirror/modules/MMM-Loxone and get the latest code from github with git pull.
If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.
Using the module
To use this module, add the following configuration block to the modules array in the config/config.js file:
varconfig={modules: [{module: 'MMM-Loxone',config: {// See below for configurable options}}]}
Configuration options
Option
Description
host
Required: Defines the Loxone Miniserver host. It can be an IP or your CloudDNS address
Example:192.168.0.46 or dns.loxonecloud.com/EEE00000000
Type:string
user
Required: Defines the Loxone Miniserver username.
Type:string
pwd
Required: Defines the Loxone Miniserver password.
Type:string
roomUuid
Optional: Defines the room of which the room temperature is displayed
Info: Modules like the default currentWeather and MMM-forecast-io will display the indoor temperature, please refere to their documentation
Type:string
observingUuids
Optional: Defines controls that should be shown on our module. Supported Controls: Virtual State, State
Type:array
Default:Empty array
presence
Optional: If enabled this module will use the LightControllerV2 in the defined room, or the virtual state defined in presenceUuid to set the MagicMirror to sleep or wake it up
Type:bool
Default:false
presenceUuid
Optional: Defines a digital virtual state control that will be used to detect presende. If the virtual state is ON the mirror will be on, if the state if OFF the mirror will be off
Note: Can be used to override the default behaviour of using the first LightControllerV2 in the room
Type:string
fadeOut
Optional: Fades out the webinterface before the HDMI output is disabled (MagicMirror goes to sleep)
Type:bool
Default:false
showInfoNotifications
Optional: If info notifications should be shown.
Type:bool
Default:true
showErrorNotifications
Optional: If error notifications should be shown. Type:bool
Default:true
showSystemNotifications
Optional: If system notifications should be shown.
Type:bool
Default:true
showNotificationOfControlTypes
Optional: Defines, what controls are able to show notifications on your MagicMirror².
Navigate to the control you want to display on your mirror
Virtual State and State controls are supported
Copy the last path component displayed in your browsers URL-Bar
Developer notes
Notifications emitted by MMM-Loxone
NotificationKey
Description
INDOOR_TEMPERATURE
Modules like the default currentWeather and MMM-forecast-io will display the indoor temperature. Please implement this notification key if you want to display the indoor temperature in your module.
Note:roomUUID must be configured in your config.json
USER_PRESENCE
Modules can use this notification to pause or resume your module.
Example:true if the User is present in the room, false if not.
Payload:bool
Note:roomUUID and presence must be configured in your config.json
LOXONE_STATE
Any state emitted by the Loxone Miniserver with its UUID and value. Ready to be used by any other module.
Payload:Number or String
Note:allow3rdParty must be configured in your config.json
LOXONE_STRUCTURE_FILE
The current structure file of the Loxone Miniserver as an Object {}.
Payload:Object
Note:allow3rdParty must be configured in your config.json
LOXONE_OSS
Out Of Service status of the Loxone Miniserver.
Example:true if the Miniserver is rebooting, false if the Miniserver is up and running.
Payload:bool
Note:allow3rdParty must be configured in your config.json
Next steps
Statistics
Systemstate
License
The MIT License (MIT)
Copyright (c) 2018 David Gölzhäuser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Navigate to the new MMM-RPI-LED folder and install the node dependencies.
npm install
Update the module
Navigate into the MMM-RPI-LED folder with cd ~/MagicMirror/modules/MMM-RPI-LED and get the latest code from github with git pull.
If you haven't changed the modules, this should work without any problems. Type git status to see your changes, if there are any, you can reset them with git reset --hard. After that, git pull should be possible.
Using the module
To use this module, add the following configuration block to the modules array in the config/config.js file:
varconfig={modules: [{module: 'MMM-RPI-LED',config: {// See below for configurable options}}]}
Configuration options
Option
Description
ledMode
required Defines the mode of the Raspberry Pi's LEDs
Example:0 = Off, no LED is light up or 1 = Heart beat, the green LED blinks
Type:number
License
The MIT License (MIT)
Copyright (c) 2018 David Gölzhäuser
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
everytime the user starts the application, so the data always is up-to-date. Then you can replace
NSLocalizedString(@"String", nil)
with
[POEditor localizedStringWithKey:@"String"]
In addition you can get the contributors of your project. Just call
[POEditor contributors];
this will return a
NSDictionary
in this formate:
@{@[Name, Email], Language}
I implemented Xcodes dokumentation function to make it even easier to understand. Have fun and please make an issue if you miss a feature of find a bug. Have a nice day!
You may enable "Localized resources can be mixed" in info.plist
It allows you to display notifications right on the StatusBar. Tap handlers are also supported!
Either import the ready framework or drag SBNotification.xcodeproj into your project to reference it.
Then import SBNotification
Example:
importSBNotification// This toggles a red notification without any tap handler
SBNotificationManager.showNotification("Awesome Notification", duration: 20, type: .error)
0
0
0
0
ZeroAPS
ZeroAPS
Use a Raspberry Pi Zero and a few other components to build your compact close loop with OpenAPS
I am also working on an ultra compact Intel Edison version
1x Micro SD Card 8GB To install Raspbian the OS the Raspberry Pi Zero is running
[Some way to connect your Raspberry Pi Zero to the internet]
I used an Raspberry Pi 2 I had laying around (I basically set up Raspbian and downloaded everything following on the Raspberry Pi 2/3 and then swap the micro SD card to the Raspberry Pi Zero
You will get a small portable Raspberry Pi Zero based device with a decent battery life (> 24 hours) and a much better and stabile communication to your pump. Thats all because we won't use that overpriced crappy CareLink stick.
What you won't get
You won't get a finished product that you can clip on like your insulin pump. It's basically just 3 PCBs glued together and bundled with a battery. I'm still working on a clip on option, but I still haven't had the right idea. Feel free to share yours:) You also won't get a complete guide on how to setup your close loop, but I include all the links, so just follow along and I am sure you will make it, if you can master diabetes you can you will master this!
Don't hesitate to ask me if you have any questions.
Lets start with the software
You need to setup Raspbian, it is the operating system we use for the Raspberry Pi Zero
Download here. We are using Jessie Light because we don't need the fully fledged Raspbian
Once downloaded you need to burn the files to the SD card, follow this instructions and you are good to go
Now swap your micro SD card in your Raspberry Pi Zero if you have not already
If you want to access your Raspberry Pi Zero via USB there is an option for that 😊
**(This only works if you don't need the USB OTG port!)**
* The Raspberry Pi Zero is capable of emulating USB devices with the USB OTG port, so we can simulate an Ethernet adapter. If you connect your Raspberry Pi Zero with your PC the Raspberry will create its own network. This allows you to directly SSH into your Raspberry Pi Zero. Please keep in mind, that if you enable this you won't be able to use a USB device on your Raspberry Pi Zero anymore.
* If you want to extend the battery live of your close loop you can disable the HDMI components and the ACT LED
* Disable HDMI **(Keep in mind that you won't get any output on the HDMI port if you do this)**
* Edit `rc.local by executing `sudo nano /etc/rc.local` in your Raspberry Pis command line
* Add `/usr/bin/tvservice -o` before `exit 0`
* Disable ACT LED **(The ACT LED is the little green LED that indicates, that your Raspberry Pi Zero is running)**
* Follow [this](http://www.jeffgeerling.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi) instructions
I recommend you to create a backup of your micro SD card, so you won't loos all the hard work!
Congratulations, the software part is done👍
Start with the hardware part
This may be a bit tricky if this is your first solder job, take your time and don't be frustrated if it is not working the first time. I am using an enamelled copper wire, so everything looks cleaner, but you can use normal wires to.
Make sure, that there is some sort of isolation around the wires, so you won't short out your Raspberry Pi Zero
We want to power the Raspberry Pi Zero
We can glue the PowerBoost PCB on the back of the Raspberry Pi Zero like this As a pro tip I also desoldered the PWR LED of the PowerBoost PCB (lower right side on the board), so can sleep better and won't get blind when looking at it.
I am using a very strong double sided foam tape, be careful when placing it on the Raspberry Pi Zero, it is very hard to remove!
Next we need to solder the power wires from the PowerBoost to the Raspberry Pi Zero
5V: Solder a wire from the PowerBoosts 5V output (on the lower side of the board) to the Raspberry Pi Zeros 5V GPIO pin 2
GND: Solder a wire from the PowerBoosts GND output (also on the lower side of the board) to the Raspberry Pi Zeros GND GPIO pin 6
**Be careful when soldering directly to the GPIO pins. We are using the Raspberry Pi upside down, so double check what hole you solder to, desoldering is a pain in the arse if you don't have the right tools!**
When you think everything is soldered correctly you can connect the battery. Your Raspberry Pi Zero should run from the battery if everything went well:)
* If you disabled the ACK LED you will only see a very quick flash
* You also can connect your Raspberry Pi Zero to the battery and also plug in the USB cable into Raspberry Pi Zeros USB OTG port to SSH into it.
* **Disconnect the power again!**
Communicate with the insulin pump
Her we first solder every wire to the SRF board, then glue it down and then solder the wires to the Raspberry Pi Zero
Solder the wires according to the color in the picture below.
By default the MMowlink will use the US frequency which is awesome if you live in the US and have an US pump, but for us non US citizens we need to do an additional step
Every time the Raspberry Pi Zero boots we need to execute a little command to tune it for the World Wide frequency band
Edit rc.local by executing sudo nano /etc/rc.local in your Raspberry Pis command line
Add su pi -c '/home/pi/mmeowlink-source/bin/mmtune.py --port /dev/ttyAMA0 --radio_local WW --serial <PUMP_SERIAL_NUMBER> < /dev/null &' before exit 0
*WW means World Wide*
[Optional] Increase the range with an antenna
With the SRF module we already have a greater range then with the CareLink USB stick, but we can tweak it a bit by soldering an approximately 8cm (3,14 inch) wire to the SRF modules antenna hole. With this you can even penetrate a wall!
Now check if everything works
The best way to check if everything works is to communicate with the pump
Do this by `cd` in your `openaps` directory on your Raspberry Pi Zero, then you can execute `openaps use status` to get the current status of your pump. If you get a response that is formatted like a JSON everything you have done was right!
If something is not working you need to find the issue. There is a trouble shooting guide below.
Congratulations, your ZeroAPS is ready to use now🎉
Make it more compact
Please be careful and don't destroy your Raspberry Pi Zero!
This is more of a bloody hack, but it will make it more compact. My goal is to have only one USB port on the Raspberry Pi, but the PowerBoost won't let us access the data pins of the micro USB, so we will use 2 micro USB ports for now. (I already contacted Adafruit because of that feature)
You can desolder the HDMI port and both micro USB ports of the Raspberry Pi. This makes it really flat. To compensate the lost USB OTG and power port you can glue an micro USB breakout board to a spare place on the other side of the Raspberry Pi Zero
Desolder the USB ports
**(First make sure you don't need them in the future, e.g for Dexcom receiver)**
* Get power
* Solder **GND** to **GND** of the PowerBoost
* Solder **VCC (or 5V)** to **Bat** of the PowerBoost
* Get data *(Directly solder to the gold pads on the Raspberry Pi)*
* Solder **D+** to **PP22**
* Solder **D-** to **PP23**
Desolder the HDMI port
Yep, thats all 😊
Thats how my APS is looking right now
I will update this when I make any changes
ZeroAPS from the top compared to a Paradigm 754ZeroAPS from the side compared to a Paradigm 754
Nice to know
The current power consumption is about 140mA(If you disabled the ACT LED and the HDMI)
With a 4400mAh battery we should have a battery live of about 31 hours which is not bad 😊
Common issues you might run into
Faulty solder connections
Check your solder connections with a multimeter
Can't communicate with the pump because of "low battery" or "Out of range" error
You might use the wrong frequency
Step 3 of the the hardware part explains it well
Your pumps battery may really be low, go and check it!
Antenna soldering issues
Desolder the antenna, lay your pump near the Raspberry Pi Zero and try it again
SRF module is defect
I had an old one laying around, but it was broken. I checked it by measuring the voltage of the "HeartBeat"-Pin (Pin 1 on the SRF module board). The voltage should be around 3.3V when your Pi is connected to power.
The Raspberry Pi Zero can't be powered by the PowerBoost, but everything works when connecting the Pi directly to a USB port
Check if the PowerBoost is working correctly
Measure the voltage on the GND and 5V pins we soldered to (Battery or USB needs to be plugged in to the PowerBoost of course 😊)
Measure the voltage of the battery by connecting the multimeter leads to the Bat and GND hole. The voltage should be between 4.1V (Max) to 3.2V (Min, the red LOW LED will light up)
Check if the PWR LED is on. If you desoldered it, like I did, you can check the voltage. There should be around 5V.
OpenAPS does work with the SRF module
Repeat part 4 of "Lets start with the software"
Contact me
Please contact me if you are having questions about ZeroAPS.
This website is a troll site targeting a german far right group named Reconquista Germanica.
Reconquista Germanica is spreading hate against immigrants, refugees, disabled people, journalists, and many more,
I just wanted to get the domain, before someone uses it for something bad 😏