Open colinmacgiolla opened 8 months ago
Heya, I'm going through a refactor so that it should be possible to send a different connection into the tool.
This should allow you to put your device in; lemme find some time to write you instructions to test - if so that might unblock you.
I'm not actively using it at present, and my tree is a tad old (1c262a3605f868cbe319de9eaeac32fead0323b7), but I have a Pi connected to a USB RS485 adapter talking to my 10 PRT-N (or similar) stats. Diffs:
-- a/examples/set_temperature_tp_20.py
+++ b/examples/set_temperature_tp_20.py
@@ -15,20 +15,33 @@ PORT = "102"
logging.basicConfig(level=logging.INFO)
# Create a HeatmiserUH! connection
-HeatmiserUH1 = connection.HeatmiserUH1(IP_ADDRESS, PORT)
+HeatmiserUH1 = connection.HeatmiserUH1(dev="/dev/ttyUSB0")
diff --git a/heatmiserV3/connection.py b/heatmiserV3/connection.py
index 6e281a8..70c81dc 100644
--- a/heatmiserV3/connection.py
+++ b/heatmiserV3/connection.py
@@ -13,9 +13,15 @@ class HeatmiserUH1(object):
connection, and can have multiple thermostats
"""
- def __init__(self, ipaddress, port):
+ def __init__(self, ipaddress = None, port = 0, dev = None):
self.thermostats = {}
- self._serport = serial.serial_for_url("socket://" + ipaddress + ":" + port)
+ if (dev != None) :
+ self._serport = serial.serial_for_url(
+ dev
+ )
+ elif (ipaddress != None) :
+ self._serport = serial.serial_for_url("socket://" + ipaddress + ":" + port)
+
# Ensures that the serial port has not
# been left hanging around by a previous process.
serport_response = self._serport.close()
Everything else I've tried just works if you pass in dev
when creating HeatmiserUH1
. Hope that helps.
Thanks! Was thinking along the same lines this morning!
Hi,
I'm trying to get it working with a local (rather then via remote IP socket) adapter like this one:
But it looks like its hardcoded to expect a
IP:port
socket: https://github.com/andylockran/heatmiserV3/blob/5778f5b876d60424bf7d789c3e308e32eee83c6b/heatmiserv3/connection.py#L18C9-L18C84Testing with the serial library, it seems that the underlying library (and call) has no problem with a local device, but at the moment there is no way to pass that through.
Happy to help out or test, but I don't know much about the HA side of the plugin...
Thanks