Posts

RUNK is a Kickstarter scam

Image
Once in a while a Kickstarter catches my interest. The RUNK is a hilarious name for those who know Norwegian, so I just had to back this project. https://www.kickstarter.com/projects/runker/runker-your-edc-portable-power-bank It also seemed like a nice little power bank. But today I received mine. The 30W charging output is a lie. What they say What the box says. Up to 12W (5Vx2.4A) What my phone says My main motivation for posting this is that they just announced their 2.0 of this power bank , which I would NOT recommend. I would just assume that too is a scam. I have not tested the NFC capabilities or daily driven the thing at all. Just unboxed, saw the 2.4A, measured and wrote this post. Feel free to correct me if I'm wrong in anything here. Bonus material: I just had to open it up and take a look. It was a pain to open up, lots of big plastic clips, I had to bend and break much plastic along the edge to get it open.

Adding a motor to Hario coffee grinder

Image
Tldr: Longer story: I was getting tired of hand cranking coffee beans in the morning, and did not want to by an expensive motorized grinder. I already have this grinder, it just needed a motor of some kind.  Turned out that the threads where the crank was attached, is standard machine(?) threads, so an off-the-shelf splicing nut in the correct size fit perfectly. Then attach a correctly sized socket to any drill (even this cute Bosch was powerful enough) and start grinding!

Getting the Miyoo Mini Plus battery into Home Assistant

Image
I recently got the retro handheld  Miyoo Mini Plus , love it so far! I also installed Onion OS on it, never even tried the stock experience.  Your setup, especially in Home Assistant might differ, so try to adapt this guide to your needs. But enough intro, you're likely reading this because you want the battery percentage into Home Assistant or some other system. This isn't a food blog where you need to scroll a mile to get to the recipe. What you will need: A Miyoo Mini Plus Onion OS 4.2 (or newer as far as I know. I run 4.2.3 at the time of writing) Home Assistant with the Syncthing Add-On configured Or some other way of getting synced files read by Home Assistant MicroSD card reader and a computer, of course Some knowledge in Syncthing and Home Assistant What you need to do: Install Syncthing on the SD card and start it . Make sure it works. With the card inn your computer, create a folder on the root of the card, named syncthing Open the hidden folder named .tmp_update, a...

How and why I read my apartment energy usage?

Let's start with why I have no good answer other than that I want to. It's 99% for fun, since I live in an apartment with district heating and good insulation, and the energy consumption does not really correlate with heating or cooling. Energy usage is tied mostly to cooking, the dishwasher and other appliances that we use consciously. I just want to get the wattage into Home Assistant in a way I can understand and/or manage myself. But how do you measure it? That's been quite the journey. The go-to way of reading the energy usage (here in Norway at least) is using a device that plugs into the HAN-port in the fuse box, and Wifi. Tibber Pulse is a good example of this. My problem with this is that my HAN-port is in the basement, four concrete stories below my apartment, way out of reach of my Wifi.  There are HAN-devices that work over ZigBee, and I did contemplate sneakily replacing lightbulbs down the stairwell with ZigBee-bulbs, to extend my ZigBee-network all the way d...

Getting Company Portal apps locally using PowerShell (no auth!)

