britkat1980 / giv_tcp

TCP connection (from inverter) and MQTT implementation
72 stars 33 forks source link

How to get GivTCP to run on Docker Desktop, Windows and configure AIO. #194

Open davebuk opened 3 weeks ago

davebuk commented 3 weeks ago

Hi all

I've just had an AIO installed and want to connect it to openHAB using MQTT.

I've not used Docker and although I managed to pull the image into Docker, I can't find away to configure the code for the AIO.

Im not sure if I should be trying to adjust the ENV settings or docker-compose.yaml. Even then I don't know how to edit the files.

Can anyone assist with setting up Docker on Windows for the AIO?

Thanks.

davebuk commented 1 week ago

I'm sort of getting somewhere. The only way I can get it to work is to use the BETA HA addon, pull into Docker, then run it from there putting the relevant ENV entries in for the AIO. I can't get any of the builds from github working, only the BETA from Docker Hub. I presume these are different sets of code?

Using docker pull britkat/giv_tcp-beta in Windows PowerShell, this will import the image into Docker Desktop. When I run the image I can set the ENV as detailed below.

NUMINVERTORS    1 
INVERTOR_IP_1   192.168.1.***
INVERTOR_AIO_1  True
NUMBATTERIES_1  0 
MQTT_OUTPUT True 
MQTT_ADDRESS    192.168.1.***
MQTT_USERNAME   **** 
MQTT_PASSWORD   ****

This all seems to work and I get MQTT messages out but if I want to make any changes, I'd have to start again and re-input the ENVs. I also wanted to run the Web Dash UI, but I can't get access to the files in the image to add the port to the container.

If anyone knows of a way of getting access to the image pulled from docker pull britkat/giv_tcp-beta so I can change the configuration after the container is built, I may be able to add the Web Dash UI.

davebuk commented 3 days ago

I've got GivTCP running with Docker Desktop and MQTT/openHAB. As above, I can pull from Docker Hub using PowerShell. Docker Desktop then shows the image that I can run and create a Container from. I filled in the additional setting before running and it all seems to work.

ENVs Example

It doesn't allow the WebUI to work which might be because I can't get port 3001 to appear in the list of ports for the container. Enabling it and setting the ENVs to those below doesn't show the port in the container.

WEB_DASH    True 
WEB_DASH_PORT   3001

I've only started testing READ values. Below are the ones I'm using at the moment. openHAB .things

Bridge mqtt:broker:pimqttbroker [host="192.168.1.***", secure=false, qos=1, username="***", password="***"] {

Thing topic Giv_tcp "Giv Energy AIO Data" @ "Systems" 
{ Channels: 
    Type number : givtcp_flow_sol-to-house "Watts - Solar to House" [ stateTopic="AIO01/CH***/Power/Flows/Solar_to_House"]
    Type number : givtcp_flow_sol-to-batt "Watts - Solar to Battery" [ stateTopic="AIO01/CH***/Power/Flows/Solar_to_Battery"]   
    Type number : givtcp_flow_sol-to-grid "Watts - Solar to Grid" [ stateTopic="AIO01/CH***/Power/Flows/Solar_to_Grid"]
    Type number : givtcp_flow_bat-to-house "Watts - Battery to House" [ stateTopic="AIO01/CH***/Power/Flows/Battery_to_House"]
    Type number : givtcp_flow_bat-to-grid "Watts - Battery to Grid" [ stateTopic="AIO01/CH***/Power/Flows/Battery_to_Grid"]
    Type number : givtcp_flow_grid-to-house "Watts - Grid to House" [ stateTopic="AIO01/CH***/Power/Flows/Grid_to_House"]
    Type number : givtcp_flow_grid-to-battery "Watts - Grid to Battery" [ stateTopic="AIO01/CH***/Power/Flows/Grid_to_Battery"]
    Type number : givtcp_battery_SOC "Battery State of Charge %" [ stateTopic="AIO01/CH***/Battery_Details/Battery_Stack_1/Stack_SOC_High"]
    Type datetime : givtcp_Stats_Last_Updated_Time "Time and Date of last update" [ stateTopic="AIO01/CH***/Stats/Last_Updated_Time"]
}
}

openHAB .items

Number:Power givtcpAIO_flow_soltohouse "Watts - Solar to House [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_sol-to-house" }
Number:Power givtcpAIO_flow_soltobatt "Watts - Solar to Battery [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_sol-to-batt" }
Number:Power givtcpAIO_flow_soltogrid "Watts - Solar to Grid [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_sol-to-grid" }
Number:Power givtcpAIO_flow_battohouse "Watts - Battery to House [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_bat-to-house" }
Number:Power givtcpAIO_flow_battogrid "Watts - Battery to Grid [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_bat-to-grid" }
Number:Power givtcpAIO_flow_gridtohouse "Watts - Grid to House [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_grid-to-house" }
Number:Power givtcpAIO_flow_gridtobattery "Watts - Grid to Battery [%d %unit%]" <energy> { unit="W", channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_flow_grid-to-battery" }
Number givtcpAIO_battery_SOC "Battery State of Charge [%d %%]" <energy> { channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_battery_SOC" }
DateTime givtcpAIO_Stats_Last_Updated_Time "Time and Date of last update [%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS - UTC]" <time> { channel="mqtt:topic:pimqttbroker:Giv_tcp:givtcp_Stats_Last_Updated_Time" }

openHAB .sitemap

sitemap giv_tcp label="GivTCP Battery Data"
{
Frame label="Power Info" {
Default item=givtcpAIO_flow_soltohouse
Default item=givtcpAIO_flow_soltobatt
Default item=givtcpAIO_flow_soltogrid
Default item=givtcpAIO_flow_battohouse
Default item=givtcpAIO_flow_battogrid
Default item=givtcpAIO_flow_gridtohouse
Default item=givtcpAIO_flow_gridtobattery
}
Frame label="Battery State" {
Default item=givtcpAIO_battery_SOC
Default item=givtcpAIO_Stats_Last_Updated_Time
}
}
davebuk commented 3 days ago

I have also tried downloading the Docker file from https://github.com/britkat1980/ha-addons/tree/main/givtcp-beta and using it from within PowerShell to build an image but I can't get it to work.

It would be nice to be able to create a Docker file or compose.yaml, pre-configure my settings for AIO etc and build the working BETA image with WebUI working.

britkat1980 commented 3 days ago

Web gui runs on port 8099, which serves both the rest interface and config gui. Open that port on container, or run on host network to allow auto-discovery of inverters on the network.

davebuk commented 3 days ago

I get '500 Internal Server Error' for port 8099.

davebuk commented 3 days ago

Some of your Docker files have COPY WebDashboard ./WebDashboard while others have COPY WebDashboard/ ./WebDashboard. Will this WebDashboard/ have any direct impact?