General – Technical Musings / The tech blog of Neil Ennis Thu, 20 Jun 2024 03:27:15 +0000 en-US hourly 1 Home Assistant Automations /home-assistant-automations/ /home-assistant-automations/#comments Thu, 20 Jun 2024 03:20:22 +0000 /?p=559 I use Home Assistant to control various smart devices around our home, including our Tesla Powerwall.

We are charged wholesale power prices by our electricity retailer Amber Electric, which means that sometimes the price of our power is really low, and sometimes it is really high. I can therefore use my battery to charge from the grid when the price is low, and sell back to the grid with the price is high.

Amber has a product called “Smart Shift” which can control when my battery buys and sells. It works reasonably well, but sometimes I prefer to control the battery myself, and have set up some automations to do this.

The end result is a simple panel when lets me set the Buy and Sell price, and how I’d like the battery to operate:

  • How low will I let it discharge?
  • How high will I let it charge?
  • How full must the battery be before I sell power?
  • How low should the battery charge drop before I stop selling power?

These things are defined in Home Assistant as Helpers. They’re basically variables that you can set.

I have three scripts which control the battery. They define standard actions which I’d like to run at different times:

“Self Consumption” tells the battery to supply power to the house. When I don’t want to buy or sell or use grid power.

“Fast Charge” tells the battery to charge up from the grid – usually when the power price is cheap.

“Autonomous” tells the battery to look at the “Utility Rate Plan” in the Tesla settings, and decide whether or not to sell power.

The prices are artificial. I enter them via the Powerwall App. Basically they tell the Powerwall that power prices are expensive between 6:00am and 8:30am, and between 4:00pm and 9:00pm. Therefore if the battery ever switches to “Autonomous Mode” at these times, it will try to sell power. At other times, it will do nothing.

Based on this information I have set up four more scripts:

“Battery Mode Buy” does this:

  • Change the Battery Mode helper to display “Buy”.
  • Send me a message via MQTT
  • Change the battery reserve to its maximum (usually 100%)
  • Run the “Fast Charge” script.

“Battery Mode Consume” does this:

  • Change the Battery Mode helper to display “Consume”.
  • Send me a message via MQTT
  • Change the battery reserve to its minimum (usually 15%)
  • Run the “Self Consumption” script.

“Battery Mode Hold” does this:

  • Change the Battery Mode helper to display “Hold”.
  • Send me a message via MQTT
  • Change the battery reserve to its current charge level. This forces the battery to stay at this level, neither importing nor exporting.
  • Run the “Self Consumption” script.

“Battery Mode Sell” does this:

  • Change the Battery Mode helper to display “Sell”.
  • Send me a message via MQTT
  • Run the “Autonomous” script.

Now for the automations:

The “Charge Battery” automation is triggered by one of two events:

  1. If the general power price (from the Amber API) is less than my specified “Buy Price”, or
  2. The general power price (from the Amber API) is negative (some days they pay us to consume power)

There is also a precondition, which must be true: The “Demand Tariff” must not be active. We get charged additional fees for any consumption during the demand period, so I try to avoid consumption at that time.

“Demand Tariff Active” is a binary sensor helper:

The “Consume Battery” Automation is triggered by one of three events:

  1. The Power Price exceeds the “Buy Price”
  2. The “Demand Tariff” changes from OFF to ON
  3. The Power Price exceeds the “Max Hold Price”

“Max Hold Price” is a binary sensor variable I set up in “sensor.yaml”:

The “Dispatch Begin” (Start Selling) automation is triggered whenever the Feed In Tariff is higher than my minimum sell price.

It will only run if the battery level is above the minimum “sell” charge level, which I have currently set to 60%.

The “Dispatch End” (Stop Selling) automation is triggered by one of two events:

  1. The “Feed In Price” falls below my “Sell Price”, or
  2. The Battery Charge Level falls below my minimum charge percentage (currently 40%).

The “Preserve Battery” Automation is triggered whenever the power price falls below the maximum hold price.

