Calibrating temperature/humidity with mqtt

Last Updated or created 2023-08-18

Example uses a shelly sensor, which has a offset mode in its new firmware. So below is not needed any more.
But the example can be used for any calibration/adjustments.

I’ve put two examples in the NodeRed function

First the solution

var temperature=msg.payload.tC;
var humidity=msg.payload.tF;
// calc new offset example
// simple offset + 2.3 off real measurement
msg.payload.tC=temperature + 2.3;
// more complex example
// take two measurements (with a big difference)
msg.payload.tF=1.11 * (humidity - 1);
return msg;

First adjustment is plus or minus a value.
Second is more precise when the temperature needs more adjusting

Dots on the red line are measured values
Blue is how it should be

So measured was 2.8 but should be 2
And measured 14.5 but needs to be 15

slope = (14.5-2.8)/(15-2) = 0.9

To get the multiplication factor = 1/0.9 = 1.1111

=(2.8-heightadjust)*1,1111 should give us 2

2/1.1111 = 2.8 – heightadjust

1.8 = 2.8 – heightadjust = 1

So the formula is realhumid = 1,1111 * ( measuredhumid – adjust )

Mikrotik day (dhcp and thedude)

Last Updated or created 2024-01-09

Moving dhcp from isc-dhcp-server to Mikrotik.
And playing with theDude and speedtesting.

I got an old linux gateway which only runs a dhcp server.
Time to move this to a Mikrotik router.

The config on this isc-dhcp-server is huge!
So i was planning to migrate some one by one by hand.
Maybe writing a script to do this automatically later on.

I’ve got loads of static configured hosts, so I change these

  • Change static entry in dhcp to a deny booting entry
  • Add a static lease to the Mikrotik
  • Restart dhcp service

Example host

#                # kodiserver
#                host kodi.example.com {
#                fixed-address 10.11.12.13;
#                hardware ethernet ae:ae:ae:ae:ae:ea;
#                }

host movekodito4011 {
   hardware ethernet ae:ae:ae:ae:ae:ea;
   deny booting;
}

Mikrotik config (static single entry config)
See other post about dhcp config

/ip dhcp-server lease
add address=10.11.12.13 mac-address=EA:EA:EA:EA:EA:EA:EA

The Dude

The dude is a cool tool which connects to your MT and generates all kinds of cool info.
I was trying to get the frequency spectral scan working.
But it generates a nice network map also.

Easy to install under linux

  • Install wine
  • Download thedude from the MT website
  • start “wine dude_install.exe”
  • cd ” /home/$USER/.wine/drive_c/Program Files (x86)/Dude”
  • wine dude.exe

While moving a lot from my gateway to Mikrotik, I still have to come up with a plan to migrate my netboot.xyz PXE server to TFTP/ipxe using a migrated dhcpd server.
I probably end up using a separate dhcp instance which handles only the PXE requests.

Background switcher Ubuntu

Last Updated or created 2023-08-15

I was playing around with Phantomjs a headless browser.
Using this as a scraper for a ajax enabled site.

After scraping a wallpaper site, I wanted to take the big pictures and display these as background.

First sort and resize to a better size.

Below does the following:

  • Image width larger than 1800 AND
  • Image height larger than 900
  • Resize to 1920×1080 ( enlarge or reduce size )
  • Not screen filling (portrait mode) ? Than add black bars on the side.
  • Place the image in wallpaper directory

Convert script, if you resize huge images beforehand, you safe cpu resources later.
You also can place other colors or even another background instead of black.

mkdir -p wallpaper
ls * | while read ; do
info=$(identify "$REPLY" | awk '{ print $3 }' 2>/dev/null)
height=$( echo $info | cut -f2 -dx)
width=$( echo $info | cut -f1 -dx)
if [ $width -gt 1800 ] && [ $height -gt 900 ] ; then
	convert -resize 1920x1080  -gravity center  -background black -extent 1920x1080 "$REPLY" "wallpaper/$REPLY"
fi
done

Set a random wallpaper as background using cron.

