GivEnergy Inverter networking

Overview

Rather off-topic, but I’ve been doing a dive into the TCP networking of the GivEnergy inverter which is the heart of our recent solar panel installation. The inverter connects to the solar panels and battery, converting DC to AC, and routing the power to/from the the battery as required. There’s a very handy app for your mobile, a web-based dashboard for monitoring and control, and it also integrates nicely into Home Assistant systems.

However, it’s not perfect. I get frequent “Inverter Timeout” errors when trying to update settings from the web portal, and I’ve also seen blatantly ‘wrong’ data arrive in both Home Assistant and the portal. Given that this is all over TCP/IP which is reliable and mature, I was curious about what’s happening. Time for a deep dive..,

Hardware

The inverter is a Gen 2 model – which means it has built-in ethernet and Wi-Fi, rather than needing a separate USB to Wi-Fi dongle like the Gen 1 model. The inverter and battery are in the garage, and I’m running this via ethernet powerline adapters back to a Unifi switch in the house.

The first step is to find the IP address of the inverter. The mobile app has a handy option to do this, so lets start there.

Let’s also take a look in the router’s DHCP settings to find what address was allocated, and the MAC address.

Let’s find the vendor for that mac address, using a lookup tool like https://macvendors.com/

Connect via Browser

OK, let’s try connecting to the inverter IP address with a browser. We’re presented with a HTTP Basic Auth login prompt – luckily the username and password are well documented in GivEnergy Wifi dongle setup guides, as admin/admin.

And, we’re in!

The obvious things to note are that this doesn’t look remotely like an inverter control page. There’s no GivEnergy branding. What, exactly are we talking to? The clue is in the MAC Address, and the hostname “HF-A21” we saw earlier. Googling the vendor and hostname, you’ll end up here which allows you to download the manual for this device.

I’d recommend NOT changing any parameters via the Web UI unless essential. There are hidden settings that can’t be changed from the Web UI and you’ll be in a world of pain getting it running properly again.

An HF-A21 is a UART to Wi-Fi/Ethernet module: It claims to converts a serial port (UART) to a TCP connection, but such devices are far from ideal.

Looking at the HF-21 manual and web interface, there are two main modes of operation which they call AP and STA. In “STA” mode, the module acts as a TCP client, and establishes a connection to an external TCP server. The server IP address doesn’t appear to be configured in the Web UI.

In AP mode, the module acts as a TCP server itself, allowing clients to connect to it. This is configured as listening on port 8899. Importantly, there’s also an AP + STA mode – although this can only be configured via the module’s serial port.

How does this work for the Inverter?

The inverter’s controller is connected to the serial side of the HF-A21 module. The inverter must place the module into the AP+STA mode, and sets the remote server address to an Amazon AWS address running the backend of the GivEnergy portal. Update: the HF-A21 actually uses DNS to find an IP address for comms.givenergy.cloud. I can’t see any mention of how this is possible from the HF-A21 manual, so my best guess is that the HF-A21 has been customized to perform this function.

All commands and data are sent using a variant of MODBUS protocol over TCP , which defines the layout and meaning of each command.

When the module starts, it opens a TCP connection to the Amazon server, and every five minutes the Inverter sends out a block of data to the AWS servers to update the web portal. Similarly, any changes to settings made in the portal are sent via AWS to the inverter. On it’s own, this will all work fine.

AP Mode

So, if the connection to the portal uses STA mode, how does the “local connection” option in the mobile app work? This is where AP mode (server mode) comes in. The HF-A21 acts as a TCP server, accepting connections on port 8899 and forwarding TCP data to/from the inverter UART.

But, we’ve now got multiple TCP connections to the HF-A21: What happens if both the AWS server and the mobile app send a message at exactly the same time? Luckily this doesn’t present too much of a problem. Although TCP is stream-based rather than packet-based, careful programming will ensure that MODBUS commands are sent as single TCP packets, so no interleaving of data on the UART occurs.

The real problem is when the inverter/UART side of the module receives data, and needs to send it over TCP. It can’t know which TCP connection to send it to, so instead, it sends the data to all current TCP connections.

For example, if you have the mobile app running in ‘Home’ mode, every ten seconds the app will ask the inverter for data. The inverter must send this data to both the app, and to the AWS server! You can see this clearly with a packet monitoring tool like Wireshark. Add Home Assistant into the mix, and every message from the Inverter must now go to three locations, regardless of who requested it.

I suspect that the “Inverter Timeout” messages are due to the portal software sending a command and expecting a reply – but instead, getting a reply that’s really intended for another client. Of course, it should be possible to ignore these, but maybe this isn’t happening.

