Setting up GivTCP start to finish

57 comments started 2023-01-16 last 2023-04-25
Home Automation
C
#1 chris_p

I work in IT, have done so for 20+ years. Why is setting up GivTCP so complicated?! "Install Docker, obtain image, add a stack, connect to MQTT broker"... What on earth!?!

Sadly my days of "tinkering" with stuff died when I became a parent. I don't have time to faff with stuff like I used to, I (like a lot of you) used to enjoy it, but now I just want it to work!

Is there a nice simple way of getting data out of my inverter using GivTCP into a human readable presentation without all the complexities of Docker?! Raspberry PI preferable, even a Windows solution will do!

#2 THALL

I too would like a run when I want solution rather than an always on solution.

#4 hoggy

Sadly I did have a 1 click wonder script that would just do this all for you - but as GivTCP keeps getting upgraded with breaking changes it tended to need constant re-writing which i got very bored of.
I can attempt another one but can't say how long it will last?

The bones are there still, just needs the Inverter Serial number bit changing from "INVERTOR_IP=XXX.XXX.XXX.XXX" to "INVERTOR_IP_1=XXX.XXX.XXX.XXX" I believe.

C
#5 chris_p

I have Docker Desktop installed on Windows, I have the givTCP image pulled - but no idea how I set the variable for my inverter IP.

C
#6 chris_p

hoggy Yes! Thank you! I finally have data..

