Needed to explain a method you can use with shelly devices to some colleagues.
Forgot about this test later, a friend of mine visited me a few days later and warned me about this still being there.
Needed to explain a method you can use with shelly devices to some colleagues.
Forgot about this test later, a friend of mine visited me a few days later and warned me about this still being there.
Big mistake 😉 It a Linux ARM system with Busybox
Less do some searching on the web.
Ah .. enable telnet
Open in a browser:
http://192.168.1.x/admin/cgi-bin/debug.cgi
Enable telnet:
Connect and install Pong:
telnet 192.168.1.x (username root) # wget http://agilo.acjs.net/files/mppong/setup.sh # chmod 755 setup.sh # ./setup.sh # ./start.sh # ./start.sh musicpal # For the normal player
Links i have to look into:
https://www.qemu.org/docs/master/system/arm/musicpal.html
I wanted to know when trash is being collected. So i made a dual led thingy.
When we lived in Utrecht, the website which mentions when, what is collected was easy .. like a API
We live in Hilversum now, so i had to write a scraper.
UPDATE : Script not working anymore. Site has been changed, and I’m not willing to run a headless browser (phantomjs) to scrape the info
See below my new solution
Script to set leds
#!/bin/bash set -x if [[ $# -eq 0 ]] ; then curl http://10.1.0.46/control?cmd=NeoPixel,1,0,0,0 curl http://10.1.0.46/control?cmd=NeoPixel,2,0,0,0 exit 0 fi set -x if [ $1 = "GFT" ] ;then led1="150,0,0" ;fi if [ $1 = "Rest" ] ;then led1="150,150,150" ;fi if [ $1 = "Paper" ] ;then led1="0,0,150" ;fi if [ $1 = "Plastic" ] ;then led1="75,191,0" ;fi if [ $1 = "Textiel" ] ;then led1="191,191,191" ;fi if [ $1 = "Kerstbomen" ] ;then led1="191,0,0" ;fi if [ "w$2" = "wgft" ] ;then led2="255,0,0" ;fi if [ "w$2" = "wRest" ] ;then led2="150,150,150" ;fi if [ "w$2" = "wpapier" ] ;then led2="0,0,255" ;fi if [ "w$2" = "wplastic" ] ;then led2="100,255,0" ;fi if [ "w$2" = "wTextiel" ] ;then led2="191,191,191" ;fi if [ "w$2" = "wKerstbomen" ] ;then led2="191,0,0" ;fi if [[ $# -eq 1 ]] ; then led2=$led1 fi curl http://10.1.0.46/control?cmd=NeoPixel,1,$led1 curl http://10.1.0.46/control?cmd=NeoPixel,2,$led2
Scraper ( calls setleds and mqtt )
#!/bin/bash
cd /home/pi/
./afvalleds
curl -s https://inzamelkalender.gad.nl/adres/1222HP:39 > /tmp/afvalcurl
today=$(date +%F)
tomorrow=$(date --date="next day" +%F)
for f in petfles-blik-drankpak-pmd.svg appel-gft.svg kliko-grijs-rest.svg doos-karton-papier.svg shirt-textiel.svg kerstboom.svg ; do
p1=$(cat /tmp/afvalcurl | grep -i -A2 "$f" | grep class | cut -f2 -d\> | cut -f1 -d\< | cut -f2- -d" ")
p2=$(echo $p1 | sed s/mei/may/g | sed s/okt/oct/g )
p3=$(date --date="$p2" +%F)
dater=$p3
now=$(date -d $(date --date="1 days ago" +%F) +%s)
p3epoch=$(date --date="$p3" +%s)
diff=$(expr $p3epoch - $now)
if [ $diff -lt 0 ] ; then
dater=$(date -d "$p3 1 year" +%F)
fi
whatdate=$(echo $f | sed s/petfles-blik-drankpak-pmd.svg/Plastic/g |sed s/appel-gft.svg/GFT/g | sed s/kliko-grijs-rest.svg/Rest/g | sed s/doos-karton-papier.svg/Paper/g | sed s/shirt-textiel.svg/Textiel/g | sed s/kerstboom.svg/Kerstbomen/g)
mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/$whatdate" -m "$dater"
if [ "w$today" == "w$dater" ]; then
alltoday="$alltoday $whatdate"
fi
if [ "w$tomorrow" == "w$dater" ]; then
alltomorrow="$alltomorrow $whatdate"
fi
done
mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Today" -m "$alltoday"
mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Tomorrow" -m "$alltomorrow"
./afvalleds $alltomorrow
Utrecht scraper
#!/bin/bash set -x curl -s "http://json.mijnafvalwijzer.nl/?method=postcodecheck&postcode=3543eh&huisnummer=72&" > /tmp/afv cat /tmp/afv | python -mjson.tool > /tmp/afv.json today=$(cat /tmp/afv.json | grep -A1 $(date +%Y-%m-%d) | grep nameType | cut -f4 -d\" | paste -sd "/" -) today=$(echo $today | sed s/\ /,/g) tomorrow=$(cat /tmp/afv.json | grep -A1 $(date -d "+1 days" +%Y-%m-%d) | grep nameType | cut -f4 -d\" | paste -sd "/" -) tomorrow=$(echo $tomorrow" | sed s/\ /,/g) cat /tmp/afv.json | grep -B1 nameType | grep -B1 gft | cut -f4 -d\" | grep 202 > /tmp/gft.afv cat /tmp/afv.json | grep -B1 nameType | grep -B1 papier | cut -f4 -d\" | grep 202 > /tmp/papier.afv cat /tmp/afv.json | grep -B1 nameType | grep -B1 plastic | cut -f4 -d\" | grep 202 > /tmp/plastic.afv cat /tmp/afv.json | grep -B1 nameType | grep -B1 kerst | cut -f4 -d\" | grep 202 > /tmp/kerst.afv ( ( for f in $(seq 1 31) ; do dater=$(date -d "+$f days" +%Y-%m-%d) grep $dater /tmp/gft.afv > /dev/null && echo "$dater GFT" | head -1 done ) | head -1 ( for f in $(seq 1 31) ; do dater=$(date -d "+$f days" +%Y-%m-%d) grep $dater /tmp/papier.afv > /dev/null && echo "$dater Papier" | head -1 done ) | head -1 ( for f in $(seq 1 31) ; do dater=$(date -d "+$f days" +%Y-%m-%d) grep $dater /tmp/plastic.afv > /dev/null && echo "$dater Plastic" | head -1 done ) | head -1 ( for f in $(seq 1 31) ; do dater=$(date -d "+$f days" +%Y-%m-%d) grep $dater /tmp/kerst.afv > /dev/null && echo "$dater Kerstboom" | head -1 done ) | head -1 ) | sort -n -k1 | sed s/\ /,/g > /tmp/afv.sorted gft=$(cat /tmp/afv.sorted | grep GFT | cut -f1 -d,) papier=$(cat /tmp/afv.sorted | grep Papier | cut -f1 -d,) plastic=$(cat /tmp/afv.sorted | grep Plastic | cut -f1 -d,) mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Today" -m "$today " mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Tomorrow" -m "$tomorrow " mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Papier" -m "$papier" mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/GFT" -m "$gft" mosquitto_pub -h 127.0.0.1 -p 1883 -t "afvalwijzer/Plastic" -m "$plastic"
Update new solution
My home assistant has a hacs addon installed which does the heavy lifting for me.
Why not use this info?
I wrote about NR and HA here
So getting the info for NR to parse:
I only need to use the lightblue node bottom right!
It is the current state node, inject a timestamp every day to get new values.
Parse this and send using Mqtt to my Led display thingy
Old ones