The power price must be above my “Buy” price (otherwise I’d be buying, not preserving), and the Demand Tariff must be off.

All of these automations rely on the “Teslemetry” integration which gives me greater control over my battery than the standard Tesla integration. It’s a paid service, but it’s cheap, and it always works.

If you need me to clarify anything, please leave a comment.

]]>
/home-assistant-automations/feed/ 3
Enhancements to DIY iGoogle start page /enhancements-to-diy-igoogle-start-page/ /enhancements-to-diy-igoogle-start-page/#respond Thu, 29 Jan 2015 22:43:38 +0000 /?p=440 I’ve upgraded the DIY “iGoogle” start page.

You can see the latest version here: http://nbe.me/demo
The previous version is here: http://nbe.me/olddemov2
The previous previous version is here: http://nbe.me/olddemo
You can download the source for the page here: http://nbe.me/demo/d.zip

The major enhancement is that you can now embed html into the page – which makes it easy to add Youtube videos, or iFrame widgets.

Setup Screen

To add embed code, click on Setup and add a new widget with a type of “html”. In the “data uri” field, paste your embed code. For example, to add a youtube video, you’d paste this code into the “data uri” field:

<iframe width="320" height=auto src="https://www.youtube.com/embed/DPP1INgPtSs" frameborder="0" allowfullscreen></iframe>

Make sure you keep the width of any iframes to 320 pixels or less, otherwise the layout of the screen won’t look too good.

Also – if you’re trying out the demo page, you might want to press Ctrl-F5 to clear your browser cache, so the new version gets loaded.

]]>
/enhancements-to-diy-igoogle-start-page/feed/ 0
ObSrv: No Longer For Sale /obsrv-no-longer-for-sale/ /obsrv-no-longer-for-sale/#respond Mon, 24 Feb 2014 00:29:29 +0000 /?p=433 Thank you for the emails of support and kind donations.

After a few minor changes and exchanges with Google I have managed to rectify the problem relating to inappropriate images on the detail pages.

Because of your kind support, and the resolution of issues with Google, I’ve changed my mind and decided not to sell ObSrv.

I plan to keep it running indefinitely.

If you have any issues, or need support, please leave a message or contact me at:
mail at neilennis dot com

If you’d like to donate to help keep the site running, I’ve added a couple of paypal buttons on the site.

]]>
/obsrv-no-longer-for-sale/feed/ 0
DNS323 Formatting “stuck” at 94% /dns323-formatting-stuck-at-94/ /dns323-formatting-stuck-at-94/#respond Thu, 05 Dec 2013 08:19:45 +0000 /?p=415 DNS-323_sideThe DLINK DNS323 is a network storage device that takes two SATA disk drives,  plugs into your local network, and acts as a file server for media and documents.

We’ve had one for the last 5 years, and it has served us very well.  It’s quick, reliable and easy to use.

We had two 1TB Western Digital “Caviar” drives installed.

Unfortunately, one of those drives failed last night.  I replaced it with a Seagate “Baracuda” 2TB drive.  We’re not running the DNS323 in a “RAID” configuration, so a different type of drive isn’t a problem.

When I booted up the unit with the new drive, the web interface told me it found the new drive, and was it ok to format it?  It assured me my other drive would be ok.

I answered “Yes” and it started formatting the new drive, but it stopped when it got to 94%.

There are a whole lot of articles online about this problem, and people have come up with many and various issues to get around it like using a different browser, clearing out cookes, even formatting the drive on a separate machine.

There was a mcuh simpler solution, however.

A 2TB drive is pretty big.  It takes a long time to format.  It just so happens that on this device, most of the formatting happens when it gets to the 94% mark.

So the easiest solution to this problem is to WAIT. 

Do nothing for an hour.  Eventually it will finish formatting, and everything will be ok.

If you don’t like doing this, feel free to try a different browser, or bury your computer in peat for a couple of hours, or chant incantations for a while.  I assure you whatever you do, if it takes longer than an hour, it will fix the problem.

