Athom Tasmota Button On/Off

I accidentally factory reset one of the plugs and the button stopped toggling the switch. This was the coffee machine – a slight catastrophe for the odd times it needed a manual toggle.

I found the athom page had a mystery “template” and worked out where to enter it on the tasmota. Job done.

{"NAME":"Athom Plug V2","GPIO":[0,0,0,3104,0,32,0,0,224,576,0,0,0,0],"FLAG":0,"BASE":18}

Configure Other, then put it in a the top and tick Activate.

Tasmota Auto Off

This took me a while the first time, then found I had to do it again and had to look it up once more. One kind person had already worked this out and it led me to this command in the tasmota console:

Rule1  ON Power1#state=1 DO RuleTimer1 1800 ENDON ON Rules#Timer=1 DO Power1 Off ENDON

Then

Rule1 1

To enable the rule.

This rule will turn off thetasmota socket 30 minutes after it is turned on.

Of course, I should probably be doing that with Home Assistant now. Then I don’t have to go looking for the rule.

So that is what I did!

Home Assistant Templates

I have been getting to grips with Home Assistant (hassio). (This was after attempting, late at night and tired, to update OpenHab… It didn’t go well and though I had solid backups I knew I would need to do a full restore and have kept hearing about Home Assistant. I wanted to give it a try, and found it is so much better than OpenHab. I had everything OpenHab had and more in one morning of play. Everythign is so much easier).

So the more I got in to hassio the more I kept hearing about Templates. Hassio is well documented but there are no examples at all. I can read them but miss the point because, typiccally, I read too fast.

So when the Templating documentation said:

Templating in Home Assistant is powered by the Jinja2 templating engine. This means that we are using their syntax and make some custom Home Assistant variables available to templates during rendering.

https://www.home-assistant.io/docs/configuration/templating/

I didn’t realise this meant “custom code”. That would have helped. Template = Custom Code in Jinja2!

I went in to the Developer Tools > Template and had a play (with the help of avideo by “Smart Home Junkie”) I found that I could easily get the value of things using {{ states(‘the_thing’) }} (I also found that the Dutch word for curly bracket is “accolade” which is way better to my ear).

With my new knowledge I made my first Template to show the current rate as a read only thing so I can display is safely.

  1. A name – this is what you look up later and is turned in to a spaceless name, this one would become current_rate
  2. The Jinja2 code
  3. Preview

I made a sensor called “Current electricity period” and magic happened when creating a dashboard.

I know it is basic knowledge, but I needed to make this first step. I think I am away now.

Hammerhead Karoo First Thoughts

A few people have asked me my thoughts on the Hammerhead Karoo 2.

Executive Summary

  • it is big – this is good and bad
  • the screen is good, working it in gloves is interesting
  • navigation is excellent – love the climber function
  • battery life seems solid
  • route planning is satisfactory
  • ride tracking link seems reliable (I put in a sim card today, but not sure that is required given hot-spotting worked very well on the first two rides)
  • no need for a phone app to change what is displayed, but it is clunky
  • connection to power crank is intermittent (appears to be a known problem and I will try the fix)
  • phone notifications work but are hard to read

It is big

It is about twice the size of the Bolt. This is good for clarity, not so good for weighing down the mount on my BLENDR mount! I tightened the BLENDR a bit for the second ride to avoid the droop but it still sagged, so I will be a bit braver and tighten it some more.

