Skip to content

Commit

Permalink
Merge pull request #32 from britkat1980/main
Browse files Browse the repository at this point in the history
2.1.11
  • Loading branch information
Mikiiw authored Jul 9, 2023
2 parents da3b125 + 174ea0c commit 98731c9
Show file tree
Hide file tree
Showing 87 changed files with 21,256 additions and 1,319 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
GivTCP/settings.py
GivTCP/testdata.json
GivTCP/startup.sh
.lockfile
*.pkl
.forceFullRefresh
test.txt
Empty file removed .forceFullRefresh
Empty file.
14 changes: 14 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

# Explicitly declare text files you want to always be normalized and converted
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sh text eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Stop Mac Filesystem Filesystem
.DS_Store

# Stop the Nova Project files from getting published
.nova

# Stop the gitignore file from being published
.gitignore

# Stop the build file being published
buildx.sh
.venv
.vscode
GivTCP/__pycache__
./givenergy_modbus/__pycache__
GivTCP/givenergy_modbus_2
GivTCP/asyncclient.py
GivTCP/testdata.json
.dockerignore
.gitattributes
GivTCP/settings.py
MQTT_TEST.py
REST_TEST.py
test.py
179 changes: 179 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@

# Change Log
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [2.2.3] - 2023-07-03
### Fixed
- Fixed Charge_time_remaining device_class error

## [2.2.2] - 2023-07-03
### Fixed
- Fixed charge target bug (Thanks S0ckhamster)

## [2.2.1] - 2023-06-29
### Fixed
- Invertor Mode calculation
- Fixed Inverer Time entity
### Added
- Work in progress compatability with the new GE AIO device (no battery data yet) - Beta testers needed
- New battery power mode switch (replicates the GE Portal "Eco" switch)


## [2.2.0] - 2023-06-28
### Fixed
- Type error in MQTT publishing handled gracefully
- Grid Current scaling factor corrected (x10)
### Added
- Updated SmartTarget to PALM 0.10.0 (Thanks Steve Lewis)
- Charge and Discharge time remaining entities (mins till full charge/discharge at current power rate) and absolute time to hit Target SOC/Battery Reserve
- Gen 3 invertors now recognised
- MQTT Auto recognition. If using the Mosquitto addon in HA it will now auto connect, removing need for MQTT configuration before running
- Refactored Write.py to always use the Redis Queue, to remove contention on modbus comms and create more reliable control signals
- Configurable retries on write commands to allow for installations with less reliable comms (Thanks @Ed-M72)
- Modified givenergy-modbus library to allow single timeslot control, to allow better integration with select controls in HA
- Individual timeslot start/end control, to remove race condition for setting start and end together

## [2.1.15] - 2023-06-08
### Fixed
- Fixed SmartTarget error for solcast calls with a single array

## [2.1.14] - 2023-06-05
### Fixed
- REST /getCache endpoint fixed (incorrect json format)
- Minor updates to README.md documentation
- Refactored Force Export to use queuing for more reliable revert
### Added
- Updated SmartTarget to PALM 0.8.5 (Thanks Stephen Lewis)

## [2.1.13] - 2023-05-13
### Fixed
- REST /getCache endpoint fixed (incorrect json format)
- Minor updates to README.md documentation
- Refactored Force Export to use queing for more reliable revert
### Added
- Updated SmartTarget to PALM 0.8.5 (Thanks Stephen Lewis)

## [2.1.13] - 2023-05-13
### Fixed
- Reverting entity naming to include serial number for compatability
### Added
- Reboot Invertor function

## [2.1.12] - 2023-05-13
### Fixed
- HA Invertor time device_class error removed
- Fixed Timed Export & Revert Export Settings (Thanks @Ed-M72)
- Timed Discharge and Force Export no longer set soc_reserve to 100 (which stopped discharge)

## [2.1.11] - 2023-05-07
### Fixed
- HA discovery message error fixed for string variables (Thanks @metalblue)
- Restructure config variables for ease of use (thanks @S0ckhamster)
- Improved handling of Timed Demand mode handing (Thanks @Ed-M72)

## [2.1.10] - 2023-04-30
### Fixed
- HADEVICEPREFIX config variables added for second and third invertors for HA Addon deployment