#!/bin/bash
DISPLAY=":0.0"
XAUTHORITY="/home/henri/.Xauthority"
XDG_RUNTIME_DIR="/run/user/1000"

cd /home/henri/Pictures/
getranpic=$(ls  wallpaper/ |sort -R |tail -1)
#gsettings set org.gnome.desktop.background picture-options 'wallpaper'
#Set different modes ( enum 'none' 'wallpaper' 'centered' 'scaled' 'stretched' 'zoom' 'spanned' )
gsettings set org.gnome.desktop.background picture-uri-dark  "$(realpath wallpaper/$getranpic)"
logger "$(realpath $getranpic)" 

Cron example

* * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus /home/henri/bin/setrandom

Top IMDB followup using python (openpyxl)

Last Updated or created 2023-08-13

Using some python and a scraped list I can now mark which movies we’ve seen, or have to see.
(Own the movie or have it seen streamed in the cinema)

I just have to place a X after the title in the first column.
Run the python script, and presto

First column, the list we started with.
Second column, mark the movie.
3rd until the end .. years 2000-2023

Blue – seen
Light Blue – seen but was not in original list (so a new movie)
Green – have this movie, but still have to watch it
Light Green – Have this movie but it’s not in the original list
Orange – New in that year (could be an oldie reemerging in the top 250)

Now the python script, maybe it useful for you.

# 20230813 18:49 IMDB overview
# pip install openpyxl

import openpyxl
from openpyxl.styles import PatternFill
from openpyxl.styles.colors import Color
 
wb = openpyxl.load_workbook("clearsheet.xlsx")
sheet = wb['Sheet1']

colors = ['00660066', '00FFFFCC',
          '007b8cf2', '005ace97', '00ffac58','00dddddd','009bd8ff','007aeeb7']
fillers = []

for color in colors:
    temp = PatternFill(patternType='solid',
                       fgColor=color)
    fillers.append(temp)

# Mark found previous years
for colt in range(4, 27):
    for colr in range(3, colt):
        for rowr in range(2, 252):
            for rowrr in range(2, 252):
                if sheet.cell(row=rowrr, column=colr).value == sheet.cell(row=rowr, column=colt).value :
                    sheet.cell(row=rowr, column=colt).fill = fillers[4]

# Mark Our Old list matched with all years
for titlerow in range(2, 252):
    for colr in range(3, 26):
        for rowr in range(2, 252):
            if sheet.cell(row=titlerow, column=1).value == sheet.cell(row=rowr, column=colr).value :
                sheet.cell(row=titlerow, column=1).fill = fillers[5]

# Mark Have / Seen
for title in range(2, 252):
    for j in range(3, 27):
        for i in range(2, 252):
            if sheet.cell(row=i, column=j).value == sheet.cell(row=title, column=1).value :
                if sheet.cell(row=title, column=2).value == "x":
                     sheet.cell(row=i, column=j).fill = fillers[2]
                else:
                     sheet.cell(row=i, column=j).fill = fillers[3]

# Mark non old list but seen
for title in range(252, 400):
    for j in range(3, 27):
        for i in range(2, 252):
            if sheet.cell(row=i, column=j).value == sheet.cell(row=title, column=1).value :
                if sheet.cell(row=title, column=2).value == "x":
                     sheet.cell(row=i, column=j).fill = fillers[6]
                else:
                     sheet.cell(row=i, column=j).fill = fillers[7]
# Info cells
sheet['D255'] = "Downloaded seen org list"
sheet['D256'] = "Downloaded not seen org list"
sheet['D257'] = "Title matches found in 2000-2023"
sheet['D258'] = "Titles found in 2000-2023 not in org list have"
sheet['D259'] = "Titles found in 2000-2023 not in org list have seen"
sheet['D260'] = "Titles found in 2000-2023 previous years"
sheet.cell(row=255, column=4).fill = fillers[2]
sheet.cell(row=256, column=4).fill = fillers[3]
sheet.cell(row=257, column=4).fill = fillers[5]
sheet.cell(row=258, column=4).fill = fillers[7]
sheet.cell(row=259, column=4).fill = fillers[6]
sheet.cell(row=260, column=4).fill = fillers[4]
wb.save("imdbexport.xlsx")

