-
-
Save pheisiph/d72d64f1c44beca28b26 to your computer and use it in GitHub Desktop.
Ninjablock to local MQTT server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This describes how you can connect your ninjablock to your own mqtt server | |
# It is not the best manual, so please provide feedback | |
# First of you have to start with the "beta" image found at: https://discuss.ninjablocks.com/t/unstable-brand-new-image-for-your-block/1666 | |
# Or direct link if you must: http://ninjablocks-nightly.s3.amazonaws.com/block/ubuntu_armhf_trusty_sterling_block-unstable_2014-07-16_1044.img.gz | |
# Then put that on an sdcard (like you normally would) | |
# Put it in the ninjablock | |
# Let it boot!! | |
# power off (upon first boot it creates a ssh key (needed for enabling ssh)) | |
# power on | |
# ssh to it ssh [email protected] (replace ip) pw: temppwd | |
# Now you are connected you can execute these commands in the same order. | |
# --------------------- Start of local ninjablock commands --------------------- | |
# Change the password to something only you know | |
passwd | |
# Disable upgrades | |
sudo chmod 000 /etc/apt/apt.conf.d/80ninja-upgrades | |
# Disable bugsnag | |
sudo sed -i 's/env BUGSNAG_KEY/#env BUGSNAG_KEY/' /etc/init/ninjablock.conf | |
#change mqtt host to your own (has to be tls!!) replace ownmqtt.server.com with your own (the '/' should be left there on the end) | |
sudo sed -i 's/env CLOUDHOST=mqttbeta.ninjablocks.co/env CLOUDHOST=ownmqtt.server.com/' /etc/init/ninjablock.conf | |
# Change the api host to api.ninja.is (the regular server) | |
sudo sed -i 's/env APIHOST=wakai.ninja.is/env APIHOST=api.ninja.is/' /etc/init/ninjablock.conf | |
# Remove unwanted drivers (because they crash my block) | |
# These drivers use the cloud rest api (that will be gone in the future!) | |
# And I will try to remove the dependancy of this api in the future | |
mkdir ~/removed-ninja-drivers | |
cd /opt/ninjablocks/client/drivers/ | |
mv ninja-hue/ ~/removed-ninja-drivers/ninja-hue/ | |
mv ninja-lifx/ ~/removed-ninja-drivers/ninja-lifx/ | |
mv ninja-limitlessled/ ~/removed-ninja-drivers/ninja-limitlessled/ | |
mv ninja-notify/ ~/removed-ninja-drivers/ninja-notify/ | |
mv ninja-support/ ~/removed-ninja-drivers/ninja-support/ | |
mv ninja-xbmc/ ~/removed-ninja-drivers/ninja-xbmc/ | |
mv ninja-zwave/ ~/removed-ninja-drivers/ninja-zwave/ | |
# There should only be | |
# network (don't know what this does) | |
# ninja-arduino (to talk to the build in arduino!!) | |
# rest (for the local rest api) | |
# restart ninjablocks | |
sudo service ninjablock restart | |
# Check the logs (for the serial you want to activate) | |
tail /var/log/ninjablock.log | |
# Activate block on the website (a.ninja.is) | |
# Use the normal site for this. | |
## In the future we want to skip activating by creating our own token file. | |
## Create Token file (with the username for your mqtt server) (this is normally done by activating....) | |
##/etc/opt/ninja/token.conf | |
# Fetch the token from /etc/opt/ninja/token.conf (This will be the mqtt username, so create that now, no password (yet!!!)) | |
cat /etc/opt/ninja/token.conf | |
# restart ninjablock | |
sudo service ninjablock restart | |
# Check the logs | |
tail /var/log/ninjablock.log | |
# Color the ninja eyes with mqtt | |
# publish command to $block/xxxx/commands (replace xxxx with your block serial) | |
# payload {"DEVICE":[{"GUID":"XXXX_0_0_1007","G":"0","D":1000,"DA":"FFFF00"}]} (replace XXXX with your block serial) replace FFFF00 with other color. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment