Wednesday, January 5, 2022

Home Assistant Renew DHCP Lease

This is a workaround for a problem with Home Assistant running in a Virtual Machine and not renewing a DHCP lease thus losing the connection to the local network after the lease runs out. You can define an automation that will periodically run a script that pokes the network interface forcing a lease renewal. I did it a while ago so I hope I remember all the elements required to make the workaround work.

The rest api that allows to poke the network interface of the home assistant os is not accessible from outside of the instance. You need to install the "Terminal & SSH" add-on to get access to the os running home assistant.

Once you "hack the system" and get inside the home assistant via ssh, inside the config directory, define a script that pokes the card:

curl -X POST \
    -H "Authorization: Bearer $SUPERVISOR_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"enabled":"True"}' \
    http://supervisor/network/interface/enp0s3/update

Where enp0s3 is the name of the network interface, it might well be different in you setup.

The script needs to be inside the config directory because config directory is special, contents are not deleted on restart for one.

Once you got access to the home assistant os, it is easy to see there seems to be cron available, but I tried in vain to use it. Not only is cron not running the crontab, but also any cron configs are wiped on restart.

Instead you can define a home assistant automation that will invoke the script.

Add to config/automations.yaml:

- id: renew-dhcp-lease
  alias: "Renew DHCP lease"
  trigger:
    - platform: time
      at: "21:35:00"
  action:
    - service: shell_command.cycle_network

Add to config/configuration.yaml:

shell_command:
  cycle_network: bash cycle-network.sh

This will trigger the action at 21:35 each day, which was good enough for me.

Tuesday, December 14, 2021

Xiaomi Kingsmith Walking Pad A1 Pro WPA1F Review

I've been using it since May this year, so for over half a year now. I'm using it as part of a walking desk. It works well for me.

The belt size is more than enough -- I've never tripped, never felt unsure footed. I'd prefer it to be smaller actually, so it had a smaller footprint.

I used the smartphone app very rarely - set the default speed at 3 km/h. I exclusively use the manual mode -- this is the only one that makes sense for a walking desk. I usually walk at 3.5 or 4 km/h, sometimes faster if I want some exercise.

The biggest problem for me is the noise the fan makes. This is the fan that cools the engine. It only switches on a minute or two after you start walking and then stays on until the treadmill stops. At lower belt speeds, up to 4km/h, it is noisier than the belt and the engine themselves.

At 3.5 km/h the treadmill is 50-51 db before the fan switches on and 52-53 db with it. The fan noise is somehow more annoying too. It is tolerable for me, but it bothers my partner when I'm using it. It mostly limits the time I'm walking to when she is away. I sometimes get away with using it when she has noise canceling headphones on.

If there was a walking pad running 3.5 km/h at 47 db I'd replace this one in a heartbeat. I would also consider one that has at least a quieter fan.

A minor problem with the treadmill is static electricity it creas on the user. I'm not sure what is causing it. I've never experienced it from gym treadmills, and it was not happening at the beginning with this one either. Now I need to be grounded or else I experience uncomfortable static discharges when touching a laptop.

Overall the benefits are bigger than the drawbacks.

Sunday, October 21, 2018

Random Seatbelt Alarm While Driving

