Neil.B.Ennis – 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
Problems installing Office 365 on a Laptop with Wireless Connection /problems-installing-office-365/ /problems-installing-office-365/#respond Fri, 18 Mar 2016 01:01:12 +0000 /?p=471 Comsol USB 3.0 Ethernet AdapterOffice 365

My daughter has a Toshiba Satellite Laptop and was given a free copy of Microsoft Office 365 as part of her school enrolment.

Unfortunately when she upgraded her laptop to Windows 10, the on-board ethernet adapter stopped working, so she only had WiFi network access.

When we tried to download office using the new “Click to Install” technology, the installation continually failed because the WiFi connection was not fast enough.

Sadly, Office 365 is not available on CD or DVD, so the only way we could install it was as a download.

I am aware that Microsoft offers an offline installation option via the “My Account” option, but this isn’t available for school-based copies of Office, only for store-bought copies.  The school portal only allows a “Click to Install” option.

After trying to fix the on-board ethernet adapter, and scouring the web for Windows 10 drivers, I decided this was a waste of my time, and bought a Comsol USB 3.0 Ehternet Adapter for the laptop.

This turns a USB 3.0 port into a hard-wired ethernet adapter.

I then pluged the laptop into the wired Lan via an RJ45 cable, started the Office 365 download, and hey presto! It worked!

FigJam to me.

Cost of Comsol USB 3.0 Ethernet adapter: $43.88 from Officeworks.

I could have sent the laptop off to Toshiba to get fixed, but considering the effort taking it there, waiting for it to get fixed, bringing it back, I decided it was cheaper to spend $43 on the adapter.

Warning: Make sure you plug it into a USB 3 port on the laptop.  It doesn’t seem to work if you plug it into a USB 2 port.

I hope this helps anyone else with a similar problem.

 

]]>
/problems-installing-office-365/feed/ 0
Minor fixes to DIY iGoogle Start Page /minor-fixes-to-diy-igoogle-start-page/ /minor-fixes-to-diy-igoogle-start-page/#respond Tue, 21 Apr 2015 10:57:01 +0000 /?p=451 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/olddemov3
The previous previous version is here: http://nbe.me/olddemov2
You can download the source for the page here: http://nbe.me/demo/d.zip

There was a bug in the Google Ajax Slideshow code which meant that when you clicked on an image, instead of redirecting your browser to the source of the image, the slideshow would redirect your browser to the URL of the current page.

I’ve fixed that bug, thanks to some excellent advice from jgeerdes at https://groups.google.com/forum/#!msg/google-ajax-search-api/Ljom17bulZc/UYg2154Nwp0J

Enjoy!

]]>
/minor-fixes-to-diy-igoogle-start-page/feed/ 0
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
ObSrv.com is for sale /obsrv-com-is-for-sale/ /obsrv-com-is-for-sale/#respond Tue, 28 Jan 2014 02:45:15 +0000 /?p=424 ObSrv.com is a web service which provides image feeds for any subject you like.

The content is updated hourly, allowing you to provide high-quality, relevant graphics for any website, or feed reader.

I’ve been able to maintain this site and host it because of the modest income stream I derive from Google ads that appear on the info pages that are displayed when a website visitor clicks on an image.  This has been great because:

  1. Web publishers didn’t need to pay anything.
  2. The ads didn’t intrude on your site – they only displayed when an interested user clicked on an image.
  3. Clicking on the image redirected to an intermediate site which displayed the ad, and allowed the user to proceed to the original site.

I didn’t have any say on what sort of images web publishers displayed – my only request was that web publishers did not use ObSrv to display adult-related images.

That’s not because I am a prude – it’s because Google prohibits ads on these sorts of sites.

Unfortunately, some people ignored this request, Google cancelled ad serving for the ObSrv site, and now it’s not paying me anything.  I can’t afford to keep it running for free.

So I have decided to sell it.

If you’re interested, please make an offer.  No serious offer will be ignored.

I’m sorry for any inconvenience.  I’m willing to be flexibile to help you out:

If you need access to ObSrv prior to it being sold, please email mail@obsrv.com.  If you’re one of the incredibly generous people who has made a donation to me in the past, or if you would like to make a modest donation, I will send you a temporary URL which will keep images being served to your site until ObSrv.com is sold.

If enough people continue to make regular modest donations I won’t sell it.

What’s a reasonable donation?  I’m flexible, but $20-$30 per site per year seems like a reasonable amount.

If you want to buy it, here’s what you get:

1. The domain ObSrv.com.  A cool five letter dot com domain – imagine what you could do with it!

2. The ASP.NET and MS-SQL Server Source Code.

3. The data.

4. 12 months hosting for the site until you find somewhere else to host it.

5. 12 months tech support for the source code.  I’m not going to over-promise here.  The source code is well documented.  I’ll answer any questions you have.  I’ll even do minor mods for you – but it has to cut both ways, and the level of support depends on the price at which you buy from me.

About me: Do a Google Search on me: “Neil Ennis”.  You’ll soon see I’ve been around a long time, I keep my promises, and I value long-term business relationships.  I won’t let you down.

]]>
/obsrv-com-is-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
ObSrv Bug Fix – Please read /obsrv-bug-fix-please-read/ /obsrv-bug-fix-please-read/#comments Tue, 18 Jun 2013 04:01:55 +0000 /?p=390 I’ve fixed a bug with ObSrv that was causing empty image feeds to appear.

There is a long term problem that we need to address, and I need your help to sort it out.

The problem is that Google is limiting the number of image searches that ObSrv can do to 100 per day. The problem is that once we exceed this limit, no images are returned and you get a blank feed.

I’ve temporarily fixed this problem by changing the image search provider. I’m not saying which, as I don’t want to cause any more waves.

But eventually they’ll start blocking excessive image searches as well.

So I’m considering changing ObSrv to require you to supply a Google API key. It won’t be hard to do. All yu need to do is go to the Google Code API console, log in (or create an account) and request an API key.

Future versions of ObSrv will require you to enter that API key as part of the Feed URL.

For now, you don’t need to do anything. Everything should be working perfectly. Your images should come through as expected.

I’m just alerting you to what may have to happen, and I’d like your feedback please.

You once might have had a feed URL that was something like: http://obsrv.com/General/ImageFeed.aspx?mountain+wallpaper

But I’m suggesting we change that to something like: http://obsrv.com/General/ImageFeed.aspx?mountain+wallpaper&APIKEY=[your API KEY]

This way, any ObSrv feed requests will be linked to your API KEY and not mine. And (provided you don’t go over 100 requests per day) Google won’t hassle you. This shouldn’t be a problem. Image feeds don’t update that often. Even if you refreshed the feed every hour you’d be able to have four separate feeds and stay under the limit.

If you exceed Google’s limit, they’ll probably want you to open up a commercial account with them and pay them something. This has nothing to do with me. I’m not asking for your money – I’m just explaining how Google deals with people who use their resources in an unusual way.

Please leave a comment, or email me, and let me know your thoughts.

The challenge we face is that Search Engines are a moving target. Writing a web service like ObSrv that keeps up with this target is difficult, but not impossible.

]]>
/obsrv-bug-fix-please-read/feed/ 2