Skip to content

Commit 346b1af

Browse files
authored
Merge pull request #186 from reserve85/dev_AMIS_Reader
Add AMIS reader support
2 parents ef22620 + 178aed4 commit 346b1af

4 files changed

Lines changed: 42 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## V1.92
4+
### script
5+
* support "Mitterbaur AMIS Lesekopf" (https://github.com/reserve85/HoymilesZeroExport/issues/184)
6+
### config
7+
* add `[SELECT_POWERMETER]`: `USE_AMIS_READER`
8+
* add `[AMIS_READER]`: `AMIS_READER_IP`
9+
* add `[SELECT_INTERMEDIATE_METER]`: `USE_AMIS_READER_INTERMEDIATE`
10+
* add `[INTERMEDIATE_AMIS_READER]`: `AMIS_READER_IP_INTERMEDIATE`
11+
312
## V1.91
413
### script
514
* support Home Assistant over HTTPS (https://github.com/reserve85/HoymilesZeroExport/issues/178)

HoymilesZeroExport.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
__author__ = "Tobias Kraft"
18-
__version__ = "1.91"
18+
__version__ = "1.92"
1919

2020
import requests
2121
import time
@@ -817,6 +817,18 @@ def GetJson(self):
817817
def GetPowermeterWatts(self):
818818
return CastToInt(self.GetJson()['data'][0]['tuples'][0][1])
819819

820+
class AmisReader(Powermeter):
821+
def __init__(self, ip: str):
822+
self.ip = ip
823+
824+
def GetJson(self, path):
825+
url = f'http://{self.ip}{path}'
826+
return session.get(url, timeout=10).json()
827+
828+
def GetPowermeterWatts(self):
829+
ParsedData = self.GetJson(f'/rest')
830+
return CastToInt(ParsedData['saldo'])
831+
820832
class DTU(Powermeter):
821833
def __init__(self, inverter_count: int):
822834
self.inverter_count = inverter_count
@@ -1187,6 +1199,10 @@ def CreatePowermeter() -> Powermeter:
11871199
config.get('SCRIPT', 'SCRIPT_USER'),
11881200
config.get('SCRIPT', 'SCRIPT_PASS')
11891201
)
1202+
elif config.getboolean('SELECT_POWERMETER', 'USE_AMIS_READER'):
1203+
return AmisReader(
1204+
config.get('AMIS_READER', 'AMIS_READER_IP')
1205+
)
11901206
else:
11911207
raise Exception("Error: no powermeter defined!")
11921208

@@ -1262,6 +1278,10 @@ def CreateIntermediatePowermeter(dtu: DTU) -> Powermeter:
12621278
config.get('INTERMEDIATE_VZLOGGER', 'VZL_PORT_INTERMEDIATE'),
12631279
config.get('INTERMEDIATE_VZLOGGER', 'VZL_UUID_INTERMEDIATE')
12641280
)
1281+
elif config.getboolean('SELECT_INTERMEDIATE_METER', 'USE_AMIS_READER_INTERMEDIATE'):
1282+
return AmisReader(
1283+
config.get('INTERMEDIATE_AMIS_READER', 'AMIS_READER_IP_INTERMEDIATE')
1284+
)
12651285
else:
12661286
return dtu
12671287

HoymilesZeroExport_Config.ini

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# ---------------------------------------------------------------------
2020

2121
[VERSION]
22-
VERSION = 1.91
22+
VERSION = 1.92
2323

2424
[SELECT_DTU]
2525
# --- define your DTU (only one) ---
@@ -38,6 +38,7 @@ USE_IOBROKER = false
3838
USE_HOMEASSISTANT = false
3939
USE_VZLOGGER = false
4040
USE_SCRIPT = false
41+
USE_AMIS_READER = false
4142

4243
[AHOY_DTU]
4344
# --- defines for AHOY-DTU ---
@@ -136,6 +137,10 @@ SCRIPT_FILE = GetPowerFromVictronMultiplus.sh
136137
SCRIPT_USER =
137138
SCRIPT_PASS =
138139

140+
# --- defines for Mitterbaur AMIS Reader ---
141+
[AMIS_READER]
142+
AMIS_READER_IP = xxx.xxx.xxx.xxx
143+
139144
[SELECT_INTERMEDIATE_METER]
140145
# if you have an intermediate meter ("Zwischenzähler") to measure the outputpower of your inverter you can set it here. It is faster than the DTU current_power value
141146
# --- define your intermediate meter - if you don´t have one set the following defines to false to use the value from your DTU---
@@ -151,6 +156,7 @@ USE_EMLOG_INTERMEDIATE = false
151156
USE_IOBROKER_INTERMEDIATE = false
152157
USE_HOMEASSISTANT_INTERMEDIATE = false
153158
USE_VZLOGGER_INTERMEDIATE = false
159+
USE_AMIS_READER_INTERMEDIATE = false
154160

155161
[INTERMEDIATE_TASMOTA]
156162
# --- defines for Tasmota Smartmeter Modul---
@@ -214,6 +220,10 @@ VZL_PORT_INTERMEDIATE = 2081
214220
# you need to specify the uuid of the vzlogger channel for the reading OBIS(16.7.0) (aktuelle Gesamtwirkleistung)
215221
VZL_UUID_INTERMEDIATE = 06ec9562-a490-49fe-92ea-ffe0758d181c
216222

223+
# --- defines for Mitterbaur AMIS Reader ---
224+
[INTERMEDIATE_AMIS_READER]
225+
AMIS_READER_IP_INTERMEDIATE = xxx.xxx.xxx.xxx
226+
217227
# Uncomment the following section if you want to use MQTT to dynamically reconfigure some settings while the script is running
218228
# [MQTT_CONFIG]
219229
# MQTT_BROKER = localhost

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This script does not use MQTT, it's based on webapi communication.
1717
- [HomeAssistant](https://www.home-assistant.io/)
1818
- [Volkszaehler (VZLogger)](https://volkszaehler.org/)
1919
- [ESPHome](https://esphome.io/)
20+
- [Mitterbaur Amis Reader](https://www.mitterbaur.at/amis-leser.html)
2021
- shell script based interface
2122
- easy to implement new smart meter modules supporting WebAPI / JSON
2223

0 commit comments

Comments
 (0)