{ "Battery_Details": { "BG2112G099": { "Battery_Capacity": 162.13, "Battery_Cell_10_Voltage": 3.293, "Battery_Cell_11_Voltage": 3.285, "Battery_Cell_12_Voltage": 3.285, "Battery_Cell_13_Voltage": 3.29, "Battery_Cell_14_Voltage": 3.293, "Battery_Cell_15_Voltage": 3.291, "Battery_Cell_16_Voltage": 3.295, "Battery_Cell_1_Temperature": 23.9, "Battery_Cell_1_Voltage": 3.29, "Battery_Cell_2_Temperature": 22.5, "Battery_Cell_2_Voltage": 3.288, "Battery_Cell_3_Temperature": 23.1, "Battery_Cell_3_Voltage": 3.291, "Battery_Cell_4_Temperature": 22.0, "Battery_Cell_4_Voltage": 3.288, "Battery_Cell_5_Voltage": 3.291, "Battery_Cell_6_Voltage": 3.288, "Battery_Cell_7_Voltage": 3.288, "Battery_Cell_8_Voltage": 3.291, "Battery_Cell_9_Voltage": 3.291, "Battery_Cells": 16, "Battery_Cycles": 164, "Battery_Design_Capacity": 158.72, "Battery_Firmware_Version": 3007, "Battery_Remaining_Capacity": 1 etc etc

So my steps were to:

  • Install Docker Desktop for Windows (but now I know where I'm going could easily be on a Raspberry Pi)
  • Run in PowerShell command prompt: docker pull britkat/giv_tcp-ma
  • Run next command: docker run --name GivTCP -d -p 6345:6345 -e INVERTOR_IP_1=XXX.XXX.XXX.XXX britkat/giv_tcp-ma

And bingo, it started showing data when browsing to http://127.0.0.1:6345/runAll

Now I did ALOT more in there, so not sure if what I did in other (failed) steps helped this finally work but it now shows data. Next step I assume is to get something to log this JSON data?

C
#7 chris_p

Is this where the home assistant stuff comes in for the logging and lovely graphs that people show?

Now got it working on my Raspberry Pi with similar instructions, install docker, pull the giv_tcp-ma and then run the docker run command above.

#8 THALL

Hmm just did this, but the report only shows one of my batteries.

#9 hoggy

THALL you’ll need to an an extra variable to the startup command
“NUMBATTERIES_1” to however many you have. Some other variables here

#10 hoggy

chris_p it’s easier just flashing a Pi or old PC with home assistant and adding GivTCP in from there. No need for installing docker or anything like that as it can all run from inside HA. (You can still call up that JSON page as well if you need to ingest it into another device/database externally.

#11 THALL

hoggy I did this docker run --name GivTCP -d -p 6345:6345 -e INVERTOR_IP_1=192.168.50.112 -e NUMBATTERIES=2 britkat/giv_tcp-ma

But I will reload now

#12 Riscy

hoggy it’s easier just flashing a Pi or old PC with home assistant and adding GivTCP in from there

This.

#13 hoggy

THALL it’s not worded well but it’s NUMBATTERIES_1=2

Not NUMBATTERIES=2

It’s if you have multiple inverters with multiple batteries to differentiate which inverter has what screwed to it.

#14 THALL

Oh I see!

"BG2136G079": { "Battery_Capacity": 160.0
"DZ2223G394": { "Battery_Capacity": 186.0

No loss? Happy days

A
#15 anglefire

THALL But if you have multiple inverters & batteries (Plant?) then you need to run two (or more) instances of GivTCP - and that doesn't work if you use it as an ADDIN in Homeassistant as you can only have one.

#16 THALL

anglefire Oh I only wanted the raw data. I will not leave this running 😄

A
#17 anglefire

THALL I’ve had home assistant running since I had the solar installed and givtcp for just over a year.
Love it.
But is a time waster. And I have plenty of those 🤣

#18 THALL

anglefire I try not to do much IT at home. I am a network manager in a secondary school..... So at home I like the simple plug and go. Though saying that I still ran fibre round my house etc! never mind.

A
#19 anglefire

THALL well. I’m a controls engineer so mess with networks as well at work and then come home and mess with the home system - I have a full industrial control system and it talks to/from home assistant via modbus so get the data from everything I want to everything else 🤣

C
#20 chris_p

hoggy it’s easier just flashing a Pi

I want to avoid this as I have a Pi with Apache, MySQL, php etc already installed. I tried Docker version of HA but it doesn't allow add ons. Then tried installing HA directly onto my Pi, what a PITA that has been, still not there either! I have a spare Pi so I could use that...

#21 Riscy

chris_p tried installing HA directly onto my Pi, what a PITA

It's definitely worth another bash, I'd say.

The installer for the fully-packaged Home Assistant OS is really slick these days. I've had it running for years on a Pi and it's bombproof. And like you say, the ability to use the Add Ons system is handy.

Word of advice for Pi users: I'm running I/O heavy with thousands of sensors per minute into both the MariaDB SQL and Influx DB (with unlimited retention.) And a Grafana UI. Early on, I had an awful time with SD cards getting nuked, with rebuilds needed about every other month. I moved it all to a Pi4 with USB3 NVMe drive and never looked back - 100% uptime in the last couple of years. EDIT: 0% unplanned downtime, I should say...

Z
#22 Zakalwe

You can get a 2nd hand thin-client off eBay for about £30 ish. There's a fairly simple routine to install it using Balena Etcher.
https://community.home-assistant.io/t/wyse-thin-client-home-assistant-os-installation-instructions/220524

Ditto for running it on a Pi- use Balena Etcher to flash it and it will be up and running in less than 10 minutes.

Riscy I moved it all to a Pi4 with USB3 NVMe drive and never looked back

100% this. HA will kill SD cards in short order- they aren't made for that many read/writes. I use an external USB3 enclosure and a suitable M2 drive.
https://smile.amazon.co.uk/gp/product/B01N4EUXCU/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1

C
#23 chris_p

Installed HA on a dedicated Pi3 I had in the drawer with the full image method, followed the 'Speak to the Geek' videos and I'm all setup. Thanks everyone for your help.

#24 judgepd

Has anyone noticed or knows why the GivTCP battery voltage is not the same as the battery voltage reported on the portal or in the app? For me, the GivTCP value is usually about 0.5V higher.

A
#25 anglefire

judgepd Must admit I first thought that can’t be true. But I’ve just looked at the portal and what I’m seeing via givtcp and it does look like I too have a 0.5v difference.
I’ll download the data later and see if it’s consistent.

C
#26 chris_p

There are also two SOC values in givTCP, anyone know what the difference is?

#27 judgepd

chris_p No, and for me they don't agree with app/portal SOC either.

A
#28 anglefire

chris_p Ones from the inverter the other the battery - one looks to be about 5% out at the bottom end - so reads 9% when the other is at 4% - Perhaps significant when it comes to calibration??

A
#29 anglefire

judgepd I've just downloaded the CSV from the portal and the GivTCP information and they tie up exactly.

#30 judgepd

anglefire I thought you said you saw a 0.5V difference too?

A
#31 anglefire

judgepd No this was the SOC between portal and GivTCP. They are spot on. (Sorry should have specified)

I've done a comparison of voltages though and they are between 0.5 and 0.92 - though the data time stamps don't quite tie up and the GivTCP data is averaged over a 5minutes period. But does suggest a difference, which is odd.

#32 judgepd

anglefire I'll add it to the list of odd things about the GE system.

A
#33 anglefire

judgepd it might be a rounding error. The soc is whole numbers. The voltage tenths. Chances are they are integer values with a divide by 10 and one may be doing a different calculation. For example one might be rounding the individual cell voltages before the addition and one after. That could easily account for it. Especially the inconsistency in the difference.

I’ll have a look at the cell voltages tomorrow and see if I can make that theory stack up.

T
#34 Tim

anglefire But if you have multiple inverters & batteries (Plant?) then you need to run two (or more) instances of GivTCP - and that doesn't work if you use it as an ADDIN in Homeassistant as you can only have one.

The latest version of Givtcp allows up to three inverters in the HA add-on. Not sure if there's a limit on batteries.

A
#35 anglefire

Tim Yes I know that - it was multiple inverters that there is an issue with.

A
#36 anglefire

anglefire Done some more analysis on the battery voltages - and I can't get the same number on the portal as I see in GivTCP - I see a roughly 0.5V difference - so really not sure how its being done. In theory both should be the same as they both should be calling the same API (Or whatever the method is!) and using the modbus values.
I did check the total battery voltage and the sum of the individual voltages as seen by GivTCP and they tie up. Which doesn't surprise me.

#37 judgepd

anglefire Yeah, same here, all the cell voltages added together make the same as GivTCP voltage total but that is always about 0.5V higher than the portal/app voltage.

#38 Riscy

Now I don't entirely know what I'm talking about; but I think there are two different voltages. For example, a snippet of a log from my system:

  • Terminal Voltage: 55.26V
  • BMS Voltage: 54.7V

I'd make that a 0.5V difference. Purely deduction. Possibly coincidence.

#39 judgepd

Interesting. I can't see any other voltages other than cell voltages on GivTCP.

#40 hoggy

I’m not sure if HA brings them all in as entities?
You may have some joy with the raw JSON output (homeassistant.local:6345/runAll)

A
#41 anglefire

hoggy I can see a v_battery (50.62v) and Battery_Voltage = 51.086 (Via MQTT as its easier than grabbing the JSON - but its the same thing)
So that could be the answer - interestingly, V_battery is in the raw section, so unless you have that ENV enabled in GivTCP you won't see it.

T
#42 ToothyChris

Is it possible voltages are being measured both in the battery and in the inverter, with the difference being the voltage drop down the thick DC cables? I don't think this could be true, as the voltage drop would be proportional to the current, rather than a fixed value (i.e. 0.5v).

But if there was a series diode (to protect against reverse polarity??) then that would give a fixed drop of about 0.6v.....

#43 hoggy

Something else to bear in mind is I was told that those packs with 32 cells (any of them with 2P16S written on the nameplate) will have some sort of smoothing done in regards to averaging individual cell voltages for cell pairs (given the BMS only has 16 inputs)
Quite what, or how, it achieves this I don’t know. (I fail to see how it can possibly separate 2 cells to get a voltage of each one to then return an average value of each pair)
Sounded like BS to me but might as well add it to the theory pot.

R
#44 RobCompton

I too have worked with IT and Communications for many years and I started to look at the Home Automation stuff that is required to run GivTCP and quietly put it down and walked away. I don't have time for that stuff. I want a simple "click and install" app that obviously will require the IP of the inverter, and it does the rest. Not "install this, then add that, and once you've done this, hold up a earthenware pot at 73 degrees to north in your left hand, while playing the sailors hornpipe on a penny whistle with your right foot". I'm done with that stuff. I used to do it years ago just to make a Linux system work. I have a 24/7 linux running box or two here, they're running my firewall/router and my server. But they're in a rack in an outbuilding.

So for now. This thing is not for me. Perhaps when I retire and have time. Though I've always said, I'll retire when they throw the match on the fire.

P
#45 pacemaker

RobCompton I too have worked with IT and Communications for many years and I started to look at the Home Automation stuff that is required to run GivTCP and quietly put it down and walked away.

same... spent a day trying to do it... too much time. I managed to get it working in Docker and pinging the inverter, but it wouldn't respond with any data so I gave up.

A
#46 aniseedvan

I bought an old Wyse off eBay for about £35, followed instructions on good old YouTube, and aside from having to pull the SSD and image it directly from a laptop, it was reasonably straightforward, I’ve never really used Linux (all my IT days have been windows), and only had to google a couple of things. My wyse is fairly underpowered (4gb RAM, 16gb SSD) but ticks along nicely just giving me the ability to monitor and switch things on around the house so far. The automation is problematic but it’s a gap between my desire and the way the logic works.

Z
#47 ZmGahH6yQBe

Out of interest has anyone tried givenergy-local for HA? I've installed HA and GivTCP but not used it for anything yet. Just wondering is givenergy-local is any better, or worse?

J
#48 justpassing

I am using it. Slightly fewer read only registers exposed, and also less controls. However, for general use it does just the same job, and uses the same underlying python givenergy-modbus library. With one exception to do with timed discharge, it does everything i need, and is a single integration instead of a stand alone container sharing info over mqtt.

i would suggest its the simple place to start with HA and givenergy unless you find its lacking something you need.

R
#49 RobCompton

I had a go at the so called Home Assistant simple install on Windows (11) using a YouTube tutorial, only to find it doesn't support Add-Ons in it's current state and would require quite a lot of additional bits to make it work. I then remembered I'd bought my son a Raspeberry Pi (3) starter kit, which he'd never used. So stole it back and installed the Home Assistant OS. I've installed Mosquito and when I get a chance, i'll move to the next step. It's certainly less painful (so far) than trying to build it up on an existing Linux box - hence my earlier post.
I revisted this whole thing when my existing automations failed to work - had a new inverter fitted on Wednesday - and a mix of the mobile app and the cloud portal made my hair fall out faster and go more grey! I have it working how it was, but it's far from ideal (charge from grid overnight, discharge at 15:30 to 21:30) solar just does what solar does.
With the Home Assistant running, I should be able to make it a bit more intelligent.

#50 dbt85

RobCompton

Rob I was in a similar situation. Without your expertise but still with 30 odd years of building and using computers but very little time on linux and nothing with docker.

I found that a youtube channel called Home Automation Guy really helped get home assistant up and running and he also did blog posts with each video if you prefer to look at it that way. It was a frustrating faff at first and before I found his videos I was quite literally screaming "why cant you *^$@ just speak english" when I'd follow a "sudo bash bin docker /f -3 8# BackedBeans" type command and it not just do the thing it was supposed to do.

Now though I'm settled into the groove of knowing just enough to be dangerous. I have a Pi4 with just HA and Givtcp on for the farms arrays and in the last few weeks I have a Dell Wyse 7010 (£40 ebay) which now has HA, Givtcp, Ad Guard, unifi controller, mosquitto, plex and some other bits on and I can access it all from my browser or edit files and send commands via VS Code on my PC.

But I agree, it looks like a hot mess when you first start. Since you already have linux running on some machines you are at least half way there. You should just need to install docker compose from the command line and then grab a file from one of us with things like Portainer (optional), givtcp, mosquitto, HA already in it and it should pretty much come up with little issue. Do have a watch of the Home automation guy videos about running HA from a container if you wanted to go down that route, he really does cover things well.

T
#51 Tim

RobCompton One of the best things for me is the way in which the HA phone app "just knows" (following configuration) whether you are at home or away. To be able to switch the dishwasher on when there's just 4G signal while on holiday is simply amazing. I do use the DuckDNS add-in to do this but it's all documented. Wherever I am in the world, as long as I have 4G, I can do the same on the phone in HA as I can at home.

#52 positor1

Tim
Can be achieved with Alexa too surely? not disparaging HA but alexa is more within peoples grasp.

T
#53 Tim

positor1 I have no experience of using any voice automations. How do you use this when away from home?

#54 dbt85

Tim You can do it all in the alexa app also.

#55 positor1

Tim
the alexa app works as normal when away from home / on cellular data.

R
#56 RobCompton

dbt85 I have it (Home Assistant) up and running on a Pi3 now. I followed all of the tutorials to the letter, but my HA is not talking to the inverter - the logs say invalid key, but I've checked and double checked the GivEnergy API key and it's right.
Have to go out now, so it'll have to wait until the time fairy grants me some wishes again....

R
#57 RobCompton

Sorted it, not an invalid key - the mqttuser password had a typo in it... doh!