My car was intermittently not detecting that the seatbelt is fastened, randomly while driving. Possible solutions:

  • cleaning the seatbelt tongue with isopropyl alcohol -- the quickest and I was surprised it actually worked, because the tongue did not look dirty
  • getting a seatbelt extender
  • replacing the seatbelt tongue -- seems like a lot of work
  • disabling the seatbelt check, on Alfa Romeo it can be done only through the OBD connector, but you need a special software (alfaobd.com, 50EUR, windows, android -- I haven't tried it)
  • How To Replace the Accessory Drive Belt (Serpentine Belt) on Alfa Romeo Giulietta 1.4 MultiAir

    This could apply to other cars in Fiat Chrysler group. Find the belt on the left of the engine. You can take a picture of the routing. Identify the belt tensioner by pulling on the belt and seeing which pulley yields. In my car it is the center pulley. It has a 13mm hex bolt on it. Hold it while you pull on the belt to see which way it turns as it yields. In my car it turns clockwise. I think there is a hole to lock the loosened tensioner in place, but I did not even attempt it due to difficult access. Use a ratchet and turn the tensioner with left hand and use the right hand to slide the belt from/onto the bottom pulley. It will be easier to put on a belt if it is longer rather than shorter. I got myself a rather short replacement belt and it seemed I had to turn the tensioner to the limit to put it on.

    Tools used: a 1/2" ratchet with 24cm arm, a 13mm hex socket, head lamp.

    Thursday, October 4, 2018

    Front Suspension on E-Twow Electric Scooter

    Etwow scooters are sold under other brands too, including Frugal, SXT and UrbanGlide. I am not actually sure ETWOW is the original manufacturer or just another brand and scooters are manufactured by a yet another company.

    I got myself a used one, and it came with several issues, one of which was a stuck front suspension. But first things first. This scooter has no air in tires, instead it relies on a spring front and rear suspension for comfort. In order to actually benefit from it you need to regulate it to your weight so that there is a sag when you mount it. The rear one is very easy, just loosen the screw tightening the spring. The front one has such a screw compressing the spring too, but the access is not easy. You need to detach the wheel and the steer pipe and then you need a special tool, a deep socket wrench size 10 if I remember correctly. Car mechanics usually have those if you can't find it in a store. See the photo below of how the scooter looks like being ready to loosen the tightening screw. Here is a link to the service manual for the scooter. You need to block the screw from the bottom with a 10 hex key, and turn from the top with the socket wrench. That socket wrench needs to be deep because there are four screw nuts on top of each other.

    For my electric scooter that adjusting was not enough though. The suspension was stuck because the plastic hexagonal bed was too tight for the metal rod that was moving in it. A friendly mechanic polished the metal rod by hand using some sort of metal grinding tool (no machines involved) just to make it a bit thinner so that it would move freely inside the plastic bed.

    Even with the suspension working the ride is not as comfortable as on a full size bike with no suspension. I don't think it is the superiority of air tires over a spring suspension, but rather a function of wheel size.

    Disclaimer: Before all this work, I contacted etwow for some information on how to adjust the front suspension and the person I talked to said the front suspension is not adjustable and that the tightening screw is holding the spring in place and loosening is not advised. I chose to ignore him and adjusted it anyway. It works.

    Alfa Romeo Giulietta Worn Hatch Button Badge

    This post is about replacing a hatch button badge that looks worn, but the button works fine. It seems to be a common issue for the model brought on by the way they are attached; I explain below. You pry the aluminum logo off the button with a knife - start with stabbing it near the edge toward the center. The logo badge is attached to the plastic button underneath with an adhesive. It is a 3 millimeter thick layer of soft adhesive that is only present in the center of the button. The adhesive not covering the whole button is most likely the reason for the wear, as the damage happens near the edges where there is no adhesive to support button pressing.

    I attached a replacement badge using silicone just because I had some and it seems to have a similar consistency to the original adhesive and would be similarly easy to detach should I ever need to. I tried to distribute the silicone on the whole button, not just the middle, to prevent deformation on pressing. Silicone seems to hold it fine, haven't lost it yet.

    As to the logo badge, you needed a 75mm wide one, the first one I bought, a 74mm one, did not fit. The badge is the same for the front and back.

    Thursday, January 13, 2011

    pinfruit - my mnemonic web app for memorizing numbers

    I have created a web app to memorize numbers. It implements the mnemonic major system. The system works on the principle that it is easier to remember words/sentences/stories than numbers. The web app facilitates finding sequences of words that encode a number in the mentioned system. I called the app pinfruit.

    My first take on implementing the system was incorrect. I simply associated digits to letters. According to wikipedia the mnemonic major system assigns digits to sounds, rather than the letters of the alphabet. And rightly so, I immediately noticed that it is easier to work with sound associations.

    My mistake originated in that I first learned the technique in Poland, and in Polish it does not matter if you assign digits to letters or sounds because both correspond. Unfortunately, in English this is not the case, the major difficulty in learning the language.

    I have used pinfruit to memorize mainly pins and phone numbers, but also bank site's user identifiers, which often come as numbers.

    The trick is to create a memorable (vivid or absurd) sentence/story for a number. My old phone number: 07514590312, can be encoded with husky leader leaps midway Hanoi, school weather helps Madonna or sickly water leaps hometown. I refer you to the wikipedia article for the detailed description of the system.