Comedians and standup comedy

Last Updated or created 2023-08-10

I previously wrote about English Humour, now generic standup comedy.

I’ll write what I know and like, can you help me add to my list??!?
Only a few worth mentioning posted below.

I’m having a hard time to distinguish between One man shows, Standup comedians and alike.

Dutch/Belgium

English/Scottish/American

  • Billy Connolly – (Nothing I didn´t like about this guy’s humour)
  • Johnny “Bagpipes” Johnston – A comedian piper! (Got a dvd of his show)
  • Rowan Atkinson – His one man show
  • Eddie Izzard – History/general knowledge fantasy comedy
  • George Carlin

Other

  • Ismo Leikola – Finnish/American mostly word jokes
  • Ari Eldjárn – Icelandic language jokes

Oneliner cannons – ( Funny as hell, no long stories )

  • Stephen Wright
  • Mitch Hedberg

Music comedians

  • Johnny “Bagpipes” Johnston
  • Hans Liberg (NL)
  • Victor Borge ( Hans Liberg got a lot of his material from him )
  • Bill Bailey

Naughty

  • Ali Wong
  • Nikki Glaser
  • Jimmy Carr

MartyPC

Last Updated or created 2023-08-05

Perviously i’ve posted about PCem

But I wanted to have a emulator which could load extension biosses also.
This for my own tinkering.

I was told to look at MartyPC and PCE/ibmpc

I don´t like it being written in Rust, but it does the job.

Running the Basic Extension Rom
Running one of my own roms. I knew it didn’t work, now i can use the buildin debug to see why!
Another of my test roms, which is working!

ROM config part i’ve got in martypc.toml

rom_override = [
    { path = "./roms/BIOS_5160_09MAY86_U19_62X0819_68X4370_27256_F000.BIN", address = 0xF0000, offset=0, org="Normal" },
    { path = "./roms/BIOS_5160_09MAY86_U18_59X7268_62X0890_27256_F800.BIN", address = 0xF8000, offset=0, org="Normal" },
    { path = "./roms/myromextension.bin", address = 0xF6000, offset=0, org="Normal" }
]

GLABios for Laser XT/3

Last Updated or created 2023-08-05

In previous post :

I mentioned a 2 ROM setup because the 8086 is 16bits instead of 8.
So I was wondering that maybe a recompile was needed, or the data being split over two roms (odd/even)

The guy from GLABios was so kind to build me two interleaved roms.

So while working on a padded bench, I tested the ROMs.

Working outside .. on the padded bench

Back to the roms, it didn’t work!

But I missed a detail in the technical manual (the bold text)

In Turbo XT /2 and Turbo XT /3, there are two 28-pin sockets for ROM,
both of them are occupied by 2764 which stored the BIOS. The contents
of the two 2764 are identical.
One of them contribute the ODD Byte to the system and the other EVEN Byte. Together they support 16 Bit BIOS
access.

I don’t know why this is how it works, but when I flashed two the same 28C64’s it worked!
(I also tought that is was strange that both original roms had the same markings.

It workes!

Only remarks/observations:

  • There was a longer wait time before the CF Card was detected/accessed
  • GLABios mentions 8088 in the splashscreen, but the machine is a 8086

UPDATE

GLABios was not updated for displaying 8086 yet.
Error 1701 was the (old spinning) harddisk not being connected.

Nice .. harddisk infomation like size, rom address and CHS

8086 sideway scroller ‘n stuff

Last Updated or created 2023-08-02

Today I was working on my own brew ISA card (wirewrapping).
Did some mini modeling stuff.
Sorted some pipetunes.
And played around with my 8086.

Got it on a desk now, and replaced the harddisk with the CF card.
Also got an old SoundBlaster working, so i wanted to see what of my old code could still run.
Apparanty most code was compiled for 386/486 🙁
So i recompiled some stuff.
Below a horizontal scroller example.

Meanwhile i got my new fans in for my NUC (Kodi player, it was making a hell of a noise due to bad ball bearings.