-
Recent Posts
Recent Comments
Archives
Categories
Meta
KanBoard
Creating and using self-hosted KanBoard based on https://kanboard.org.
Download the latest build from Docker and configure the mountpoints as below. Also, follow the setup to create the folders and set appropriate permissions:
Also, map ports so that they are not automatically assigned.
Next, run the image, create a bash Terminal and edit config.php with the following:
<?php
defined('ENABLE_URL_REWRITE') or define('ENABLE_URL_REWRITE', true);
defined('LOG_DRIVER') or define('LOG_DRIVER', 'system');
define('PLUGIN_INSTALLER', true);
Note that there is no closing statement on the PHP entry.
Now, restart the image and good to go.
Installed Plugins so far are:
- Customizer
- Bigboard
- Calendar
- Gantt
Homebridge on Synology NAS
The following article shows a step-by-step process for setting up Homebridge on a Synology NAS – worked for me first time!
https://mariushosting.com/how-to-install-homebridge-on-your-synology-nas/
Page content saved off in case the link dies (beauty of the internet)
To access homebridge (internal only) – http://hubble:8080
(replace Hubble with internal server address)
Posted in Docker, Home Automation
Leave a comment
Website Bookmarks
General
PostIt Board – http://ideabordz.com
Icebreaker questions – http://icebreakers.equalexperts.com
Training Sites
datacamp.com
https://www.cybrary.it/course/cism/
https://www.pluralsight.com/
Other PostIt type boards
Jamboard (Google)
Funretro
Mentimeter
Miro
Free Conference Bridge
Saving this link here for when I need a free conference bridge in the future..
https://www.freeconferencecall.com/
Security Websites
Some useful links to security related online checking tools:
Trackback an IP address – https://ipinfo.io
Run an application through a sandbox check – https://www.joesandbox.com
Online check a file/url/IP – https://www.virustotal.com/gui/home/search
Telegram Bot API
The Telegram Bot API can be found here!
The web hooks look interesting for two way communication between bot and user(s), and looks simple enough to implement so possibly a future activity.
Bot Notifications using Telegram
This PHP setup is based off of the excellent Python article provided by Man Hay Hong.
To get started you need to download/install Telegram and set yourself up as a user.
Once it is installed you need to setup a new bot by interacting with @BotFather and sending the following:
- /start {this will provide some help info}
- /newbot {@botfather will walk you through creating your new bot}
You now have your bot token – keep this safe as it enables anyone to control your bot and for you to interact through it.
Now you need your chatID so using the following URL in your browser you will see the additional info you need:
- https://api.telegram.org/botput_your_token_here/getUpdates
Look for the following and record the digits as that is your chatID:
{"id":xxxxxxxxxxxxx <<<<<< chatID
Again, keep this information secure.
I used the following PHP code to then send messages from my internal web server. The code does also check that any messages sent originate internally otherwise it throws an error.
<?php
$bot_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$bot_chatid = 'xxxxxxxxxxxx';
/* telegram_getUpdates() - get telepgram update info */
function telegram_getUpdates() {
global $bot_token;
$send_mesg = 'https://api.telegram.org/bot' . $bot_token . '/getUpdates';
$retval = file_get_contents($send_mesg);
return $retval;
}
/* telegram_notify() - send message to telegram user from bot */
function telegram_notify($mesg) {
global $bot_token, $bot_chatid;
$url = 'https://api.telegram.org/bot' . $bot_token . '/sendMessage';
$data = array('chat_id' => $bot_chatid , 'parse_mode' => 'Markdown', 'text' => $mesg);
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data)
)
);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$retval = json_decode( $result);
return $retval;
}
if (preg_match('/192\.168\.1\./', $_SERVER['HTTP_X_REAL_IP'])) {
// Local network access via WEB
$mesg = '';
if (isset($_GET['mesg'])) {
/* We have a message to send so send it! */
$mesg = htmlspecialchars($_GET["mesg"]);
$result = telegram_notify($mesg);
if ( $result->ok == true)
echo "Sent";
else
echo "Failed - " . $result->description;
} else {
/* No message so get the status instead */
$result = telegram_getUpdates();
echo $result;
}
} else {
// If we see a remote connection then send a 404
http_response_code(404);
}
?>
Powering ESP8266 & other devices
While I get this sorted out this page will be a holding page for parts located:
- MT3608 DC to DC Boost converter (3.7v to 5v)
- TP4056 Lithium Battery Charging board
- 18650 Lithium battery
ESP8266 – Getting Started with MicroPython
For a couple of pounds I purchased a couple of ESP8266 NodeMCU WEMOS development boards to play with. Decided to go with the NodeMCU versions so that they come with a micro USB and 3.3 regulator onboard.
As I’ve been playing with Python for a while I decided to download MicroPython on to the ESP to provide control of real-world devices. Instructions on downloading, formatting and getting started with MicroPython can be found here.
I’ve included my notes here as things were not as plain-sailing as I would have liked.
Connecting the ESP8266 to my Mac – sounds easy but the hardest part is finding a USB cable that has data connections instead of just being wired for 5v-GND. Most charging cables come with only power wired so after trying about 6 cables I found one that worked.
So how did I know I had a good cables as all powered up the ESP? You need to see if your Mac shows the USB device turning up. Before connecting type “ls /dev | grep -I usb” and then connect the device. You should see the device show up if the cable has the right connections.
Now download the esptool for programming the ESP and transmits the firmware to the ESP.
https://github.com/espressif/esptool
And down a copy of the Micropython Firmware from the above MicroPython site.
If you need to find out ESP board information such as flash size use:
esptool.py -p /dev/ttyUSB_DEVICE
flash_id
To program the ESP I used the following command:
esptool.py --port /dev/ttyUSB_DEVICE --baud 460800 write_flash --flash_size=detect 0 FIRMWARE>BIN
ttyUSB_DEVICE is your device found from the ls /dev command above
FIRMWARE.BIN is the file you downloaded from the MicroPython site
With luck the firmware would have downloaded and successfully been verified – woohoo!
Now you can connect to the device and get a REPL prompt.
REPL prompt – that sounds easy but it took a few goes to find the right command on the Mac to create a serial connection to the ESP on the USB port and then get it working. The “screen” command is available on the Mac and the speed to connect with is 115200.
screen /dev/cuUSB_DEVICE 115200
I found that I sometimes got an error about no Pty device. This turned out to be zombie screen processes locking out the device port. Perform a “ps -ef | grep -i usb” to find the zombie processes and kill them (show no mercy).
You can not follow the instructions on the MicroPython site to interact with the REPL prompt. If you want to upload/download files then you will need “WebREPL“.
http://micropython.org/webrepl
Notes on uploading files to Execute
- Use the web version of WebREPL or WebREPL.py to send or get files from the ESP
- I found that once a file is uploaded you need to reset before attempting to run the file. A soft reset can be performed by pressing Ctrl-D in the browser or at the REPL command prompt in screen
- To run the file import it!
Controlling a 5050 WS2812B RGB LED Ring
This was a few pounds on Ebay so tried to connect it to the ESP8266 WEMOS which was pretty simple after I soldered some wires on. I connected the 5v and GND straight to the ESP pins, and the Din (DI) wire to D2 on the WEMOS. This is GPIO04 (pin out found here).
Power consumption = each led is around 18mA on.
If you want to create an online wiring diagram with drag-n-drop components then use https://www.circuito.io/app which is pretty cool.
To control the leds you need to run some MicroPython code on the ESP but you can use the example below:
import machine, neopixel
np = neopixel.NeoPixel(machine.Pin(4), 12) #we have 12 leds on GPIO4
np[0] = (128, 0, 0) # Led 0 half bright single color - red I think
np[2] = (0, 128, 0) # Led 2 another colour
np[4] = (0, 0, 128)
np.write()
You should have some (3) leds now light up, if it all works!