## [2.1.9] - 2023-04-30
### Fixed
- Updated max mppt pv voltage to match datasheet (550v)
- Remove Data Smoothing from SOC to prevent getting stuck on values below 4%
- Set Rate data points to GBP/kWh
- Dual site IDs now working for Solcast/PALM (Thanks to s0ckhamster)

### Added
- HA Device Prefix per Invertor (use the "_X" suffix )
- Retain Rate Data across reboots/updates (if data is from today)
- PALM settings now handled via ENV (Thanks to s0ckhamster)
- Entity Friendly names no longer use Serial Number

## [2.1.7] - 2023-03-10
### Fixed
- Updated max mppt pv voltage to match datasheet (550v)

## [2.1.3] - 2023-03-04
### Fixed
- modified givenergy-modbus library to calulate inverter type from registers, not from serial number
- Fixed day/Night rate stability in dynamic mode

## [2.1.3] - 2023-02-12
### Fixed
- Fixed error on garbage invertor output
- Fixed Force Charge/Export power rate setting from 100(%) to maxInvertorRate

### Added
- Per Invertor MQTT Topic now available
- Overlapping ForceCharge\Export now handled gracefully. You can extend a current Force action byt recalling it with a new duration and it will set a new Force end time

## [2.1.2] - 2023-02-09

### Added
- Charge and Discharge rates now use absolute power values (2600W) not percentage (100%) to align with Cloud portal and to give correct operation
- Prevented the REST readData call (pubFromPickle) from triggering another read

### Fixed
- Worked on race conditions by using critical sections to replace file locks
- Fix select entities error when setting to a non-float value

### Added
- Changed logging levels so that Info now just shows which operations are called and everything else is Debug
- Force Charge, Force Export and Temp Pause controls now allow you to Cancel, reverting to preious settings immediately
- Updated Battery Reserve and Cut-off entities to correctly reflect invertor behaviour
- Updated Redis scheduling for control lockout
- Added "None" as a smoothing option
- Added invertor firmware to output
- Allow dynamic Day/Night energy slots as well as fixed time (Go vs Intelligent) New "select" entity created to allow external automations to change rate (DYNAMICTARIFF ENV can be set to true to ignore day/night ENV and change rates based on the value of the Select entity)
- Ability to accept dual array installations for Solcast Smart Target (new ENV)


## [2.0.1] - 2022-09-18

Update to GivLUT to allow battery max power to go up to 4000w to account for Gen2 invertors

## [2.0.0rc2] - 2022-09-17

Major update including various stability fixes and new features

### Added
- Force Export boost function (and restore)
- Force Charge boost function (and restore)
- Temporary charge and discharge pause (and restore)
- Change timeslot start and end
- All new control functions are avalable via:
- Select devices (Home assistant)
- MQTT Topic
- REST