More to follow…

Oregon: Nesmith Point

Something rather different : I’ve been in the USA for a couple of weeks and packed the bare essentials in case an opportunity to get presented itself.

I was staying in Portland,  Oregon, and a visit to the waterfalls in the Columbia River gorge was suggested.  It was great weather, and I started late, so unsurprisingly all the parking at the trailheads was taken.  I drove on , and took the trail marked towards Nesmith Point. At a little over four miles with just under 4,000ft of elevation gain, it’s a good workout.

IMG_20150418_133011.jpg

The trail leads into the forest, gradually rising towards a series of switchbacks as it steepens.  There are good views over to Beacon Rock on the north side of the river once you gain a little height.

The rock on the path gives plenty of clues about the volcanic nature of the terrain,  and there’s  an interesting selection of flowers out – mostly very different from those found in the UK.

IMG_20150418_134627.jpg

This one with the white petals is Trillium.

IMG_20150418_134348.jpg

The trail climbs steeply under the impressive canyon walls, and finally (with a huge sense of relief) the grade eases dramatically.

IMG_20150418_141809.jpg

IMG_20150418_152548.jpg

The summit is a couple of kilometres on, after a marked junction. The views west down the gorge are impressive, but the trees still block the view north and east.

IMG_20150418_153428.jpg

The fresh landslip here shows the instability of a lot of the gorge – one major landslide a few hundred years back formed the Bridge of the Gods a few miles upstream.

A quick snack, a rest, and then a faster and easier descent back to the car.

Overnight on Snowdon

The prospect of an imminent week in Amsterdam made focus on getting out for a day. The forecast was good but the inevitable traffic faff and late departure meant that it was almost 7PM before I got to Llanberis. The late hour meant I was tempted to cancel plans for a wild camp and use the excellent Llwyn Celyn Bach campsite, but the moon was full so I reckoned I’d be well up  the hill before darkness and tiredness struck.

wpid-P1020766.jpg

The sun set behind me, casting a deep red glow onto Snowdon as I made my way up the Llanberis path. Just a few folk were still coming down – happy faces after a beautiful day. As the sun went down, the full moon came up, disappearing behind  the cliffs above as I dropped off the path towards Llyn Du’r Arddu. Head torch was needed now for the first time, as I scouted around for a dry, flat and rock-free pitch. One located, it was time for a quick meal before bed.

I woke  briefly at about 2am to find the tent much brighter than  when I’d gone to sleep: the moon was now above the cliffs, illuminating the whole cwm below.  By 0600, it was properly light outside so after admiring the cliffs above I quickly packed up. My initial plan was to cross below the cliffs to the bwlch below Moel Cynghorion, but the weather looked good enough that a diversion to Snowdon summit (hopefully sans crowds) was appealing.

wpid-P1020776.jpg wpid-P1020772.jpg

Rejoining the Llanberis path, the sky was a patchwork of cloud, and the sudden views into the Llanberis path after Clogwyn station were a joy.

wpid-P1020781.jpg wpid-P1020779.jpg

As I neared the summit, my hopes of it being empty were dashed. I could make out a lone figure by the cairn. The views of the cloud bank rolling over Crib Goch, and a sea of cloud below me stretching out to sea were good compensation, though.wpid-P1020788.jpg

wpid-P1020789.jpg

The guy at the summit was  by himself – and seemed cheery enough, asking about the route down to Llanberis. Only then did he drop a bombshell: He’d walked through the night from Pen y Pass for 11 hours (no torch, and no obvious map, and you can guess the footwear), and he had two mates somewhere below on the steep screes at the top of the Watkin path. They’d had enough, and had called Mountain Rescue – and a helicopter was on the way.

On cue, Rescue 122 flew in over the cloud from Valley, and winched up the two below.  By chance, an ex-NEWSAR leader had arrived at the summit with some clients, and he led the third guy back down, while the Sea King headed off with his mates.wpid-P1020796.jpg

wpid-P1020797.jpg

Peace at last. I had the summit to myself for a good 15 minutes, before the first two trains of the day (first one: cafe staff; second one: water!) arrived.

wpid-P1020801.jpgwpid-P1020804.jpgThe rest of the day was less eventful: Down the Snowdon Ranger path, with my shadow  surrounded by a solar glory. The angle was never quite right for a full Brocken Spectre.

wpid-P1020811.jpg

A brief diversion to the top of the Clogwyn Du’r Arddu cliffs allowed me to look down to last night’s camping spot,  then up over Moel Cynghorion (tick!) and Fron Goch, (tick!!)  with a pause to watch ravens and (I think?) a peregrine falcon soaring over the cliffs.

