qolsysgw icon indicating copy to clipboard operation
qolsysgw copied to clipboard

Qolsys gateway not receiving sensor change states

Open amogh79 opened this issue 1 year ago • 11 comments

Hi,

My qolysys gateway is not receiving sensor change states whenever the sensor state changes and is displayed on the panel. If I reboot the panel, then on panel startup I receive all the sensor states and other panel info. I checked this using a MQTT client listening to Homeassistant MQTT broker.

Any reason why I am not receiving the sensor change states.

Help will be much updated.

Thanks

amogh79 avatar Nov 25 '23 04:11 amogh79

Would you be able to run the below snippet from your local network by adapting the Qolsys Parameters and check if you get the INFO messages when the sensor changes states ?

#!/usr/bin/python3

import json
import socket
import ssl
import sys
import time


# Qolsys Parameters
qolsysPanel     = "your_panel_ip"
qolsysPort      = yourport 
qolsysToken     = "yourtoken"
qolsysTimeout   = 20


################################################################################
# Code

statusString    = {
                    "nonce":        "test",
                    "action":       "INFO",
                    "info_type":    "SUMMARY",
                    "version":      0,
                    "source":       "C4",
                    "token":        qolsysToken,
                }

def main():
    try:
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.settimeout(qolsysTimeout)
    except socket.error:
        print('Could not create a socket')
        sys.exit()

    # Wrap SSL
    wrappedSocket = ssl.wrap_socket(sock, cert_reqs=ssl.CERT_NONE, ssl_version=ssl.PROTOCOL_TLSv1_2)

    # Connect to server
    try:
        wrappedSocket.connect((qolsysPanel, qolsysPort))
    except socket.error:
        print('Could not connect to server')
        sys.exit()
    
    # Send message and print reply
    online = True
    while online:
        wrappedSocket.send((json.dumps(statusString)).encode())
        while True:
            response = wrappedSocket.recv(4096).decode()
            if is_json(response):
                print(response)
            break  # stop receiving
        time.sleep(qolsysTimeout / 4)

def is_json(myjson):
    try:
        json_object = json.loads(myjson)
    except ValueError as e:
        return False
    return True

# Start client
main()

shivamchoudhary avatar Dec 27 '23 20:12 shivamchoudhary

I get status messages for all the sensors. When I open one of the sensor I get ZONE_EVENT stating the sensor is open. Its kinda weird that it shows the ZONE_EVENT = open then closed then again open wherein the sensor is always open and no changes are done to the sensor state. The status of all the sensors also gets updated with that particular sensor showing it open.

Do you have code snippet and the actual command to arm and disarm? I would like to try that from the code. Those actions dont work from my home assistant either.

amogh79 avatar Jan 04 '24 00:01 amogh79

I have the same issue but haven't had time to sit down and look at it.

My system also appears to send [Zone_Event = open] when the sensor is open and [Zone_Event = closed] when closed to MQTT.

kg5iru avatar Jan 04 '24 00:01 kg5iru

I also observed that after I close the sensor it still send the status in json as open. Its been 5 minutes now and it still shows it as open.

amogh79 avatar Jan 04 '24 00:01 amogh79

@kg5iru Does the sensor state change in home assistant UI for you? For me it doesn't change.

amogh79 avatar Jan 04 '24 00:01 amogh79

The only changes I get are back and forth from unavailable to closed when I'm restarting AppDaemon when I thought something was wrong with my config and started over.

kg5iru avatar Jan 04 '24 00:01 kg5iru

The only changes I get are back and forth from unavailable to closed when I'm restarting AppDaemon when I thought something was wrong with my config and started over.

I have the same issue I only get sensor states on startup and never after that.

amogh79 avatar Jan 04 '24 00:01 amogh79

That is exactly what I have going on. Homeassistant only show the initial change from unavailable to closed. Homeassistant only ever changes back to unavailable (after stopping appdaemon) after that.

MQTT Zone_Event does show the correct status of the sensors.

kg5iru avatar Jan 04 '24 01:01 kg5iru

What hardware and software versions of the qolsys panel are you using?

xaf avatar Jan 04 '24 03:01 xaf

What hardware and software versions of the qolsys panel are you using?

IQPanel4 Model: IQP4006 HW Version: Rev 1

SW Version: 4.3.0-ADCS 10.9.2 Last Software Version Upgrade: 4.3.0.20230417.rc2183_full_upgrade_generic.zip

kg5iru avatar Jan 10 '24 03:01 kg5iru

I ran into something like this. I wasn't getting state changes for sensors added since the 0.14->0.15 upgrade. Also had issues with name changes and changes in zone types not showing up. Reboots of the panel and HA did not help. I tried purging the entities and they wouldn't budge. I ended up uninstalling appdaemon and mqtt add-ons, re-pulling the qolsysgw code, and setting it all up again (took 5 minutes). No problems since.

halfordfan avatar Jul 23 '24 19:07 halfordfan