Skip to content

Commit

Permalink
Minor changes to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
davesmeghead committed Jul 27, 2024
1 parent 25c2456 commit 92c763a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions custom_components/visonic/examples/complete_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def onNewSensor(self, sensor: AlSensorDevice):
self.process_sensor(sensor)
sensor.onChange(self.onSensorChange)

def onPanelChangeHandler(self, e):
def onPanelChangeHandler(self, e: AlCondition, data : dict):
""" This is a callback function, called from the visonic library. """
if type(e) == AlIntEnum:
if self.process_event is not None:
Expand Down Expand Up @@ -338,7 +338,6 @@ async def async_create_tcp_visonic_connection(self, address, port, panelConfig :
sock.settimeout(1.0) # set timeout to 1 second to flush the receive buffer
sock.connect((address, port))

pl_sock = None
# Flush the buffer, receive any data and dump it
try:
dummy = sock.recv(10000) # try to receive 100 bytes
Expand All @@ -350,7 +349,7 @@ async def async_create_tcp_visonic_connection(self, address, port, panelConfig :
# set the timeout to infinite
sock.settimeout(None)

vp = ClientVisonicProtocol(serial_connection = False, panelConfig=panelConfig, pl_sock = pl_sock, loop=loop)
vp = ClientVisonicProtocol(serial_connection = False, panelConfig=panelConfig, loop=loop)

#print("The vp " + str(type(vp)) + " with value " + str(vp))
# create the connection to the panel as an asyncio protocol handler and then set it up in a task
Expand Down
2 changes: 1 addition & 1 deletion custom_components/visonic/examples/simple_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def onNewSensor(sensor: AlSensorDevice):
else:
print("Sensor ", str(sensor))

def onPanelChangeHandler(e):
def onPanelChangeHandler(self, e: AlCondition, data : dict):
""" This is a callback function, called from the visonic library. """
print(f"onPanelChangeHandler {type(e)} value {e}")

Expand Down

0 comments on commit 92c763a

Please sign in to comment.