Playing around with these i made a :
Androids

Work phones
Organizers








Organizing programs
Update 20221208 – removed internals

I’ve modded several LSC devices, most of them i could flash with esp-easy or tasmota.
Why mod it? Because it uses the cloud .. i’d like to keep control myself.
Just connect/solder a USB to TTL Converter UART Module like below.
(See other posts)

But this alarm was different, i ended up removing the chip and replace it with a ESP12.

So now i had to figure out which GPIO pins and how to control them.
#1/bin/bash
# Flashed ESP Easy on this one
# When i did this, 2019, you needed version 2.1-beta1
# GPIO 4 controls LED
sleep 10
curl http://10.1.1.251/control?cmd=GPIO,4,1
sleep 1
curl http://10.1.1.251/control?cmd=GPIO,4,0
sleep 1
curl http://10.1.1.251/control?cmd=GPIO,4,1
sleep 2
curl http://10.1.1.251/control?cmd=GPIO,4,0
sleep 5
# Sending rtttl ringtone
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=112:8a,8a,a,8a,8a,a,8a,8c6,8f.,16g,2a,8a-,8a-,8a-.,16a-,8a-,8a,8a.,16a,8a,8g,8g,8a,g,c6"
alarm sound
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=160:2g,2c6,2g,2c6,2g,2c6,2g,2c6"
pager
curl "http://10.1.1.251/control?cmd=rtttl,5:d=4,o=5,b=160:8d6,16p,2d6,16p,8d6,16p,2d6,16p,8d6,16p,2d6"
Update 20221208 – removed internals
Removed my old hack and replaced it with a Wemos D1.
Added a LED
Next to do .. add a amplifier using a LM356/358
I like mixology
Some pictures of the drinks i’ve made, in the last years.
Most are in my notebook, i can perfect the drink now individually for a person.
I really have to put the names of the drinks on this page.
(And the tasting notes!)




































