vanackej / risco-mqtt-local

Provide Risco alarm system integration to Home assistant using local TCP communication (no cloud required) and MQTT
MIT License
24 stars 11 forks source link

Connection reset RW432MP panel #61

Open maartenweyns opened 6 months ago

maartenweyns commented 6 months ago

Describe the bug The HomeAssistant addon is unable to connect to my RW432MP panel (connection is being reset)

Configuration

Logs

Debug logs:

Loading config from: /config/risco-mqtt.json
1/25/2024, 12:42:17 PM [debug] User config:
{
  "log": "debug",
  "panel": {
    "panelIp": “RISCO_IP”,
    "panelPort": 1000,
    "panelPassword": “RISCO_PIN,
    "watchDogInterval": 10000,
    "commandsLog": true
  },
  "panel_name": "alarm",
  "mqtt": {
    "url": "mqtt://HA_IP:1883",
    "username": "MQTT_USER",
    "password": "MQTT_PASS"
  },
  "zones": {}
}
1/25/2024, 12:42:18 PM [debug] Merged config:
{
  "log": "debug",
  "logColorize": false,
  "ha_discovery_prefix_topic": "homeassistant",
  "panel_name": "alarm",
  "panel_node_id": "alarm",
  "panel": {
    "panelIp": "RISCO_IP",
    "panelPort": 1000,
    "panelPassword": "RISCO_PW",
    "watchDogInterval": 10000,
    "commandsLog": true
  },
  "zones": {
    "default": {
      "off_delay": 0,
      "device_class": "motion",
      "name_prefix": ""
    }
  },
  "mqtt": {
    "url": "mqtt://HA_IP:1883",
    "username": "MQTT_USER",
    "password": "MQTT_PASS",
    "reconnectPeriod": 5000,
    "clientId": null,
    "will": {
      "topic": null,
      "payload": "offline",
      "qos": 1,
      "retain": true,
      "properties": {
        "willDelayInterval": 30
      }
    }
  }
}
1/25/2024, 12:42:18 PM [info] Logging commands to risco-commands-2024-01-25T11:42:18.033Z.csv
1/25/2024, 12:42:18 PM [debug] Local GMT Timezone is : +01:00
1/25/2024, 12:42:18 PM [info] autoConnect enabled, starting communication
1/25/2024, 12:42:18 PM [verbose] Start Connection to Panel
1/25/2024, 12:42:18 PM [debug] Pseudo Buffer Created for Panel Id(1)
1/25/2024, 12:42:18 PM [debug] TCP Socket created
1/25/2024, 12:42:18 PM [info] Connecting to mqtt server: mqtt://HA_IP:1883
1/25/2024, 12:42:18 PM [error] Socket Error : Error: connect ECONNRESET RISCO_IP:1000
1/25/2024, 12:42:18 PM [info] TCP Socket Disconnected
1/25/2024, 12:42:18 PM [info] Automatic reconnection will be attempted in 10000 ms
1/25/2024, 12:42:18 PM [debug] Socket Disconnected.
1/25/2024, 12:42:18 PM [error] Socket Closed.
1/25/2024, 12:42:18 PM [info] Connected on mqtt server: mqtt://HA_IP:1883
1/25/2024, 12:42:18 PM [info] Panel is not connected, waiting
1/25/2024, 12:42:28 PM [verbose] Start Connection to Panel
1/25/2024, 12:42:28 PM [debug] A TCP Socket already exists, clearing its listeners before creating a new one
1/25/2024, 12:42:28 PM [debug] Pseudo Buffer Created for Panel Id(1)
1/25/2024, 12:42:28 PM [debug] TCP Socket created
1/25/2024, 12:42:28 PM [verbose] Socket Connected, log in to panel
1/25/2024, 12:42:28 PM [verbose] Authenticating to the panel
1/25/2024, 12:42:28 PM [verbose] Command[1] Sending Command: RMT=RISCO_PW
1/25/2024, 12:42:28 PM [debug] Command[1] Writing command buffer to socket: [INT_ARRAY]
1/25/2024, 12:42:28 PM [debug] Command[1] Data Sent : RMT=RISCO_PW
1/25/2024, 12:42:28 PM [error] Socket Error : Error: write ECONNRESET
1/25/2024, 12:42:28 PM [info] TCP Socket Disconnected
1/25/2024, 12:42:28 PM [info] Automatic reconnection will be attempted in 10000 ms
1/25/2024, 12:42:28 PM [debug] Socket Disconnected.
1/25/2024, 12:42:28 PM [error] Command[1] error: Error: write ECONNRESET
1/25/2024, 12:42:28 PM [error] Socket Closed.
1/25/2024, 12:42:28 PM [debug] Command[1] command response : undefined
1/25/2024, 12:42:28 PM [error] Risco command error: TIMEOUT. Command: {"panelId":1,"commandId":1,"attempts":1,"crcOk":false,"commandStr":"RMT=RISCO_PW","sentBuffer":{"type":"Buffer","data":[INT_ARRAY]}}