Well…. it will appear to fix the problem.

Or – just wait.  Let the thing finish formatting.  Then everything will be ok.

]]>
/dns323-formatting-stuck-at-94/feed/ 0
DIY iGoogle Upgrade /diy-igoogle-upgrade/ /diy-igoogle-upgrade/#comments Thu, 14 Nov 2013 03:16:32 +0000 /?p=399 I’ve upgraded the DIY “iGoogle” start page.

You can see the latest version here: http://nbe.me/demo
The previous version is here: http://nbe.me/olddemov2
The previous previous version is here: http://nbe.me/olddemo
You can download the source for the page here: http://nbe.me/demo/d.zip

Major items:
1. Each widget has its own “Settings” page which allows you to edit settings. Just click on the “settings” button at the top right of any widget:
Widget Settings Button

2. You can add / edit stocks & shares. If you click on the settings button for the stock widget you get a screen which lets you change the existing stock codes, quantities and buy prices.:
Stock Edit Screen
To delete a stock item, click on the red “X” button.
To move a stock item up a line, click on the blue up-arrow (↑)
To move a stock item down a line, click on the blue down-arrow (↓)
To add a stock item, fill in the blanks and click the green “+” button.
To save changes, click on the “SAVE” button.
To cancel changes or close the edit dialog, click on the [x] button at the top right of the window.

3. You can edit the links in the top-bar by clicking on the “*” to the right of the links in the top bar.

4. You can add / edit / remove widgets by clicking on the “Setup” link in the top bar.
setup
To delete a widget, click on the red “X” button.
To move a widget up a line, click on the blue up-arrow (↑)
To move a widget down a line, click on the blue down-arrow (↓)
To add a widget, fill in the blanks and click the green “+” button.
To save changes, click on the “SAVE” button.
To cancel changes or close the edit dialog, click on the [x] button at the top right of the window.
Click “Factory Reset” to clear all your settings and revert back to the original settings that you downloaded from the website.

5. All settings are stored locally on your hard drive using the HTML5 “localStorage” facility. This is like a cookie, only bigger. The page settings were over 4,000 bytes in size, so would not fit in a cookie which officially can’t be larger than about 4,000 bytes. Local storage can be as large as your hard drive, so there are no storage limits, and the security / privacy settings are the same as for cookies.

You can download the source code here:
http://nbe.me/demo/d.zip

If you plan to use the weather widget, please change the “Weather API Key” in the “Setup” screen. Since lots of people are using this start page, the current API key will run out of API calls each day and won’t work. There are instructions on getting your own keys here:
/index.php/diy-replacement-for-igoogle/

As with all previous versions, you don’t need to load this start page on a web server. It will run fine from a folder on your computer. Just unzip the zip file, and click on index.html.

If you plan to put it on a public web server, you might want to password protect it with a htaccess file to protect your privacy.

Please try it out and let me know how you go.

]]>
/diy-igoogle-upgrade/feed/ 2
DIY Replacement for iGoogle. /diy-replacement-for-igoogle/ /diy-replacement-for-igoogle/#respond Thu, 24 Oct 2013 00:22:28 +0000 /?p=395 iGoogle will be gone at the end of this month.

I love iGoogle. It was free, convenient, and worked well. But because it was provided free by Google, it’s their right to pull the pin on it if they want to.

This event made me realize that any free service online may be cancelled. So if you don’t want the inconvenience of losing a free service that you love, you’re best off doing it yourself.

Here’s my modest attempt at writing my own iGoogle replacement page.

You can download the source for the page here: http://nbe.me/demo/d.zip

When you’ve downloaded the zip, you can unzip it to your own hard drive, or put it on a web server somewhere.

Before you start using it, you need two things: A Google API Key, and a Wunderground API Key.

Google API Key