Using Python, Raspberry, a lidar module, a servo, display .. and a 3Dprinted holder.
Proof of concept was to see if it was easy to implement a lidar radar for boat navigation.
#!/usr/bin/env python
import math
import random
import pygame
from pygame.locals import *
import time
import serial
import pigpio
GPIO = 18
ser = serial.Serial("/dev/ttyUSB0", 115200)
pi = pigpio.pi()
distance = 0
pygame.init()
screen = pygame.display.set_mode((480, 320))
while True:
screen.fill((0,0,0))
pygame.draw.circle(screen, (0,128,0), (240,320), 100,1)
pygame.draw.circle(screen, (0,128,0), (240,320), 200,1)
pygame.draw.circle(screen, (0,128,0), (240,320), 300,1)
for deze in range(10,170,5):
count = ser.in_waiting
if count > 8:
recv = ser.read(9)
ser.reset_input_buffer()
if recv[0] == 'Y' and recv[1] == 'Y': # 0x59 is 'Y'
low = int(recv[2].encode('hex'), 16)
high = int(recv[3].encode('hex'), 16)
global distance
distance = low + high * 256
res = distance
#print res
x = res * math.cos(math.radians(deze))
y = res * math.sin(math.radians(deze))
xreal = x + 240
yreal = 320 - y
pygame.draw.line(screen, (0, 255, 0), (240, 320), (xreal, yreal))
pygame.time.wait(15)
pygame.display.flip()
#print(res)
pi.set_servo_pulsewidth(GPIO, deze * 11 + 500)
time.sleep(0.2)
screen.fill((0,0,0))
pygame.draw.circle(screen, (0,128,0), (240,320), 100,1)
pygame.draw.circle(screen, (0,128,0), (240,320), 200,1)
pygame.draw.circle(screen, (0,128,0), (240,320), 300,1)
for deze in range(170,10,-5):
count = ser.in_waiting
if count > 8:
#print count
recv = ser.read(9)
ser.reset_input_buffer()
if recv[0] == 'Y' and recv[1] == 'Y': # 0x59 is 'Y'
low = int(recv[2].encode('hex'), 16)
high = int(recv[3].encode('hex'), 16)
global distance
distance = low + high * 256
res = distance
x = res * math.cos(math.radians(deze))
y = res * math.sin(math.radians(deze))
xreal = x + 240
yreal = 320 - y
pygame.draw.line(screen, (0, 255, 0), (240, 320), (xreal, yreal))
pygame.time.wait(15)
pygame.display.flip()
pi.set_servo_pulsewidth(GPIO, deze * 11 + 500)
time.sleep(0.2)
#pi.set_servo_pulsewidth(GPIO, 0)
UPDATE: 20230320 new version
My first version of the Bluetooth page turner.
This was made using an Arduino and some buttons.
I’m using Fbreader and Ebookdroid on the tablet.
Code:
Note: Volume buttons work for both apps, if you want to use other keys, you need to put a keymap.xml file in your fbreader books directory on your android device to remap those!
#include <BleKeyboard.h>
#define RIGHT_TURN 4
#define LEFT_TURN 5
BleKeyboard bleKeyboard("fashpageturner", "Bluetooth Device Manufacturer", 100);
void setup() {
bleKeyboard.begin();
pinMode(LEFT_TURN, INPUT_PULLUP);
pinMode(RIGHT_TURN, INPUT_PULLUP);
}
void loop() {
if (bleKeyboard.isConnected() && !digitalRead(RIGHT_TURN)) {
bleKeyboard.press(KEY_MEDIA_VOLUME_UP);
delay (100);
bleKeyboard.releaseAll();
}
if (bleKeyboard.isConnected() && !digitalRead(LEFT_TURN)) {
bleKeyboard.press(KEY_MEDIA_VOLUME_DOWN);
delay (100);
bleKeyboard.releaseAll();
}
}
NEW Version



Changed stuff in my arpscanner
I want to know whats on my network, and be informed when a alien device connects.
This also helps me gathering all devices and macaddresses for a cmdb.
I’ve got below in my crontab
5 * * * * root /usr/local/bin/arpscanner
And the script:
#!/bin/bash
# Using a scanner on a specific vlan/interface
arp-scan -l -g -I p1p1.10 | grep ^10 | grep -vi packets > /var/log/arpscanner
cat /var/log/arpscanner | awk '{ print $2 }'| while read ; do
grep $REPLY /var/local/arpscanner.lst >/dev/null || echo $REPLY | mail -s arpscanner henri@henriaanstoot.nl
done
New and checked devices i put in the file mentioned above:
/var/local/arpscanner.lst
00:21:5d:gg:gg:7a Description
ac:67:b2:gg:gg:a0 Liligo Twatch
b8:27:eb:gg:dd:fd Nieuwe octoprint
d8:f1:5b:gg:gg:4a WLAN Dungeon
48:3f:da:gg:gg:fe Uboot ESP
8e:93:79:gg:gg:5d Tablet Monique
d8:f1:5b:gg:gg:06 ESP Radar
dc:a6:32:gg:gg:fb RPI4
00:1e:ec:gg:gg:ab laptop
68:05:ca:gg:gg:68 storage bak
etcetera
Today i started with Coursera’s Machine Learning course.
My friend aloha is doing interesting stuff with ML, but recently i’ve been interested in a work related ML project.
Besides this course i’m following a spotify Podcast called “Machine Learning Guide”, i listen to this on my way to work and back.
I’ve been playing with a lot of code after that. Luckily there are many ebooks about this subject.
UPDATE: In 2022 i used what i have learned to enrich my photo metadata.
https://www.henriaanstoot.nl/2022/05/29/photo-manager-addition-using-ml/