This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Rodriguez
committed
Nov 15, 2023
1 parent
07897bf
commit 07f744f
Showing
6 changed files
with
65 additions
and
6 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
42 changes: 42 additions & 0 deletions
42
platform/panduza_platform/devices/hanmatek/hm310t/itf_hanmatek_hm310t_voltmeter.py
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,42 @@ | ||
from hamcrest import assert_that, has_key, instance_of | ||
from meta_drivers.voltmeter import MetaDriverVoltmeter | ||
from connectors.modbus_client_serial import ConnectorModbusClientSerial | ||
|
||
class InterfaceHanmatekHM310tVoltmeter(MetaDriverVoltmeter): | ||
""" | ||
""" | ||
|
||
# --- | ||
|
||
def __init__(self, name=None, modbus_settings={}) -> None: | ||
"""Constructor | ||
""" | ||
self.modbus_settings = modbus_settings | ||
super().__init__(name=name) | ||
|
||
# --- | ||
|
||
async def _PZA_DRV_loop_init(self): | ||
"""Driver initialization | ||
""" | ||
|
||
# Get the gate | ||
self.modbus = await ConnectorModbusClientSerial.Get(**self.modbus_settings) | ||
|
||
# | ||
self.modbus_unit = 1 | ||
|
||
# Call meta class BPC ini | ||
await super()._PZA_DRV_loop_init() | ||
|
||
# --- | ||
|
||
async def _PZA_DRV_VOLTMETER_read_measure_value(self): | ||
addr = 0x0010 | ||
regs = await self.modbus.read_holding_registers(addr, 1, self.modbus_unit) | ||
# self.log.debug(f"read real current addr={hex(addr)} regs={regs}") | ||
float_value = float(regs[0]) / 100.0 | ||
return float_value | ||
|
||
# --- | ||
|
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
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
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
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