where INT_ARRAY is an arbitrary-looking array of integers (removed because unsure if it's sensitive data).

Command log:

Unable to find the command log file.

Additional context No additional context

markxroberts commented 6 months ago

This version of the library doesn’t support Lightsys+. Try @markxroberts library (sorry - self promotion).

vanackej commented 6 months ago

And maybe, if you are not using the proxy mode, consider using the official home assistant integration with local mode : https://www.home-assistant.io/integrations/risco/ Johann

Le jeu. 25 janv. 2024 à 14:09, Mark Roberts @.***> a écrit :

This version of the library doesn’t support Lightsys+. Try @markxroberts https://github.com/markxroberts library (sorry - self promotion).

— Reply to this email directly, view it on GitHub https://github.com/vanackej/risco-mqtt-local/issues/61#issuecomment-1910190839, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECPHMG2ZAWJCDB7EYJM33YQJKPFAVCNFSM6AAAAABCKMG6IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJQGE4TAOBTHE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

maartenweyns commented 6 months ago

This version of the library doesn’t support Lightsys+. Try @markxroberts library (sorry - self promotion).

I am getting the same error in your risco-mqtt-local fork. Should I be changing my configuration?

consider using the official home assistant integration with local mode

I have been using that recently but it stopped working and has been quite flaky for me. Wanted to try something different :)

vanackej commented 6 months ago

In fact the library should support for RW432 Panel (I don't know if the "MP" suffix is relevant)

Check the code here : https://github.com/vanackej/risco-lan-bridge/blob/6a36e1430ba98e95ad44896e3ef27f4934f65e11/src/RiscoComm.ts#L251

Your logs stop even before the panel model detection. So I think your issue is not related to the panel model.

If your panel is not supported, you should have an exception with the panel model as reported by the panel it-self after connection : https://github.com/vanackej/risco-lan-bridge/blob/6a36e1430ba98e95ad44896e3ef27f4934f65e11/src/RiscoComm.ts#L343

Le jeu. 25 janv. 2024 à 14:57, Maarten Weyns @.***> a écrit :

This version of the library doesn’t support Lightsys+. Try @markxroberts https://github.com/markxroberts library (sorry - self promotion).

I am getting the same error in your risco-mqtt-local fork. Should I be changing my configuration?

consider using the official home assistant integration with local mode

I have been using that recently but it stopped working and has been quite flaky for me. Wanted to try something different :)

— Reply to this email directly, view it on GitHub https://github.com/vanackej/risco-mqtt-local/issues/61#issuecomment-1910270680, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECPHMPSS4ZR5DN53YBZJ3YQJQFPAVCNFSM6AAAAABCKMG6IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJQGI3TANRYGA . You are receiving this because you commented.Message ID: @.***>

maartenweyns commented 6 months ago

In that case I am unsure what is causing the error. Have you ever seen this before? Is it possible the pin changed out of itself? 🤷🏼‍♂️

vanackej commented 6 months ago