1. Go to https://code.google.com/apis/console
2. If prompted, click on the “Create Project” button
3. Click on the “Services” button and change the status of “Custom Search API” to “ON”. Accept the terms.
4. Click on the “API Access” Link
5. In the “Simple API Access” section, click on “Create new Server key…”
Leave the “IP Address” box blank, and click “Create”
6. Copy the “API key”. This is your “Google Key” that you need to put in your index.html
7. Edit “index.html” and scroll to line 21 or there abouts. It will say something like:

var GoogleKey = “XXaaAaAAaAaAA9A9a9aaaaaAAA99a9aaaaA9AAA“; // Get your Google key here: https://code.google.com/apis/console

8. Replace the red key with your Google API key.
9. Save the index.html file

 Wunderground Key

1. Go to http://www.wunderground.com/weather/api/
2. Click on “Sign Up for FREE”
3. Create your free account
4. Activate your membership
5. Login to Wunderground
6. Click on “Explore My Options”.
7. Select “Developer” option ($0) then click “Purchase Key”
8. Complete the questionaire honestly.
9. Click on the “Key Stettings” tab.
10. Copy the “Key ID”. This is your “Weather Key” that you need to put in your index.html
11. Edit “index.html” and scroll to line 23 or there abouts. It will say something like:

var WeatherKey     = “99999999999aaaaa“; // Get your API key here: http://www.wunderground.com/weather/api/

12. Replace the red key with your Weather key.
13. Save the index.html file

You might want to change “WeatherCountry” and “WeatherCity” to reflect your home country and city.

]]>
/diy-replacement-for-igoogle/feed/ 0
Low-res Brain /low-res-brain/ /low-res-brain/#respond Wed, 19 Jan 2011 04:05:18 +0000 /?p=356
Thought experiment.

Close your eyes and imagine a clock face with hands and numbers.

Imagine the clock face as a whole.  Try not to think of just parts of it.

In your minds eye can you see the individual numbers on the clock face all at once?

I can’t.

I have to “zoom” in to each part of the clock to see all the numbers. I can’t see them all at once.

If the brain can’t do this while we’re awake, then it’s no wonder we don’t have vivid details of items when we’re asleep and dreaming.

If our brains imagery has such low resolution, why do we seem to have such hi-resolution memories?

Maybe it’s different for you.  But that’s how it is when I try it.

This whole experience helps me understand how my brain visualizes things.  It’s not like the “Pictures” folder on my computer.  I don’t store high-resolution pictures in my head.  I think it’s more like a short-hand way of reconstructing a picture.  Without realizing it my brain says  “A clock is a circle.  And it’s got numbers around it from 1 to 12.  And it has hands.  And it ticks”.

Perhaps it’s like that for someone’s face as well?  Do you know every freckle, mole or scar on your partners face?  When you think about it, how much detail of someone’s face do you actually remember?  I think perhaps we actually store a low res “caricature” of a persons face in our brain, and when we see that person, we match what we see of their face with the low res memory of it, and somehow our brain can recognize that the two things represent the same person.

I think our physical perception of reality is a lot less detailed than we realize.  When we look at a page in a book, there’s only a small circle of our vision that can actually see fine detail – about the width of our thumb held at arms length.  If you hold your thumb in front of a book held at arms length, and focus on your thumb, you’ll find it almost impossible to read the book.  That’s because the Fovea (the bit that sees detail)  in your eye only occupies a small part of your Retina (the bit that actually sees things).  But our brain manipulates us to think that we can see everything in detail, because our eyes dart around, and our brain puts all the jigsaw pieces together.

So next time you’re certain you saw something, remember that what you saw, what you thought you saw, and what you remember seeing are all totally different!

Isn’t the brain an amazing thing?

]]>
/low-res-brain/feed/ 0
Around Pine Rivers /around-pine-rivers/ /around-pine-rivers/#respond Wed, 10 Feb 2010 01:58:24 +0000 /?p=307 Here’s a brief description of each of the photos in the “Around Pine Rivers” theme for iGoogle.

If you’ve got any suggestions, corrections or improvements, please let me know.

Click on the images for a larger view.

