fdegier / homebridge-jablotron-alarm

Homebridge plugin for connecting Jablotron JA-100 alarm systems to Homekit.
The Unlicense
26 stars 5 forks source link

Displaying section status #91

Open remowashere opened 1 year ago

remowashere commented 1 year ago

First off; my compliments for the HB plugin, works absolutely awesome. I was about to switch security systems until I found out about HB (even while I was using HASS for years) and especially your plugin!

But a quick question; on most keypads I have a couple of extra segments just to show PG outputs which indicate the status of widows and doors. If any window is open, the segment turns red, if all windows or doors are closed, they turn green. If I add those sections to the 'switch' config, they show up as switches and obviously, they are not. Is there any way to link them to a Homekit 'contact sensor' so they show up as opened or closed?

Scherm­afbeelding 2023-03-28 om 09 12 49
remowashere commented 1 year ago
Scherm­afbeelding 2023-03-28 om 09 15 33

Example how it looks in my case

misncz commented 1 year ago

Can you send me output of config-helper.js tool so that I can see what it looks like? I think it's possible to implement what you are asking for but would need some changes to the plugin

remowashere commented 1 year ago
{
  "status": "OK",
  "configs": [
    {
      "id": 0000000,
      "name": "Thuis",
      "username": "",
      "password": "",
      "service_type": "JA100",
      "autoRefresh": "True",
      "poolInterval": 60,
      "refreshOnStateChange": true,
      "debug": false,
      "sections": [
        {
          "name": "Woning",
          "segment_id": "STATE_1",
          "segment_key": "section_1",
          "armedMode": "Away"
        },
        {
          "name": "Garage",
          "segment_id": "STATE_2",
          "segment_key": "section_2",
          "armedMode": "Away"
        }
      ],
      "switches": [
        {
          "name": "Status deuren woning",
          "segment_id": "PGM_1",
          "segment_key": "pgm_1"
        },
        {
          "name": "Status ramen woning",
          "segment_id": "PGM_2",
          "segment_key": "pgm_2"
        },
        {
          "name": "Status deuren garage",
          "segment_id": "PGM_3",
          "segment_key": "pgm_3"
        },
        {
          "name": "Status deuren en ramen",
          "segment_id": "PGM_4",
          "segment_key": "pgm_4"
        },
        {
          "name": "Garage kanteldeur",
          "segment_id": "PGM_5",
          "segment_key": "pgm_5"
        },
        {
          "name": "Garage tuindeur",
          "segment_id": "PGM_6",
          "segment_key": "pgm_6"
        },
        {
          "name": "PG output 7",
          "segment_id": "PGM_7",
          "segment_key": "pgm_7"
        },
        {
          "name": "PG output 8",
          "segment_id": "PGM_8",
          "segment_key": "pgm_8"
        },
        {
          "name": "PG output 9",
          "segment_id": "PGM_9",
          "segment_key": "pgm_9"
        },
        {
          "name": "PG output 10",
          "segment_id": "PGM_10",
          "segment_key": "pgm_10"
        }
      ],
      "outlets": []
    }
  ]
}

They just show as PG outputs from the config helper, maybe it's just a simple tweak in the Homekit identification, but I couldn't find any 'contact sensor' entries in the source

misncz commented 1 year ago

It's because config-helper.js automatically adds them under switches (it doesn't know what type it should be - that's on you in the end). I'll add contact_sensors as addition to switches and outlets and modify the plugin to show them as contact sensor in Homekit

remowashere commented 1 year ago

That is awesome, thank you Michal! Last question; the readme.md states 'alternatively it is possible to make the Jablotron alarm appear as a switch and then the automation will work without confirmation'.

In my situation; I have a separate garage which always arms 'away'. Our home can only arm 'home' as we have pets who might trigger the PIR in the livingroom. I've added a couple of switches to control these sections;

"switches": [ { "name": "HOUSE PARTIAL ARM", "segment_id": "STATE_1", "segment_key": "section_1", "keyboard_key": "keyboard_2_3", "armedMode": "Home" }, { "name": "GARAGE FULL ARM", "segment_id": "STATE_2", "segment_key": "section_2", "armedMode": "Away" } ],

For 'Garage' it works perfectly fine, but activating this switch for 'House', it also arms in the 'away' state, is there any way to trigger it to 'Home' arming?