wpid-P1020813.jpg

wpid-P1020817.jpg

Finally, onwards to Moel Eilio (tick!!!) in the sun, and back to the car via the maze of little lanes and fields above Llanberis.

wpid-P1020819.jpg

Download file for GPS

Return to the Rhinogs

31st May 2014: Rhinog Fach, Y Llethr and Diffwys, South Snowdonia

My only previous visit to the Rhinogs was four years ago. It started well with a walk in from the east to camp high by Llyn Du, and ended badly with searing heat, an empty water bottle, and the descent of Rhinog Fawr via a never-ending boulder field. I promised myself I’d be back, but unsurprisingly always found an excuse to go somewhere a bit less challenging.

It isn’t just me, either: Ronald Turnbull in the excellent “Granite and Grit” writes…

“These Rhinogs are part of the Snowdonia National Park. does this mean that we can expect ice-cream shops, reconstructed footpaths and interesting leaflets? It does not. the bad-tempered Rhinogs are being left in their corner to sulk. There will be no car parks: get there at dawn for your two metres of muddy verge, or walk in from beyond some dismal bog. There will be no waymarks: in the Rhinogs you haven’t really lived until you’re lost. There will be no ice-cream.”

Skipping the delights of Barmouth, I drove up the narrow lane into Cwm Nantcol. The stone walls crowd in on both sides, and I was lucky only to meet one oncoming car. Lots of gates, too.  After the sixth episode of “stop, get out, open gate, get in, drive, get out, close gate, get in, drive” I’d had more than enough and the cattle grids on the last two fields were a blessed relief. There’s plenty of parking at Maes-y-Garnedd farm (£2 for the day) and path into Bwlych Drws-Ardudwy is well signed.

My initial plan was to head off path to Llyn Hywel and get some navigation practice in on the way, but the beautifully built stone walls topped with barbed wire scotched that. No loss though, as the path towards the Bwlch is stunning, and the walls seem to keep the area mostly free of sheep. There was a gorgeous selection of flowers and mosses near the path including Heath Spotted-orchids, Lousewort, Butterworts and Tormentil.

wpid-DSC_0325.jpg

wpid-DSC_0330.jpg

The bwlch widens out into a natural amphitheate, and here – at last – there are ladder stiles to cross over to Rhinog Fach on the south. A steep path scrambles up a gully alongside a stream, easing off as you pass close to Llyn Cwmhosan.  A Drinker Moth caterpillar sat motionless sunning itself on the rock as I passed by.

wpid-DSC_0337.jpg

wpid-DSC_0341.jpg

Rhinog Fach towers over, but a good path continues up the side of the cwm towards the stunning Llyn Hywel: a large, remote and natural lake in an incredible mountain setting. There’s real ‘wow’  moment as the path levels out and the lake suddenly jumps into view.

wpid-DSC_0346.jpg

I stopped here for lunch, eyeing up Rhinog Fach above the lake on my left. There’s meant to be an “interesting” approach directly up the screes followed by a scramble up to the summit, but my route was more conservative – crossing the screes by the side of the lake before climbing to the col below Y Llethr, then steeply up beside the wall to Rhinog Fach.

wpid-DSC_0350.jpg

From here, the wall would be my guide back to the col and all the way on to Diffwys. One last slog to the summit of Y Llethr, with great views back over Llyn Hywel and the hard work is done. There was a lot more distance to go, but most of it downhill and over surprisingly grassy tops and ridges. 

wpid-DSC_0353.jpg

The trig point at Diffwys is just on the south side of the wall, overlooking Mawddach with the Cader Idris ridge across the valley. I watched cloud scud over the top of Penygadair while the lower tops remained clear.
wpid-DSC_0361.jpg

After heading seawards over the subsidiary  top to the west it was time to cut down into Cwm . I was aiming for Pont Scethin – a convenient bridge shown on the OS maps. Before you reach the bridge there’s a rather nice memorial on the trail above. I’m not normally a fan of these, but the location and wording somehow gave a boost for my slowly fading energy levels. Courage, Traveller!
wpid-DSC_0364.jpg

The bridge is incredibly narrow, considering this was once the main coach route between Harlech and London.  From here, one last off path section took me to the col east of Moelfre, where a path leads down to the road at  Cil-cychwyn.  One last mile on the road back to the car, then it was time to do battle with the gates again… Fish and chips in Barmouth felt well deserved.

wpid-DSC_0374.jpg

Download file for GPS

Hillwalking, and other frivolous pastimes