This is an exhaustive guide, fully documented, screenshotted step by step. This will take around 4 to 5 hours to complete, depending on technical experience.
Build or obtain an Alpha2MQTT
I recommend you utilise the 3.3v MAX3485 (Red module) if building this yourself. I also recommend the screen. The screen isn't required but it at least provides some initial feedback about whether your build is working. In short, spend the money and spend less time debugging!
I recommend you use Facebook Marketplace for local deals, however, I personally use a Pi 400 4Gb
The 400 is identical to the plain Raspberry Pi 4 Model B, however you don't need to build and case the device, and it comes with an integrated keyboard and mouse to save you needing to source separate ones. It is still small enough to tuck to one side once it is all up and running.
Save it to your desktop, open it in Notepad and have it ready throughout this guide to save account details and links and tokens as you go along.
All files are available from the Alpha2MQTT repository.
For the avoidance of doubt, I'd recommend two ways to download the contents to avoid introducing error by copying text or contents from your web browser.
-The first way is to right click on a file, for example configuration.yaml.txt and left click on the equivalent of 'Save Link As...' in your browser. Save it to a folder of your choosing. -The other way is to download the whole repository as a zip by left clicking on the green 'Code' button on the front page of the repository, and then left click on 'Download zip'
Google is more than just a search engine, with an account you are entitled to free storage called Google Drive, an email address and much much more. You probably have one, but if not, sign up using the link in the header. Add these details to your 'setup.txt'.
We will be leveraging Google to store automated daily Home Assistant backups so that in the case of memory card failure, you can easily restore as was.
GitHub is a source code management/collaboration tool, but it is also used for authentication purposes. It is free and well renowed in the software development industry. This guide is hosted on GitHub!
Sign up using the link in the header and the click Sign up at the top right of their page.
Follow the instructions to set up and activate your account. Add these details to your 'setup.txt'
DuckDNS is a tool which gives you a static web address for your Internet connection. Why do you need one? Well, unless you have an extremely fancy Internet connection, every time your router reboots or disconnects from the Internet you will get a different IP address for your next connection. This is the IP address which is used to present your local area network to the world and likewise is the address you need to 'dial-in' to your Home Assistant. The reason different IPs are dished out from a large pool and re-used works on the assumption that not everyone is connected at the same time, saving on the actual number of IP addresses needed at any one time. But it is no good saving a link which could change over time because the chances are next time you browse to your bookmark in your web browser it will no longer work!
The solution? When DuckDNS is configured in Home Assistant later any change of IP address is recorded by DuckDNS and DuckDNS gives you a nice fixed and clean URL such as http://mysuperhomeassistantinstall.duckdns.org regardless of what your IP changes to.
Sign up using the link in the header. Click 'Sign in with GitHub' or 'Sign in with Google' and follow the instructions to set up and activate your account. Add these details to your 'setup.txt'
Once logged in, find the domains section and type in an address. This will be used for your Home Assistant. I am going to be using http://mydan-dan-ha.duckdns.org
I recommend you type something fairly unique and something relatively easy. Don't be surprised if you type in something common and it rejects it - as it will be already used by someone else!
Click 'add domain' in green.
And it will be added to your account:
At the top of your account, please take note of your token and add these details to your 'setup.txt', it will be in the form aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
You can close DuckDNS for now.
This guide assumes you have a Raspberry Pi and are leveraging Home Assistant Operating System. As such, navigate to https://www.home-assistant.io/installation/ and scroll down to Raspberry Pi and click it. Alternatively, navigate directly to https://www.home-assistant.io/installation/raspberrypi
Follow the instructions to utilise Balena Etcher to flash your Raspberry Pi's memory card with the 64-bit edition of Home Assisant OS. At the time of writing, the version is 9.4, URL is https://github.com/home-assistant/operating-system/releases/download/9.4/haos_rpi4-64-9.4.img.xz
You will need your Raspberry Pi to be hard-wired to your router via an Ethernet cable in the first instance. This guide will concentrate on utilising an Ethernet cable throughout, but it will cover how to swap over to Wi-Fi once everything is up and running.
Once flashed, put the memory card in your Raspberry Pi and boot it up.
You will see quite a lot of text scrolling along the screen as it boots up, however once finished you will be presented with the following screen:
Highlighted in this pic are two elements, first is the Local IP address dedicated to your Raspberry Pi by your router. The second is the URL which you can use to access Home Assistant on your local network via a phone, tablet or computer.
As such, open Chrome or any browser of your choice and navigate to http://homeassistant.local:8123/ or in my case, I can navigate to http://192.168.1.112:8123/ as that is the Local IP address given to my Raspberry Pi by my router. Your Local IP address will be different to mine.
Your IP (in my case 192.168.1.112) should be added to your 'setup.txt' file as Alpha2MQTT will need this to post inverter messages later.
We need to ensure that
Your Raspberry Pi always gets given the same Local IP address, in my case 192.168.1.112, every time it is booted up. Like your Internet connection, it is no good programming Alpha2MQTT with the current Local IP only for it to change when your router dishes out a different Local IP to your Pi! Your router will work like your Internet IP and re-use IP addresses from a pool for the same reasons of IP address shortage.
Open up port 8123 (the bit after the colon in the address above) to the outside world so you can access your Home Assistant from anywhere.
I am on TalkTalk so although my steps will be unique to TalkTalk users, the principles are the same.
Navigate to your Router's IP in Chrome, usually http://192.168.1.1 or http://192.168.1.254
It will ask you to log in and the username and password is usually on a sticker on the back of your router.
Click into an area of your router's configuration which deals with your connected devices.
In my case this is called 'Manage my devices' but could be known as 'Local Network', etc.
And sure enough, I can see my homeassistant device:
I click on Advanced so I can change settings, and click into homeassistant:
I can click 'Reserve IP' to ensure that my homeassistant always gets the same address and click Apply:
I can click in Port Forwarding to configure the appropriate port to be opened to the outside world.
I will type in a Custom service name of Home Assistant
Leave Protocol as TCP
Leave External host empty
Type 8123 into External Port
and type 8123 into Internal Port
Click Add
Click Apply to finish
You can close your router's configuration page now.
Once I go to http://homeassistant.local:8123/, I am greeted with:
I am going to configure my system with some example details:
And I'll click Create Account
You should use your full name and a username and password which are secure enough not to be guessed (as your Raspberry Pi will be open to the outside world) and you should add them to your 'setup.txt' so that they aren't forgotten.
The next screen will prompt you for a name, I'd leave it as default for Home because Home Assistant doesn't just cover off linking to Alpha2MQTT, it can also drive any Hue bulbs you may have, Google Nest products and a whole reap of other home automation kit.
I highly recommend you complete where you live, as this will also help solar predictions and ensure your time zones remain correct for Winter and Summer, if you are in the UK think Economy 7 / Octopus Go charging times. Click Next
Choose whether or not you are happy sharing stats and click Next
And the final step will show any services already found on the network. You can see here it has picked up my HomeKit, Google Cast, Office HomePod and Philips Hue lighting. We don't want to configure those yet so just click Finish.
Now you are in and ready with a fresh install of Home Assistant!
We have plenty to configure now, so let's get to it.
Click your name at the bottom left, scroll down and click 'Advanced Mode'
Click Settings at the bottom left
Click Add-ons
The screen will be empty with an ADD-ON STORE button at the bottom right. Click it.
Find and click DuckDNS and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Just click the back arrow
Find and click File editor and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Click 'Show in sidebar'
Click the back arrow
Find and click Mosquitto broker and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Just click the back arrow
Find and click Node-RED and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Click 'Show in sidebar'
Click the 'Configuration' tab
Copy and paste MySecretPa$$Word into the credential_secret box
UNTICK ssl
Click SAVE
Click the back arrow
As per https://github.com/sabeechen/hassio-google-drive-backup
At the top right of the 'Add-on Store' there is a three dot menu button. Click it and click 'Respositories'
Type
https://github.com/sabeechen/hassio-google-drive-backup
into the box and click ADD
Then click CLOSE
Refresh the window by pressing F5 on your keyboard
Find and click 'Home Assistant Google Drive Backup' (at the bottom of the store usually) and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Click 'Show in sidebar'
Click the back arrow
Find and click Terminal & SSH and click INSTALL and wait until completed. Once completed you'll have a START or UNINSTALL option.
Click 'Show in sidebar'
Click 'START'
Click the back arrow
We will now be installing HACS for some extra fun such as chart types. The download link for HACS is https://hacs.xyz/docs/setup/download and we will be following the OS/Supervised route. However, as we have done most of the heavy lifting all we need to do is
Click 'Terminal' on the left
You will be prompted with a terminal interface to type commands.
Type in
wget -O - https://get.hacs.xyz | bash -
Include that minus at the end and that is a capital O, not zero (0).
Once completed you should see something like this:
As you can see, it is recommending you restart. So we will do that now. Click on Developer Tools on the left and click 'RESTART' in red and click RESTART again to confirm.
Wait a while and Home Assistant will be back up and running where you left off.
We need to hard refresh your browser, so in the case of Chrome and most other browsers, hold Control and press F5 on the keyboard. It will ask you to log back in. Use your username and password from earlier. I recommend you tick the 'Keep me logged in' box.
Click Settings on the left and click Devices & Services
Click the blue + ADD INTEGRATION at the bottom right.
Scroll down the list to HACS and click it. You will be prompted for several tickboxes you need to tick.
Tick them all and click SUBMIT.
It will prompt to authorise the device with GitHub. It's a good job we created an account earlier.
Log in with your details and type in the code and click Continue
Click the green 'Authorise hacs' button.
You can close the Device Activation window and in Home Assistant you will see
Just click Finish.
OK, let's configure all these Add-ons
Click Settings on the left, click Add-ons and you will see the complete list:
Where the icon is black and white, it means it isn't yet running. You will see Terminal & SSH is coloured in because we started it to install HACS via the terminal interface.
Click on Duck DNS
Click Configuration at the top
Firstly, you will see a blank domain with an X at the top, delete it by clicking X.
Get the address you configured in DuckDNS in its entirety handy, in my case, mydan-dan-ha.duckdns.org and get your DuckDNS token handy which should be in your 'setup.txt'.
The configuration page at the time of writing is broken, so click the three dots at the top right of Options and click 'Edit in YAML'
In the square brackets in domains:, paste in your address from DuckDNS without the http://, i.e. mydan-dan-ha.duckdns.org
Within the quotes for token:, paste in your token from DuckDNS.
Click 'SAVE'
Click the Info tab at the top and click START.
When started, click the Log tab at the top and if successful, you will see a message in green either indicating there's no change, or that it was successfully updated. If it hasn't worked, double check your address, your token, and try again.
Click back to go back to the Add-ons list.
Click on File editor
Click START.
Click back to go back to the Add-ons list.
Click on Home Assistant Google Drive Backup
Click START.
On the left hand menu, click Backups and you will be prompted to Authenticate with Google Drive.
Click AUTHENTICATE WITH GOOGLE DRIVE
You may need to sign into your Google account, so do so. Click 'Continue' to allow habackup.io to access your drive.
It will give you an Authorisation String:
Click the COPY button
Go back to your Home Assistant screen and paste it into the box and click SAVE.
If all is good, you will be prompted with the following:
If the code fails, please check what you pasted and try again.
Click Settings on the left menu and click Add-ons to go back to the Add-Ons list.
Click Node-RED.
Click START.
Click the back arrow to go back to the Add-ons list.
Click Mosquitto broker
Click the Configuration tab.
In Logins, paste the following, including the hyphen:
- username: battery
password: Switch1
battery and Switch1 should be added to your 'setup.txt' file as Alpha2MQTT will need this to post inverter messages.
You can of course choose a different username or password, but this is quite safe for the job.
Click the blue SAVE button.
Click the Info tab at the top.
Click START
Click the Log tab at the top. If everything has worked right you should see green messages indicating success. If not, go back to configuration and check your username and password text box.
That's all the Add-ons configured for now.
Click HACS on the left hand side
Click Integrations
and then click the Frontend tab.
Click the blue + EXPLORE & DOWNLOAD REPOSITORIES
We will be installing the following
Type in card-mod in the 'Search for repository' box
Click it when it appears in the list
Click the blue DOWNLOAD button
And click DOWNLOAD in the popup window. Wait for the install. Click RELOAD.
Click HACS on the left hand side
Click Integrations
and then click the Frontend tab.
Click the blue + EXPLORE & DOWNLOAD REPOSITORIES
Type in layout-card in the 'Search for repository' box
Click it when it appears in the list
Click the blue DOWNLOAD button
And click DOWNLOAD in the popup window. Wait for the install. Click RELOAD.
Click HACS on the left hand side
Click Integrations
and then click the Frontend tab.
Click the blue + EXPLORE & DOWNLOAD REPOSITORIES
Type in apexcharts-card in the 'Search for repository' box
Click it when it appears in the list
Click the blue DOWNLOAD button
And click DOWNLOAD in the popup window. Wait for the install. Click RELOAD.
Click HACS on the left hand side
Click Integrations
and then click the Frontend tab.
Click the blue + EXPLORE & DOWNLOAD REPOSITORIES
Type in Power Flow Card in the 'Search for repository' box
Click it when it appears in the list
Click the blue DOWNLOAD button
And click DOWNLOAD in the popup window. Wait for the install. Click RELOAD.
Click HACS on the left hand side
Click Integrations
and then click the Frontend tab.
Click the blue + EXPLORE & DOWNLOAD REPOSITORIES
Type in Sankey Chart Card in the 'Search for repository' box
Click it when it appears in the list
Click the blue DOWNLOAD button
And click DOWNLOAD in the popup window. Wait for the install. Click RELOAD.
Add-on configuration is now complete.
Click Settings on the left hand menu
Click System
Click Network
Scroll down to Home Assistant URL and type in the URL as configured in Duck DNS.
In my example, this is http://mydan-dan-ha.duckdns.org:8123
Now, we need to take the details of our Mosquitto broker now running on our Home Assistant box and plumb them into Alpha2MQTT.
From your 'setup.txt' file, you should have the Local IP Address of your Raspberry Pi. In my case this was 192.168.1.112
You should also have the username and password we configured in Mosquitto. In my case this was
- username: battery
password: Switch1
I am assuming you have followed the build and configuration instructions on the Alpha2MQTT site, and that you have Arduino open with Alpha2MQTT.ino ready in there.
Open At the top of the code just after "Update these to match your inverter" there are definitions you need to configure based on what we have just done.
Save your Definitions.h
Flash your Alpha2MQTT using instructions from the Alpha2MQTT repository.
This flow imports the data from the ten second state from Alpha2MQTT and presents the results to Home Assistant as sensors.
Download Alpha Ten Second State.json from the Alpha2MQTT GitHub repository
Click Node-RED on the left hand side
After a pause, you will be greeted with the Intro:
Skip through the intro
At the top right, click the three-line menu burger and click Import
Click 'select a file to import' and browse to the Alpha Ten Second State.json downloaded a few steps ago.
Click 'new flow' for Import to
Click Import
It may prompt "Some of the nodes you are importing already exist in your workspace", just choose 'Import Copy'
The flow will appear in the right hand side, and also in a tab at the top. Click the tab:
We just need to configure the Mosquitto details and we are done.
Double click the purple Ten Second Status node on the left and the following properties screen will open:
Click the Pencil alongside 'Mosquitto Broker'
On the Connection tab, type in the Local IP of your Raspberry Pi, in my case, this was 192.168.1.112
Click on the 'Security' tab and type in our Mosquitto username and password configured earlier.
In my case, these were battery and Switch1
Click Update
Click Done
Click Deploy at the top right. Once deployed, you will see that the MQTT node Ten Second Status has connected:
This flow imports the data from the one minute state from Alpha2MQTT and presents the results to Home Assistant as sensors.
Download Alpha One Minute State.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow imports the data from the five minute state from Alpha2MQTT and presents the results to Home Assistant as sensors.
Download Alpha Five Minute State.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow imports the data from the one hour state from Alpha2MQTT and presents the results to Home Assistant as sensors.
Download Alpha One Hour State.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow imports the data from the one day state from Alpha2MQTT and presents the results to Home Assistant as sensors.
Download Alpha One Day State.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow imports the data from responses to reading and writing data registers and presents the results to Home Assistant as sensors.
Download Alpha Register Read Write.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow imports the data from responses to dispatch modes such as forcibly charging and discharging to the grid and presents the results to Home Assistant as sensors.
Download Alpha Dispatch Responses.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
This flow will automatically charge the battery at a certain time to a target percentage of your choice and keep the load powered by the grid until the end of the time period you choose. This is useful if you are leveraging Econonmy 7 and also within winter months where solar generation is poor.
Download Alpha Charge TOU.json from the GitHub repository and follow the steps as per Node-RED - Alpha Ten Second State.json
You probably won't need to configure the 'Mosquitto Broker' again however it would be good practice to check and ensure the MQTT node is connected!
You need to configure your kick off time, charge rate in Watts, duration in seconds and target SOC in %.
Double click the 'Format' node to bring up some JavaScript code. You will see you can specify the kick off time. We set a five minute period to 'catch' the kick off time as we are dependent on a Ten Second State from Alpha2MQTT.
In the default code it will attempt to start charging between 00:35 and 00:40 each night. Customise this as you see fit. You are only dealing with the start time here!
Click Done.
Double click the yellow 'Set payload charge rate and duration' node to bring up its settings:
Click the three dot (...) button alongside 'To the value' and set the charge rate in Watts, target SOC in % and how long to keep in this mode in seconds. Seven hours for example is 25200.
Click Done. Click Done again.
If you want to disable this, open Node-RED, double click the 'Alpha Charge TOU' tab at the top
In the options that pop up, click the 'Enabled' button at the bottom and click Done.
We need to connect Home Assistant to our Mosquitto broker which runs alongside it. We do this like so:
Click on Settings on the left hand side
Click Devices & Services
Click the CONFIGURE button under MQTT:
It will prompt 'Do you want to configure Home Assistant to connect to the MQTT broker provided by the add-on Mosquitto broker?'
Click SUBMIT
It will then auto-configure for Mosquitto and leave you with the following:
The configuration.yaml is the file which contains all the Home Assistant configuration. We will take a backup of it now.
Click File editor on the left hand side
Click the white folder icon at the top left
Click on configuration.yaml in the config/ folder:
In the right hand side you will see it is a pretty simple config at this stage. To save it locally, copy and paste the contents to a new Notepad and save the file to your desktop as configuration-backup-2023-01-06.yaml. Change 2023-01-06 to reflect the yyyy-mm-dd you are doing this. This is just a safeguard.
Download the configuration.yaml.txt from the Alpha2MQTT Repository
Open the file in Notepad
Copy all the contents using Edit -> Select All and copy using Edit -> Copy
Back in Home Assistant, delete the contents in the window already:
and paste the contents so it looks like this
Click the reddy-orange SAVE button at the top right.
Click 'Developer Tools' on the left hand side and click 'Check Configuration' and if all is good you should get a green message:
Click RESTART and confirm by clicking RESTART in the confirmation box.
Once back up and running, we only have dashboards to configure!
There are four dashboards:
Click on Settings and then click on Dashboards
Click + ADD DASHBOARD at the bottom right.
Configure a dashboard called Alpha
Choose an icon, I used mdi:battery
And ensure Show in sidebar is ticked
Click Create
Click Alpha which will now be at the top left hand side. Click the three dots on the far right side and click Edit Dashboard
Tick 'Start with an empty dashboard' and then 'TAKE CONTROL'
Click the three dots at the top right and click 'Raw configuration editor'
Select all the text currently in there and get rid.
Open AlphaDashboard.txt from the Alpha2MQTT repository in Notepad and copy and paste the contents into the window.
Click SAVE at the top right
Press the X at the top left
Then click DONE at the top right
Your dashboard shouldn't look too different to the following:
Clicking on TODAY'S POWER DIAGRAM will give you today's picture in a graph:
To overcome, click on HACS on the left hand menu
Click Frontend
You will see all the elements which are Not Loaded in red:
Click on any
Click the three dots menu at the top right
Click Redownload
And click Download in the popup
When done, click RELOAD
Repeat for all other unloaded elements.
Download AlphaControlDashboard.txt from the Alpha2MQTT repository.
Follow the steps as per Alpha, however, for info, I used the following settings:
Your dashboard shouldn't look too far away from the following:
Download AlphaReadRegisterDashboard.txt from the Alpha2MQTT repository.
Follow the steps as per Alpha, however, for info, I used the following settings:
Your dashboard shouldn't look too far away from the following:
Download AlphaWriteRegisterDashboard.txt from the Alpha2MQTT repository.
Follow the steps as per Alpha, however, for info, I used the following settings:
Your dashboard shouldn't look too far away from the following:
If you want to access Home Assistant on your phone or tablet, download the Home Assistant App or use your appropriate web browser.
If using a web browser, simply browse to your DuckDNS URL when away from home
For example, I will use http://mydan-dan-ha.duckdns.org:8123
If your router is smart it will also work if you are on Wi-Fi. If not (like me), you will need a second bookmark of Local IP:8123
Where Local IP is the IP assigned right back when Home Assistant was first installed.
For example, I will use http://192.168.1.112:8123
Find and install the Home Assistant app via Apple's App Store or Google's Play Store
When using the app, it is an identical configuration, simply use the details as per the Web Browser approach.
Bear in mind likewise that, if your router doesn't support internal redirection then you will only be able to configure the Home Assistant app to work when at home or away.
Personally, I'd set up the app for use at home using the Local IP, and use a web browser when away. But the choice is yours.
Once you are configured using a cable you can switch to Wi-Fi but bear in mind the following
Click Settings at the bottom left
Click System
Click Network
Scroll down to Network Adapter and configure your Wi-Fi settings. Once done and saved, unplug your network cable and reboot. The boot-up sequence should point to you the new IP as per:
I will endeavour to help you if you are struggling. If I have missed something or you have something to add to this step by step guide please email or Facebook.
Daniel Young 2023 daniel@mydan.com