misncz commented 1 year ago
{
  "status": "OK",
  "configs": [
    {
      "id": 0000000,
      "name": "Thuis",
      "username": "",
      "password": "",
      "service_type": "JA100",
      "autoRefresh": "True",
      "poolInterval": 60,
      "refreshOnStateChange": true,
      "debug": false,
      "sections": [
        {
          "name": "Woning",
          "segment_id": "STATE_1",
          "segment_key": "section_1",
          "armedMode": "Away"
        },
        {
          "name": "Garage",
          "segment_id": "STATE_2",
          "segment_key": "section_2",
          "armedMode": "Away"
        }
      ],
      "switches": [
        {
          "name": "Status deuren woning",
          "segment_id": "PGM_1",
          "segment_key": "pgm_1"
        },
        {
          "name": "Status ramen woning",
          "segment_id": "PGM_2",
          "segment_key": "pgm_2"
        },
        {
          "name": "Status deuren garage",
          "segment_id": "PGM_3",
          "segment_key": "pgm_3"
        },
        {
          "name": "Status deuren en ramen",
          "segment_id": "PGM_4",
          "segment_key": "pgm_4"
        },
        {
          "name": "Garage kanteldeur",
          "segment_id": "PGM_5",
          "segment_key": "pgm_5"
        },
        {
          "name": "Garage tuindeur",
          "segment_id": "PGM_6",
          "segment_key": "pgm_6"
        },
        {
          "name": "PG output 7",
          "segment_id": "PGM_7",
          "segment_key": "pgm_7"
        },
        {
          "name": "PG output 8",
          "segment_id": "PGM_8",
          "segment_key": "pgm_8"
        },
        {
          "name": "PG output 9",
          "segment_id": "PGM_9",
          "segment_key": "pgm_9"
        },
        {
          "name": "PG output 10",
          "segment_id": "PGM_10",
          "segment_key": "pgm_10"
        }
      ],
      "outlets": []
    }
  ]
}

They just show as PG outputs from the config helper, maybe it's just a simple tweak in the Homekit identification, but I couldn't find any 'contact sensor' entries in the source

Is this output of config-helper.js really? It doesn't look like it is

remowashere commented 1 year ago

Yes sir, the full output that's generated with https://github.com/fdegier/Homebridge-Jablotron-Congig-helper

remowashere commented 1 year ago

I've also tried using the node script (directly on Homebridge), but that always fails (username/password are 100% correct, same as I'm using in the HB config)

Scherm­afbeelding 2023-03-28 om 16 34 27
misncz commented 1 year ago

@remowashere I'm done with the changes and will try to test them somehow. In case I'd struggle with it would you mind testing it with your homebridge installation if I provided changed plugin files?

remowashere commented 1 year ago

@misncz No problem at all

misncz commented 1 year ago

@remowashere so I tested it with one of PGMs I have and it's working fine - basically contact sensor is opened when PG is set and closed when PG is unset. Modified files attached - create a backup of everything in /var/lib/homebridge/node_modules/homegridge-jablotron and then update files using files in attached ZIP. homebridge-jablotron.zip

Update your homebridge config for Jablotron - move those 3 switches under new contact_sensors section:

    "sections": [
        {
            "name": "Woning",
            "segment_id": "STATE_1",
            "segment_key": "section_1",
            "armedMode": "Away"
        },
        {
            "name": "Garage",
            "segment_id": "STATE_2",
            "segment_key": "section_2",
            "armedMode": "Away"
        }
    ],
    "contact_sensors": [
        {
            "name": "Status deuren woning",
            "segment_id": "PGM_1",
            "segment_key": "pgm_1"
        },
        {
            "name": "Status ramen woning",
            "segment_id": "PGM_2",
            "segment_key": "pgm_2"
        },
        {
            "name": "Status deuren garage",
            "segment_id": "PGM_3",
            "segment_key": "pgm_3"
        }
    ]
remowashere commented 1 year ago

@misncz That works absolutely great 👍 I do see that PG output changes (triggered by opening a door or window) are not 'pushed' to Jablonet, thus also not visible in Homebridge, but I'm checking in my setup if I can change that somehow. But manually triggered PG outputs are shown beautifully in Homekit as contact sensors now. Thanks you very much!

misncz commented 1 year ago

@remowashere great. Thanks for your help. Changes are on their way to official new plugin release now

remowashere commented 1 year ago

For anyone experiencing issues with the (not changing) status of PG outputs

In F-Link check the PG outputs and make sure 'Save PG event to memory' is enabled/checked. Without enabling this, the changes will not be pushed to Jablotron and thus not visible in Homebridge.

MartinKristof commented 2 months ago

Hi, after migration to 3.0.0 my array "contact_sensors" no longer works. Even if I added them as switchers, it did not help. After adding switcher it defined "segment_id" instead of "cloud-component-id" to config. I had changed it manually but did not work.

Example (contact_sensors are from previous version's config of your plugin):

"switches": [
                {
                    "name": "PIR garáž 2",
                    "cloud-component-id": "PG-523646219"
                },
                {
                    "name": "PIR zádveří 2",
                    "cloud-component-id": "PG-523646224"
                },
                {
                    "name": "Magnet garáž 2",
                    "cloud-component-id": "PG-523646279"
                },
                {
                    "name": "Magnet zádveří 2",
                    "cloud-component-id": "PG-523646344"
                },
                {
                    "name": "PIR pokoj Meli",
                    "cloud-component-id": "PG-523646404"
                }
            ],
            "contact_sensors": [
                {
                    "name": "PIR garáž"
                },
                {
                    "name": "PIR zádveří"
                },
                {
                    "name": "Magnet garáž"
                },
                {
                    "name": "Magnet zádveří"
                },
                {
                    "name": "PIR pokoj Samík"
                }
            ]
misncz commented 1 month ago

@MartinKristof "cloud-component-id" is not valid config attribute. Replace it with "segment_id" and it starts working for you