[singlepic id=33 w=480] Bell’s Scrub is the only remaing parcel of virgin lowland vine rainforest in the Pine Rivers district.
See http://blog.neilennis.com/index.php/bells-scrub-lawnton/

[singlepic id=34 w=480] [singlepic id=35 w=480] [singlepic id=38 w=480] [singlepic id=40 w=480] Some of the stunning late afternoon views in my street.
see: http://blog.neilennis.com/index.php/everyday-beauty/

[singlepic id=36 w=480] Fleeting glimpses of childhood on the North Pine River.
See http://blog.neilennis.com/index.php/fleeting-glimpses-of-childhood/

[singlepic id=37 w=480] Christmas Beetle.
See: http://www.flickr.com/photos/magictyger/sets/72157603351606109/
Wikipedia Article: http://en.wikipedia.org/wiki/Anoplognathus_pallidicollis

[singlepic id=39 w=480] Lightning in the Gum Trees.
See: http://blog.neilennis.com/index.php/lightning-in-the-gum-trees/

[singlepic id=41 w=480] Ebert Family Vineyard.
See: http://blog.neilennis.com/index.php/echoes-in-the-vineyard/

[singlepic id=42 w=480] Stephen Lawn Park.
See: http://blog.neilennis.com/index.php/nuts-about-history/

[singlepic id=43 w=480] Lake Samsonvale.
See: http://blog.neilennis.com/index.php/lake-samsonvale-2/
Wikipedia article: http://en.wikipedia.org/wiki/Lake_Samsonvale

[singlepic id=44 w=480] South Pine River near the site of the old Normanby Rum Distillery.
See http://blog.neilennis.com/index.php/bikes-rivers-old-rum/

[singlepic id=45 w=480] Yebri Creek.
See http://blog.neilennis.com/index.php/exploring-on-sunday/

[singlepic id=46 w=480] Sunset on the North Pine River.
See: http://blog.neilennis.com/index.php/sunset-on-the-north-pine-river/

[singlepic id=47 w=480] Lake Kurwongbah.
See http://blog.neilennis.com/index.php/cycling-by-the-lake/
Here’s a wikipedia article: http://en.wikipedia.org/wiki/Lake_kurwongbah

]]>
/around-pine-rivers/feed/ 0
Cool technology /cool-technology/ /cool-technology/#comments Sun, 02 Aug 2009 08:37:56 +0000 /?p=267 Six and mean

Lilly came in to my office the other day. “Dad I have to go out now. Can you get the TV to record my favourite show in an hour”.

“Hmmmm????”, I replied in typical pre-occuipied father mode.

But she had an intensity in her eye that made me realize I ignored this six year old at my peril, despite my displike of leaving my desk while in the middle of solving a problem.

Happily, I didn’t have to get up from my chair. I just logged in to IceTV, found the program she was interested in, and told my PVR to record it via the website.  My PVR is a High-Definition Beyonwiz DP-S1. It’s wireless, but I’ve wired it in to the house LAN so we can watch movies from our D-Link DNS323 1TB NAS

We also have an older Topfield 5000 PVRT.  It’s only standard definition, but the cool thing about it is that it has an open programming interfacem , so a lot of people have written their own software to get it to do cool things.  One application I added to it was ToppyPC by John De Angelis.  It has a program called “TWIN” which adds a web page to your Topfield PVR.  So you can set timers, and record shows, like IceTV lets you do with the Beyonwiz.   ToppyPC needs another utility to run – an FTP server (ftp4t by Aldarin) which runs on a PC which I connect to the Topfield via a USB cable.

All this technology is both good and bad. It’s convenient, but I don’t get the exercise I need going up and down stairs to program the PVR!

But at least I don’t have an angry six-year-old to contend with!

]]>
/cool-technology/feed/ 3
Some amazing facts /some-amazing-facts/ /some-amazing-facts/#respond Mon, 27 Jul 2009 06:24:15 +0000 /?p=265
I just watched this fascinating Youtube video. The world is an amazing place!

]]>
/some-amazing-facts/feed/ 0