Really no idea, sorry. The best would be to checkout and run the library locally with a debugger attached, set breakpoints and see what happens, but it requires advanced developer skills (I don't know if you are a developer or not...).

Le jeu. 25 janv. 2024 à 15:47, Maarten Weyns @.***> a écrit :

In that case I am unsure what is causing the error. Have you ever seen this before? Is it possible the pin changed out of itself? 🤷🏼‍♂️

— Reply to this email directly, view it on GitHub https://github.com/vanackej/risco-mqtt-local/issues/61#issuecomment-1910358651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAECPHMDMJ4C4GDUOYKDE6TYQJWBJAVCNFSM6AAAAABCKMG6IKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMJQGM2TQNRVGE . You are receiving this because you commented.Message ID: @.***>

needles77 commented 1 month ago

Hello @vanackej , @maartenweyns :

For the 432mp lightsys+ , I add some code on the risco-lan-bridge :

https://github.com/needles77/risco-lan-bridge .

I will continue to work on it next week.

Bye

markxroberts commented 1 month ago

If you have working code to fix this issue I’m happy to try to include in my fork of the library if you open a pull request.

needles77 commented 1 month ago

sorry @markxroberts I hadn't read your comment. I just tried your risco-mqtt-local fork with my lightsys+ (WIFI), and it works well (thank you for this). I have the same error as @maartenweyns on first login, but works the second time.

When I worked and try to debug de risco-lan-bridge last years with home bridge, I had some error with CRC and the delay of reconnection. I fixed this with :

Now, I will try your fork for the next days, and I'll keep you informed. I used the native risco integration in HA, it work but sometimes (1 time for 24/48h) the connection crashes and I need to restart integration.

Bye

markxroberts commented 1 month ago

I've published a new version with both of these configurable.

maartenweyns commented 2 weeks ago

Good to see some developments in this issue! I have tried the new version @markxroberts released, with the adapted configuration from @needles77. It however did not resolve the issue I am having. I took a gander at the traffic between my host and the alarm panel in Wireshark and I do indeed see that the alarm panel replies with the reset bit set after the RMT command. No idea why that is happening

I attached the new logs below (they look slightly different this time):

11:40:21 AM [debug] Local GMT Timezone is : +00:00
11:40:21 AM [info] autoConnect enabled, starting communication
11:40:21 AM [verbose] Start Connection to Panel
11:40:21 AM [debug] Pseudo Buffer Created for Panel Id(1)
11:40:21 AM [debug] TCP Socket created
11:40:21 AM [info] [RML] Connecting to mqtt server: mqtt://10.0.1.10:1883
11:40:21 AM [verbose] Socket Connected, log in to panel
11:40:21 AM [verbose] Authenticating to the panel
11:40:21 AM [verbose] Command[1] Sending Command: RMT=xxxx
11:40:21 AM [debug] Command[1] Writing command buffer to socket: [xxxx]
11:40:21 AM [debug] Command[1] Data Sent : RMT=xxxx
11:40:21 AM [error] Socket Closed.
11:40:21 AM [info] TCP Socket Disconnected
11:40:21 AM [info] Automatic reconnection will be attempted in 30000 ms
11:40:21 AM [debug] Socket Disconnected.
11:40:21 AM [info] [RML] Connected on mqtt server: mqtt://10.0.1.10:1883
11:40:21 AM [info] [RML] Panel is not connected, waiting
11:40:26 AM [warn] Command[1] 'RMT=xxxx' Timeout
11:40:26 AM [debug] Command[1] command response : undefined
11:40:26 AM [error] Risco command error: TIMEOUT. Command: {"panelId":1,"commandId":1,"attempts":1,"crcOk":false,"commandStr":"RMT=xxxx","sentBuffer":{"type":"Buffer","data":[xxxx]}}
markxroberts commented 2 weeks ago

What happens if you set "autoDiscover": true and don't set panelPassword?

maartenweyns commented 2 weeks ago

I am seeing the same behavior with that configuration