Skip to content

Commit

Permalink
config within separate file + example
Browse files Browse the repository at this point in the history
  • Loading branch information
drohhyn committed Jan 21, 2024
1 parent a995340 commit d500088
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ bin/
lib/
lib64
pyvenv.cfg
perla.cfg
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
Read throughput and volume of BWT Perla water softening system (new VNC based firmware!)
Original code by [d3m0nxxl](https://github.com/d3m0nxxl/bwt_perla_smartmeter), but somehow my BWT Perla has a fully different resolution so I changed most of the mouse and capture coordinates.


## improvements
* Reusable method for capturing
* Also including NaCl (Regeneriermittel)
* mqtt with username/password
* config on own perla.cfg file

## requirements

Expand All @@ -19,3 +21,4 @@ source bin/activate
pip3 install pytesseract paho-mqtt vncdotool
python3 bwt_perla_smartmeter.py
```
create your own `pera.cfg` from the `pera.cfg-EXAMPLE` in the same folder.
19 changes: 13 additions & 6 deletions bwt_perla_smartmeter.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@
import pytesseract
import re
import paho.mqtt.client as mqtt
import configparser

bwt_ipaddress="192.168.0.mmm"
bwt_password="passwd"
mqtt_address="192.168.0.nnn"
mqtt_user="mqttuser"
mqtt_pass="mqttpass"
mqtt_topic="water/bwt/"
configParser = configparser.RawConfigParser()
configFilePath = r'./perla.cfg'
configParser.read(configFilePath)

#print('from config: '+configParser.get('bwt','bwt_ipaddress'))

bwt_ipaddress=configParser.get('bwt','bwt_ipaddress')
bwt_password=configParser.get('bwt','bwt_password')
mqtt_address=configParser.get('mqtt','mqtt_address')
mqtt_user=configParser.get('mqtt','mqtt_user')
mqtt_pass=configParser.get('mqtt','mqtt_pass')
mqtt_topic=configParser.get('mqtt','mqtt_topic')

#def bwt_connect():
vncclient = api.connect(bwt_ipaddress, password=None)
Expand Down
10 changes: 10 additions & 0 deletions perla.cfg-EXAMPLE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bwt]
bwt_ipaddress=192.168.0.mmm
bwt_password=passwd

[mqtt]
mqtt_address=192.168.0.nnn
mqtt_topic=water/bwt/
mqtt_auth=true
mqtt_user=mqttuser
mqtt_pass=mqttpass

0 comments on commit d500088

Please sign in to comment.