Image
As you may know, I work at Intility in the application packaging space.  I've been doing that since about 2015, and during that time I and my collegaues have developed standards and systems to help us package apps better and faster. The so far last and unifying system is AppPackBot, which you can read more about at Intility Engineering . I won't (and quite frankly can't) go into all the nuts and bolts beyond what that blog post says, but I wanted to share something. You see, there are mainly two "app stores" in a corporate Windows environment. Good old Software Center, and the new Company Portal. Software Center can be programmatically interacted with using the CCM_Application WMI Class . But Company Portal, not so much.  I burst out laughing when I read this attempt to install an app from Company Portal using PowerShell. Tldr: Using the companyportal: protocol to open Company Portal with a given app guid, and then sending a ctrl+i keystroke that equals clicking ...

Converting nested hashtables(or yaml) to nested psobject with PowerShell

Image
I'm dabbling with WinGet at work, and I wanted to parse the installer information about VLC Media Player provided by WinGet .  PowerShell does not natively support Yaml, so I like to use the powershell-yaml module. I thought a simple convert should be enough, but no. This just resulted in a hashtable, I wanted a psobject. So how about casting ut to a psobject? Better, at first I thought I was done. But hold on, the properties of Installers are still hashtables. Googling and thinking led me to almost use a recursive function that dealt with this, but then I remembered playing around with conversions between yaml and json. Side note, the UI config of Home Assistant may be edited as yaml, but is stored as json on disk. So I knew they are just different flavors of the same thing, really.  Anyways, this is how to convert yaml to nested psobects: Get-Content <file.yaml> | ConvertFrom-Yaml | ConvertTo-Json | ConvertFrom-Json (I added -Depth 5 just because the default value 2 i...

I think I found a bug in cmtrace

Image
At work today I was looking through a log file generated by PSADT and noticed something weird. Compare the selected line in blue and the box below. Can you see it? (cmtrace version 5.0.9068.1000, I believe this is the current up to date version) Hint: The folder in ccmcache for the content is named "n".  Now, compare this to an older version of cmtrace where we see the same log file (cmtrace version 5.0.7804.1000, some years old) In case it's not clear: (new/current cmtrace. where is the n folder? For some reason, "\n" is getting removed from the box below in the new version of cmtrace.  My guess why this is happening: \n can be interpretet as a newline character. I believe this is happening, and in addition it strips away newlines. So "\n" just vanishes. The older version does not have this issue. That's all for now, have a great day!

VIRDIestimat i Google Sheets

Image
 Hei! (This will be in Norwegian, as it only applies to norwegians or people wanting to buy or sell real estate in Norway) (tldr i fet skrift mot slutten) Dere kjenner kanskje til virdi.no  (Min eneste relasjon til den tjenesten er som bruker). Det er kort fortalt en tjeneste som gir estimerte boligverdier. Men boligprisene endrer seg over tid, og jeg liker i alle fall å ha en idé om hva min bolig er verdt (ifølge Virdi). Det er en smal sak å bokmerke siden for min leilighet og sjekke en gang iblant, men jeg liker også å integrere dette tallet med andre nøkkeltall i min økonomi. Her kommer Google Sheets inn i bildet.  Jeg ønsker å kunne hente tallet fra Virdi automatisk, inn i en celle i Google Sheets.  Sånn gjør du det: Finn boligen på virdi.no. Her bruker jeg en helt tilfeldig leilighet som eksempel. Linken du skal ende opp med skal se ut som dette: https://virdi.no/bolig/oslo/0368-oslo/kirkeveien-37a/H0201 Her skal du kunne se VIRDIestimatet, som dette: ...

Sorting properties (not objects) in PowerShell

Image
This week I had a need for sorting the properties of an object alphabetically. Funny enough, the aptly named "Sort-Object" does not do this, that cmdlet sorts an array of objects by one or more given property names – useful for listing files in a folder, ordered by the files' size, for example. But I had to figure out something else. Take this example, just all the properties of a file in default order. Say I want to sort these alphabetically. First, I need to identify exactly which properties. Get-Member gives you the methods in addition to the properties, I don't want the methods. I just want the different properties, I got those with -MemberType *Property. I want the properties sorted by Name, and then expand the Name. Now, store that in a variable, here named $SortedProps. This variable is now a string array. Now, back to start with the Get-Item of the file. That output gets piped to Select-Object, which has the parameter "Property" that takes a string a...

Visualizing TCP connections with Powershell and Graphviz

Image
I've recently been somewhat obsessed with Graphviz, particularly with the PSGraph Powershell Module.  At work I use it as part of the CI/CD of various projects to automatically document the flow of information between functions, servers, etc.  But in this post, I want to show how i start with the ss command (socket statistics), and end up with a graph that shows who you're connected to, and how. First of all, you need a few things: A Linux distro. I use Pop OS. Powershell PSGraph Graphviz (sudo apt-get install graphviz) This is the script that does all the fun: So first, I create a class with the properties I want. Then I run the ss command, and declare an empty array. Then I loop through the output of the ss command, parse it into the individual pieces of information I want, and add it to the array. Then the PSGraph magic. To be honest, I struggle to explain in great detail how it works, but the things to note are: -FromScript are the "start" boxes -ToScript are...

Hidden settings in the Raspberry Pi Imager

Image
 So I've written a few micro sd cards over the years for my various Raspberry Pi projects. I always found it a pain to every time enable SSH and Wifi before boot by placing the ssh file and wifi profile on their respective places on the sd card before the first boot. Doing it manually with keyboard and display is even worse. I recently found out about the hidden options of the Raspberry Pi imager , and want to relay this information to my readers.  So when you open the imager, it might look like this: Now, press Ctrl+Shift+X Tadaa! MUCH better, I now look forward to flashing for my next project!

Maxus e-Deliver 3 i Norge har IKKE Android Auto eller Apple CarPlay

 This post will be in norwegian, as it (as far as I know) only applies to the norwegian market. English tldr at the bottom.  Jeg har nylig blitt deleier av en Maxus e-Deliver 3 , og har oppdaget noe som jeg syns må få større oppmerksomhet.  Alle anmeldelsene jeg så rundt denne bilen i forkant, viste at denne har Android Auto og Apple CarPlay. Men når vi kjøpte vår, oppdaget vi at USB-porten tiltenkt dette manglet. Ifølge forhandler ble vi fortalt at bilen er tilpasset det norske markedet og har dermed DAB-radio i stedet for Android Auto og Apple CarPlay...  Det var ingen dealbreaker for oss under kjøpet, men veldig surt å lære først når vi sto der og så bilen med egne øyne i Norge. Så om du vurderer Maxus e-Deliver 3 og den er importert av forhandler, vær klar over dette.  Hvordan DAB er implementert er noe teknisk interessant. USB-porten tiltenkt Android Auto/Apple CarPlay finnes tilsynelatende likevel, om så virtuelt. Jeg har ikke (enda) undersøkt baksiden av ...

A new car!

Image
My brother and I just bought a new car!  A little background: We've had an 2005-ish Volvo V40 for about 2 years. Cheap, simple car, did what we needed. But it did not pass the recent vehicle inspection, and the repair would cost at least 25 000 NOK. And scheduled next year is some other expensive maintenance. So we started looking for alternatives. We had a few demands for our next car: Electric Cheap Good range for the price Easy to rent out A format/type we need For it to be electric is mostly a principle. We also despise all the greasy maintenance, all the weird fluids and moving parts, having to visit the gas stations etc. It had to be relatively cheap. But the cheapest electric cars have terrible range. So we had to go a bit up in price. Owning a car is in itself a money pit in my mind. So for it to make a bit more financial sense, we're going to rent it out as much as possible. So what's the car? A 2020 Maxus e-Deliver 3! (Photo: Maxus.no) The short body, with the big...

Regex Crossword

So today a colleague told me about  regexcrossword.com I'm done with the beginner levels, I think I'm hooked.  Do you like regex and puzzles? Of course you do, try it out!👍

Rusty

Image
This is Rusty. He's a floofy lovable weirdo that enjoys sitting outside and passing out in my lap

Automated Grocery Shopping

Image
I want to share a project I worked on a while ago, that I still use from time to time.  Basically all my grocery shopping is done at Kolonial.no, which is a Norwegian online grocery store that has an api for the shopping cart and products.  I am a cheapskate in many fields, including grocery shopping. And how I shop is somewhat robotic, very predictable and some might say boring and uninspired. But the thought process when I select items, can easily be automated, so I did. The code is on my github .  All the docs are there, so I won't bore you with that here.  But the idea and process is quite simple: I need eggs. Eggs are not a product. Eggs are a category of products . So my shopping list in this code is the category ID of eggs at kolonial.no.  On the same line in my shopping list I can also specify words that should or should not appear in the product name. For example "frittgående" should be in the name. (Norwegian for "free range") Next filter is whether or...

Hello World!

I'd like to use this blog as an outlet for my hobbies, activities and thoughts.  Topics I have in mind are Home automation (based on Home Assistant) Cooking Various powershell scripting DIY projects at home Home labbing Cat pictures. The internet seems to like those, and I have access to a cat some times.  Also, this is my first blog. I have no idea what I'm doing.