- Smart target charge using Solcast forecast and load energy stats. Thanks to [Stephen Lewis](https://github.com/salewis38/palm)
- Only avaiable in docker container or Home Assistant Addon

- User defined port for web dashboard. Thanks to [Dan Gallo](https://github.com/DanielGallo/GivEnergy-Smart-Home-Display/tree/givtcp)
- Only avaiable in docker container or Home Assistant Addon

- Data smoothing across energy and battery data (not power)
- log to file by default
- Cache data stored in user defined folder. Useful to delete in the event of problems

#### New ENV
- CACHELOCATION="/config/GivTCP" - if using Home assistant addon, make sure this starts with /config
- DATASMOOTHER="High" - High, medium or low. Level of aggression on smoothing large jumps in data
- SMARTTARGET=True - If True, then the three below ENV must be set. This will update your Target SOC 20mins before it is due to start charging
- GEAPI="" - API key from your GE account
- SOLCASTAPI="" - Solcast API key
- SOLCASTSITEID="" - Solcast site ID
- DEBUG_FILE_LOCATION - has been removed

### Changed
- Re-structred the lookup tables into single class
- Data structure for all data points using new class type
- Logging to file now uses a rotating file handler and will keep 7 days of logs
- Underlying [givenergy-modbus](https://github.com/dewet22/givenergy-modbus) errors supressed in logging
- Mode control now automatically updates (dis)charge schedule as appropriate
### Fixed
- Obey Print Raw ENV
- Midnight data sticking for Energy Today stats
- many more...
85 changes: 68 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
FROM python:rc-alpine

RUN apk --no-cache add mosquitto
RUN apk add --no-cache bash
RUN apk add curl
RUN apk add --update npm
RUN npm install -g serve
RUN apk add git
RUN apk add tzdata
RUN apk add musl-utils
RUN apk add xsel
RUN apk add redis

# set the working directory in the container
WORKDIR /app
Expand All @@ -15,30 +22,74 @@ RUN pip install -r requirements.txt

# copy the content of the local src directory to the working directory
COPY GivTCP/ ./GivTCP
#COPY givenergy_modbus/ /usr/local/lib/python3.10/site-packages/givenergy_modbus
COPY GivEnergy-Smart-Home-Display-givtcp/ ./GivEnergy-Smart-Home-Display-givtcp
COPY givenergy_modbus/ /usr/local/lib/python3.10/site-packages/givenergy_modbus

ENV INVERTOR_IP=""
ENV NUM_BATTERIES="1"
ENV MQTT_OUTPUT="True"
ENV MQTT_ADDRESS="127.0.0.1"
COPY startup.py startup.py
COPY startup_2.py startup_2.py
COPY redis.conf redis.conf

ENV NUMINVERTORS=1
ENV INVERTOR_IP_1=""
ENV NUMBATTERIES_1=1
ENV INVERTOR_AIO_1=False
ENV INVERTOR_IP_2=""
ENV NUMBATTERIES_2=1
ENV INVERTOR_AIO_2=False
ENV INVERTOR_IP_3=""
ENV NUMBATTERIES_3=1
ENV INVERTOR_AIO_3=False
ENV MQTT_OUTPUT=True
ENV MQTT_ADDRESS=""
ENV MQTT_USERNAME=""
ENV MQTT_PASSWORD=""
ENV MQTT_TOPIC=""
ENV MQTT_PORT="1883"
ENV LOG_LEVEL="Error"
ENV DEBUG_FILE_LOCATION=""
ENV PRINT_RAW="True"
ENV SELF_RUN="True"
ENV SELF_RUN_LOOP_TIMER="10"
ENV INFLUX_OUTPUT="False"
ENV MQTT_TOPIC_2=""
ENV MQTT_TOPIC_3=""
ENV MQTT_PORT=1883
ENV LOG_LEVEL="Info"
ENV PRINT_RAW=True
ENV SELF_RUN=True
ENV SELF_RUN_LOOP_TIMER=5
ENV INFLUX_OUTPUT=False
ENV INFLUX_URL=""
ENV INFLUX_TOKEN=""
ENV INFLUX_BUCKET=""
ENV INFLUX_ORG=""
ENV HA_AUTO_D="True"
ENV GIVTCPINSTANCE=1
ENV HA_AUTO_D=True
ENV HADEVICEPREFIX="GivTCP"
ENV HADEVICEPREFIX_2="GivTCP2"
ENV HADEVICEPREFIX_3="GivTCP3"
ENV PYTHONPATH="/app"
ENV DAYRATE=0.395
ENV NIGHTRATE=0.155
ENV EXPORTRATE=0.04
ENV HOSTIP="192.168.2.10"
ENV DYNAMICTARIFF=False
ENV DAYRATESTART="04:30"
ENV NIGHTRATESTART="00:30"
ENV TZ="Europe/London"
ENV WEB_DASH=False
ENV WEB_DASH_PORT=3000
ENV CACHELOCATION="/config/GivTCP"
ENV DATASMOOTHER="medium"
ENV QUEUE_RETRIES=2

ENV SMARTTARGET=False
ENV GEAPI=""
ENV SOLCASTAPI=""
ENV SOLCASTSITEID=""
ENV SOLCASTSITEID2=""
ENV PALM_WINTER="01,02,03,10,11,12"
ENV PALM_SHOULDER="04,05,09"
ENV PALM_MIN_SOC_TARGET=25
ENV PALM_MAX_SOC_TARGET=45
ENV PALM_BATT_RESERVE=4
ENV PALM_BATT_UTILISATION=0.85
ENV PALM_WEIGHT=35
ENV LOAD_HIST_WEIGHT="1"


EXPOSE 6345 1883
EXPOSE 6345 1883 3000 6379 9181

ENTRYPOINT ["sh", "/app/GivTCP/startup.sh"]
CMD ["python3", "/app/startup.py"]
4 changes: 4 additions & 0 deletions GivEnergy-Smart-Home-Display-givtcp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
.idea/

*.iml
Loading

0 comments on commit 98731c9

Please sign in to comment.