(I had to buy the £12 plastic puk for the BLENDR mount and use the Karoo Garmin adapter. It would be good if Trek made a Karoo mount puk, but hey ho. N.B. Wish I had seen this before buying from Trek!

The screen is good, working it in gloves is interesting

The screen is very good – really clear in the Sun, especially if you whack the brightness up. I love the colour. I was using thin full finger gloves on both rides. They work on the screen but I think they are getting my fingertip through the material so hitting the right place is a challenge. I switched to mits as it warmed up and then it was fine.

Navigation is excellent – love the climber function

You get the next turn on all the screens so can look at data, knowing it is 1.6km to the next turn. This is a really nice feature. You get all the turns via visual and audio alerts. This is excelelnt. I don’t know if it would do that if I upload a gpx though because I have only used rides I made in the Hammerhead Dashboard.

Climber function is great – it gives a graphic of the climb broken down in to sections by gradient. It also decides how many climbs are on the route and counts them down – “Climb 4 of 8” or whatever.

One weird thing. I made a route starting about 100m down the road from the house if I turned left. When I set off it guided me to the start – turning right and the whole way around the block!

Battery life seems solid

No concerns, I was out for about 5h today and don’t think it got close to 50%.

Route planning is satisfactory

I made my routes on the dashboard by clicking. It doesn’t do popular roads like Strava and put in one or two crazy little detours where you loop off the main road for 100m. Easy to ignore, but weird.

Ride tracking link seems reliable

Wahoo were good that they send a unique link each ride, but bad because the tracking was very hit and miss. I have cycled round the World occasionally. Specialised was good when it worked, but getting it to hook up to the phone via bluetooth was hit and miss.

(I put in a sim card today, but not sure that is required given hot-spotting worked very well on the first two rides)

The first two rides I hotspotted my phone and linked to that from the Karoo. This was very reliable. Today in 5h my phone went from 85% to 35% so 10% an hour. Not too bad.

I had ordered a sim (lyca mobile 1p a month for 6 months for 3GB, cancel any time – I will believe it when I see it) and stuck it in today. I think the Karoo does about 1MB an hour (based on one search) so that is 3000h of cycling a month. Given there are only about 700h in a month, that should be enough! It should even update itself.

No need for a phone app to change what is displayed, but it is clunky

There is an app which purely gives the karoo access to phone notifications. It is a relief not to have to set up everything on the phone like the Wahoo. But changing things as you pedal along involves way too many screens and I have not found an easy way. With no manual in the box you have to work it out, so what I have worked out is the following to change, say, speed to heartrate: swipe down, swipe across, click profiles, click apps, click screens, swipe to screen, click speed, select heartrate, click back, back, back, back, back, back, back, back, select Profile. In gloves that is is a bit of a trial!

Connection to power crank is intermittent (appears to be a known problem and I will try the fix)

You can see the purple line drops out a lot. I have fresh batteries in the crank.

Hammerhead seem aware so I will try their fix and if it doesn’t work, send off the .fit they ask for.

Phone notifications work but are hard to read

So the phone app is very basic but does get notifications to the karoo. But getting them up then reading them is a bit crap. Firstly when you open them they scroll up out of view, secondly when you try and pull them back down they close, thirdly if you finally make it, there are hardly any characters.

yfinance 0.2.3 on raspberry pi

I have a silly little script that checks the shares each day and sends me a telegram, but it stopped working. After an hour or so of analysis I determined that the version of yfinance on raspberry pi that I had, 1.74, was returning None on any call. If I upgrade to 2.3 on Windows (update pip,pip install -upgrade pip, then pip install –upgrade yfinance, it all starts working again.

Getting it to work on Raspberry Pi was not so simple. This is a record of what I did.

Show the currently installed packages in the venv

source ./.venv/bin/activate
pip list

Upgrade pip and try to upgrade yfinance

pip install --upgrade pip
pip install --upgrade yfinance

You get an error saying that rust is the wrong version. Doing sudo apt install rustc does not install a version of rust that is high enough. So you turn to rust istelf and use:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 

Then follow the instructions. You need to kill the shell or read the message and source “$HOME/.cargo/env”. Then try to upgrade yfinance again.

pip install --upgrade yfinance

It now fails with:

error: command '/usr/bin/arm-linux-gnueabihf-gcc' failed with exit code 1
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography, which is required to install pyproject.toml-based projects

So try to get gcc working. I read that installing gcc libffi-dev libssl-dev and python3-dev might help so did that, though I already had gcc and python3-dev installed so just needed this:

sudo apt-get install libffi-dev libssl-dev
pip install --upgrade yfinance

And THAT fixed it ?so I now have yfinance 0.2.3 and yfinance works.