-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 20da952
Showing
25 changed files
with
1,632 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 Manuel | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
# dbus-mqtt-pv - Emulates a physical PV Inverter from MQTT data | ||
|
||
<small>GitHub repository: [mr-manuel/venus-os_dbus-mqtt-pv](https://github.com/mr-manuel/venus-os_dbus-mqtt-pv)</small> | ||
|
||
### Disclaimer | ||
|
||
I wrote this script for myself. I'm not responsible, if you damage something using my script. | ||
|
||
|
||
### Purpose | ||
|
||
The script emulates a Photovoltaic AC Inverter in Venus OS. It gets the MQTT data from a subscribed topic and publishes the information on the dbus as the service `com.victronenergy.pvinverter.mqtt_pv` with the VRM instance `51`. | ||
|
||
|
||
### Config | ||
|
||
Copy or rename the `config.sample.ini` to `config.ini` in the `dbus-mqtt-pv` folder and change it as you need it. | ||
|
||
|
||
### JSON structure | ||
|
||
<details><summary>Minimum required</summary> | ||
|
||
```json | ||
{ | ||
"pv": { | ||
"power": 0.0 | ||
} | ||
} | ||
``` | ||
</details> | ||
|
||
<details><summary>Minimum required with L1</summary> | ||
|
||
```json | ||
{ | ||
"pv": { | ||
"power": 0.0, | ||
"L1": { | ||
"power": 0.0 | ||
} | ||
} | ||
} | ||
``` | ||
</details> | ||
|
||
<details><summary>Minimum required with L1, L2</summary> | ||
|
||
```json | ||
{ | ||
"pv": { | ||
"power": 0.0, | ||
"L1": { | ||
"power": 0.0 | ||
}, | ||
"L2": { | ||
"power": 0.0 | ||
} | ||
} | ||
} | ||
``` | ||
</details> | ||
|
||
<details><summary>Minimum required with L1, L2, L3</summary> | ||
|
||
```json | ||
{ | ||
"pv": { | ||
"power": 0.0, | ||
"L1": { | ||
"power": 0.0 | ||
}, | ||
"L2": { | ||
"power": 0.0 | ||
}, | ||
"L3": { | ||
"power": 0.0 | ||
} | ||
} | ||
} | ||
``` | ||
</details> | ||
|
||
<details><summary>Full</summary> | ||
|
||
```json | ||
{ | ||
"pv": { | ||
"power": 0.0, | ||
"voltage": 0.0, | ||
"current": 0.0, | ||
"energy_forward": 0.0, | ||
"L1": { | ||
"power": 0.0, | ||
"voltage": 0.0, | ||
"current": 0.0, | ||
"energy_forward": 0.0, | ||
}, | ||
"L2": { | ||
"power": 0.0, | ||
"voltage": 0.0, | ||
"current": 0.0, | ||
"energy_forward": 0.0, | ||
}, | ||
"L3": { | ||
"power": 0.0, | ||
"voltage": 0.0, | ||
"current": 0.0, | ||
"energy_forward": 0.0, | ||
} | ||
} | ||
} | ||
``` | ||
</details> | ||
|
||
|
||
### Install | ||
|
||
1. Copy the `dbus-mqtt-pv` folder to `/data/etc` on your Venus OS device | ||
|
||
2. Run `bash /data/etc/dbus-mqtt-pv/install.sh` as root | ||
|
||
The daemon-tools should start this service automatically within seconds. | ||
|
||
### Uninstall | ||
|
||
Run `/data/etc/dbus-mqtt-pv/uninstall.sh` | ||
|
||
### Restart | ||
|
||
Run `/data/etc/dbus-mqtt-pv/restart.sh` | ||
|
||
### Debugging | ||
|
||
The logs can be checked with `tail -n 100 -f /data/log/dbus-mqtt-pv/current | tai64nlocal` | ||
|
||
The service status can be checked with svstat `svstat /service/dbus-mqtt-pv` | ||
|
||
This will output somethink like `/service/dbus-mqtt-pv: up (pid 5845) 185 seconds` | ||
|
||
If the seconds are under 5 then the service crashes and gets restarted all the time. If you do not see anything in the logs you can increase the log level in `/data/etc/dbus-mqtt-pv/dbus-mqtt-pv.py` by changing `level=logging.WARNING` to `level=logging.INFO` or `level=logging.DEBUG` | ||
|
||
If the script stops with the message `dbus.exceptions.NameExistsException: Bus name already exists: com.victronenergy.pvinverter.mqtt_pv"` it means that the service is still running or another service is using that bus name. | ||
|
||
### Compatibility | ||
|
||
It was tested on Venus OS Large `v2.92` on the following devices: | ||
|
||
* RaspberryPi 4b | ||
* MultiPlus II (GX Version) | ||
|
||
### Screenshots | ||
|
||
<details><summary>Power and/or L1</summary> | ||
|
||
![Pv power L1 - pages](/screenshots/pv_power_L1_pages.png) | ||
![Pv power L1 - device list](/screenshots/pv_power_L1_device-list.png) | ||
![Pv power L1 - device list - mqtt pv 1](/screenshots/pv_power_L1_device-list_mqtt-pv-1.png) | ||
![Pv power L1 - device list - mqtt pv 2](/screenshots/pv_power_L1_device-list_mqtt-pv-2.png) | ||
|
||
</details> | ||
|
||
<details><summary>Power, L1 and L2</summary> | ||
|
||
![Pv power L1, L2 - pages](/screenshots/pv_power_L2_L1_pages.png) | ||
![Pv power L1, L2 - device list](/screenshots/pv_power_L2_L1_device-list.png) | ||
![Pv power L1, L2 - device list - mqtt pv 1](/screenshots/pv_power_L2_L1_device-list_mqtt-pv-1.png) | ||
![Pv power L1, L2 - device list - mqtt pv 2](/screenshots/pv_power_L2_L1_device-list_mqtt-pv-2.png) | ||
|
||
</details> | ||
|
||
<details><summary>Power, L1, L2 and L3</summary> | ||
|
||
![Pv power L1, L2, L3 - pages](/screenshots/pv_power_L3_L2_L1_pages.png) | ||
![Pv power L1, L2, L3 - device list](/screenshots/pv_power_L3_L2_L1_device-list.png) | ||
![Pv power L1, L2, L3 - device list - mqtt pv 1](/screenshots/pv_power_L3_L2_L1_device-list_mqtt-pv-1.png) | ||
![Pv power L1, L2, L3 - device list - mqtt pv 2](/screenshots/pv_power_L3_L2_L1_device-list_mqtt-pv-2.png) | ||
|
||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
[DEFAULT] | ||
; used when no voltage is received | ||
voltage = 230 | ||
|
||
|
||
[PV] | ||
; Max rated power (in Watts) of the inverter | ||
max = 700 | ||
; position (connected input/output) of the PV inverter | ||
; 0 = AC input 1 (select this if you don't have a MultiPlus or Quattro) | ||
; 1 = AC output | ||
; 2 = AC input 2 | ||
position = 0 | ||
|
||
|
||
[MQTT] | ||
; IP addess or FQDN from MQTT server | ||
broker_address = IP_ADDR_OR_FQDN | ||
|
||
; Port of the MQTT server | ||
; default plaintext: 1883 | ||
; default TLS port: 8883 | ||
broker_port = 1883 | ||
|
||
; Enables TLS | ||
;tls_enabled = 1 | ||
|
||
; Absolute path to the Certificate Authority certificate file that is to be treated as trusted by this client | ||
;tls_path_to_ca = /data/keys/mosquitto.crt | ||
|
||
; Disables verification of the server hostname in the server certificate | ||
;tls_insecure = 1 | ||
|
||
; Username used for connection | ||
;username = myuser | ||
|
||
; Password used for connection | ||
;password = mypassword | ||
|
||
; Topic where the pv data as JSON string is published | ||
topic_pv = enphase/envoy-s/meters |
Oops, something went wrong.