HomeyPro with KSenia Security

Hello! I recently acquired a Homey Pro not long ago. I really like it, but I’m a complete beginner in the field.

I’m wondering if anyone here has experience with the KSenia Security alarm system with Homey.
I want to transfer the status of my regular (wired) sensors (PIR door and sensors and smoke detector) to Homey. The KSenia central unit supports common POST/PUT/GET/DELETE commands.
“Unfortunately, I couldn’t find an app for it in the app store, even though KSenia is quite an innovative system, similar to Satel or Ajax.”

Has anyone managed to make them work together?

Thank you!

There is a Logic card that can use a couple of commands.

THEN card


And a AND card

Don’t know if this is useful for you.

@Mike1233 Mike, the way I read it, I think he wants to send http request towards Homey :wink:

@Tamas_Kovacs Hello, and welcome,

(Translated from posts in German)
Make a GET request with one of these URLs:

.

Since the communication probably only takes place at home, you can use the local webhooks (why use internet when you don’t need it).
Note, all is case-sensitive

  • for the Pro23
    When we have the event ‘PIR_frontdoor’, and it sends the values alarmTrue and alarmFalse, we can use the webhook like this.
    As example Homey’s IP address (make sure it has a DHCP reserved IP!) is 192.168.2.50:
    http://<homey-ip>/webhook?event=my_event&tag=my_tag can be used as:
    http://192.168.2.50/webhook?event=PIR_frontdoor&tag=alarmTrue
    http://192.168.2.50/webhook?event=PIR_frontdoor&tag=alarmFalse

  • for the Pro19 (all white balls)
    http://<homey-ip>/api/manager/logic/webhook/my_event?tag=my_tag can be used as:
    http://192.168.2.50/api/manager/logic/webhook/PIR_frontdoor?tag=alarmTrue
    http://192.168.2.50/api/manager/logic/webhook/PIR_frontdoor?tag=alarmFalse

The corresponding flow which ‘listens’ for the frontdoor PIR webhooks, should look like this:

(the yellow action cards on the left for instance can be a virtual motion sensor device, which ‘mirrors’ the frontdoor PIR state this way)

Hello!
This community is fantastic. Thanks Mike1234 and Peter!
I’m trying to understand what you wrote, as I said, I’m a beginner (very much) :slight_smile:
For now, I don’t understand how a wired sensor gets into the Homey system. I’m stuck here.
I right to add it as a virtual device? And then? How does Homey ask the device for its status (alarm/normal state)

The sensor query of the KSenia system looks something like this
address: https://192.168.1.88:8443/zones/1
reply:
“id”: “1”,
“status”: “STATUS_VALUE”,
“bypass”: “BYPASS_VALUE”
}
Status_Value: rest/alarm/mask/tamper
Bypass value: on/off

Well, I still don’t see how Homey queries the status, what triggers the query.

Thanks for your help!
Tamas

@Peter_Kawa That is why I did write that I don’t know if this is useful for him.
But if it works with Webhooks is that a good solution

Owh wait, it was not meant as “you are wrong” or anyting, Mike! Not at all!
I hoped to explain clearly I just understood the question the other way round as you did (the communication was sent from KSenia to Homey instead of from Homey to KSenia).
:hugs:

Hi!
I tried starting a KSenia output (they called scenario) as you mentioned from Homey.
This message is blocking me. However, the command works when I type it into my browser.
What can I do about this “self-signed certificate” error?


Ty!

@Peter_Kawa I know, no problem. Nothing on the hand. :+1:t3:

1 Like

Detail: for local http requests, try to use http, instead of https :wink:

Not works, just https…

Makes sense, with an alarm system :wink:

Your browser doesn’t accept the self-signed cert, I mean, it’s not Homey imho.
When you paste that https://192.168.1.88.... URL from the GET flow card in your browser, and open it, do you get an option to install the certificate, besides a rejection?

But my knowledge is little on this stuff, I found this below, which makes sense.

You must install the self-signed cert in the truststore(s) used by the browser(s). Firefox normally uses its own truststore, so install the cert in your Firefox profile, unless your instance of Firefox has been configured to use a system store. MSIE, Edge, and Chrome on Windows all use the Windows store, so install there. Safari and Chrome on MacOS or iOS use those systems’ stores, ditto. For other clients, search for other Qs or the rest of the web …
[Source]

Hi Peter!

If I try with http and not with https, this is it


https esetépen pedig ez
image
In this case I think only Homey has a problem with the certificate. Where do you think I should write about this in the forum to find a solution?

Tamás

Hi Tamas, with this:

I meant opening the URL in your browser, apart from Homey. Maybe the translations are in our way. Hope a screenshot makes it clearer;

What happens when you open that page?

Good morning!


but the command runs … my shutter goes down … :slight_smile:

“Nem biztonságos” means: Not secure… :slight_smile:

Well that’s a start! To me it looks like it should work with http?
But maybe you’re right about Homey rejecting the self-signed certificate. I’m no expert here :stuck_out_tongue:
Did you write to Homey support already?

Hello!
Thanks, but I solved it, with Homey script app. :slight_smile:

Nice! While this is a user forum with tips & tricks & solutions, please share the code :wink:

All right! But it’s not my script, a Hungarian friend helped me, but it sure works like this :slight_smile:
Thank you very much for your help too!

const url = ‘https://192.168.1.88:8443/scenarios/12/execute’;
const reqHeaders = { “Content-Type”:“text/plain” };
const httpsAgent = new https.Agent({ keepAlive: true, rejectUnauthorized: false });
const reqOptions = { method: “GET”, headers: reqHeaders, agent: httpsAgent, };
let response
try { response = await fetch(url, reqOptions); }
catch (err) { console.log(err); return false; }
if (!response.ok) throw Error(‘Invalid response’);

Tamas

2 Likes

Great, thanks for sharing m8!

The trick is here I guess

Maybe you found out alr, but nonetheless: Now you can use it in HS flowcards, and use the URL as argument. This way you can duplicate the card for use with other URLs, and only adjust the URL in the argument field at the top:

Homeyscript card in detail

I added
return response;
to the script, so the [Result] tag gets the response data

Hello!
I would like to report how I am with the KSenia and Homey alarm sensor connection at the moment…
I can query the zone input of the KSenia alarm panel with the http GET command about the current status of the alarm sensor connected to the input.
Unfortunately, due to the self-signed certificate error, I can only perform this query with HomeyScript so that the errors are discarded.
I wanted to query a total of 6 alarm sensors, in such a way that I run the scripts written to query the sensors one by one with a 2-second cycle.
I added the sensors to Homey as a Virtual switch.
The problem is that something gets stuck when I want to request more than 3 queries at the same time. This is when access to Homey is interrupted. Occasionally, all previously written scripts also disappear and in such cases the Flows cannot run either, since there is no valid script card either.
As soon as I reduce the number of concurrent queries to 3 or less, everything will be fine.
Tamas