Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial custom name property and support for more than one loadpoints #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,29 @@ rm main.zip
Within the project there is a file `/data/dbus-evcc/config.ini` - just change the values - most important is the deviceinstance under "DEFAULT" and host in section "ONPREMISE". More details below:

| Section | Config vlaue | Explanation |
| Section | Config value | Explanation |
| ------------- | ------------- | ------------- |
| DEFAULT | AccessType | Fixed value 'OnPremise' |
| DEFAULT | SignOfLifeLog | Time in minutes how often a status is added to the log-file `current.log` with log-level INFO |
| DEFAULT | Deviceinstance | Unique ID identifying the charger in Venus OS |
| ONPREMISE | Host | IP or hostname of EVCC |

## If you have two load points in EVCC
1. Follow the installation instructions above, but change the commands as follows:
```
wget https://github.com/SamuelBrucksch/dbus-evcc/archive/refs/heads/main.zip
unzip main.zip "dbus-evcc-main/*" -d /data
mv /data/dbus-evcc-main /data/dbus-evcc-1
chmod a+x /data/dbus-evcc-1/install.sh
/data/dbus-evcc-1/install.sh
rm main.zip
```
(Count up `dbus-evcc-1` for each loadpoint)
2. Update the `dbus-evcc-1/config.ini`:
- The `deviceinstance` should be different for each loadpoint: Use `43` for the first. Use `44` for the second loadpoint...
- The `loadpointInstance` should be different for each loadpoint: Use `0` for the first. Use `1` for the second loadpoint...

If you have more than two loadpoints, the procedure is the same, but the indexes should be counted up.

## Useful links
Many thanks. @vikt0rm, @fabian-lauer, @trixing and @JuWorkshop project:
Expand Down
3 changes: 2 additions & 1 deletion config.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[DEFAULT]
AccessType = OnPremise
SignOfLifeLog = 1
Deviceinstance = 43
Deviceinstance = 43 #Default = 43. Count up for every additional loadpoint
LoadpointInstance = 0 #Read readme.md first! Default = 0. Count up for every additional loadpoint

[ONPREMISE]
Host=192.168.1.2:7070
10 changes: 8 additions & 2 deletions dbus-evcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DbusEvccChargerService:
def __init__(self, servicename, paths, productname='EVCC-Charger', connection='EVCC REST API'):
config = self._getConfig()
deviceinstance = int(config['DEFAULT']['Deviceinstance'])
lpInstance = int(config['DEFAULT']['LoadpointInstance'])

self._dbusservice = VeDbusService("{}.http_{:02d}".format(servicename, deviceinstance))
self._paths = paths
Expand All @@ -37,6 +38,11 @@ def __init__(self, servicename, paths, productname='EVCC-Charger', connection='E

# get data from go-eCharger
data = self._getEvccChargerData()
result = data["result"]
loadpoint = result["loadpoints"][lpInstance]

# Set custom name from loadpoint title
customname = str(loadpoint['title'])

# Create the management objects, as specified in the ccgx dbus-api document
self._dbusservice.add_path('/Mgmt/ProcessName', __file__)
Expand All @@ -48,7 +54,7 @@ def __init__(self, servicename, paths, productname='EVCC-Charger', connection='E
self._dbusservice.add_path('/DeviceInstance', deviceinstance)
self._dbusservice.add_path('/ProductId', 0xFFFF) #
self._dbusservice.add_path('/ProductName', productname)
self._dbusservice.add_path('/CustomName', productname)
self._dbusservice.add_path('/CustomName', customname)
#self._dbusservice.add_path('/FirmwareVersion', int(data['divert_update']))
self._dbusservice.add_path('/HardwareVersion', 2)
#self._dbusservice.add_path('/Serial', data['comm_success'])
Expand Down Expand Up @@ -131,7 +137,7 @@ def _update(self):
# get data from go-eCharger
data = self._getEvccChargerData()
result = data["result"]
loadpoint = result["loadpoints"][0]
loadpoint = result["loadpoints"][lpInstance]

# send data to DBus

Expand Down