Closed rocket4321 closed 3 years ago
yes I would be interested, previous to using home assistant, I was using nxgipd https://github.com/tjko/nxgipd and mqtt messages for alarm events, but when moving to home assistant several years ago, I began using pynx584. I also found mqtt give faster, almost instantaneous updates of alarm sensors. On Friday, February 26, 2021, 02:11:53 PM EST, rocket4321 notifications@github.com wrote:
First, as a long-time user of this package, thanks to all the previous developers !!!
While trying to examine if I have a faulty NX-8E, I ended up adding a MQTT client to the pyn584 package which connects to a MQTT server and updates zone and partition status info.
I found that the MQTT connection was remarkable faster (sometimes several seconds). I currently only use the data for zone status, but could easily incorporate partition alarm arm/disarm actions.
If this would be of interest to the code owner, I could flush out more user parameters and security features of MQTT client connections for user defined inputs. I have it working for my purposes, and the alarm hardware is so old, there are fewer users each day. I just wanted to test the waters before going thru the effort to submit a PR.
Thoughts?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Yes, very interested to see how this works. Timeliness of sensor triggers (or lack thereof) is something I have learned to live with, but there are a few scenarios in my automations where instantaneous recognition of sensors would be much nicer! Automatic lights on motion for one example....currently this can take up to 4 or 5 sec.
There's a plugin interface in nx584 that I use to interface to my own custom MQTT-based eventhandler. If you want to write something, it should use that. If it's suitable, then it can go into the tree, but it would also be easy to just keep that separate and let people install that entry point if they want it.
https://github.com/kk7ds/pynx584/blob/master/nx584/controller.py#L170
You can see it loads the entrypoint there, expecting a subclass of model.NX584Extension, which will get called with anything synchronously while processing it. Because it's an entrypoint it can be maintained and installed from a separate tree very easily.
You can install the entrypoint with something like this in setup.py:
setup(...
entry_points={
'pynx584': ['nxevents=my_nx584:MyNXEvents'],
},
);
@kk7ds I'm confused (as I often feel these days, but that's just my burden)... If there's already a plugin for an MQTT connection, is it posted? Are there any other pynx584 plugins as templates for review?
I built the plugin interface in nx584 for exactly this sort of thing, and I have local plugin I use for my own MQTT injection (but it's not really suitable for posting publicly). And no, I've not posted any such extensions publicly.
I'm saying you should use that extension point (as linked above) to hook in your MQTT publisher to the rest of the code, as could someone else that wanted any other sort of direct integration with something (IFTTT, webhooks, etc). The link above points you to where we load any named extensions, and you can follow from there to see when and how we dispatch them. You subclass this:
https://github.com/kk7ds/pynx584/blob/master/nx584/model.py#L300
And the member methods will be called when events happen. So, if you want to send MQTT events when zones are tripped, do that from zone_status(), and if you want to catch arm/disarm events, get those from partition_status().
Because this is loaded as an entry point, someone who wants this can simply install the entrypoint on their system and it will be loaded by nx584_server at startup time and used.
So, just to confirm:
So, just to confirm:
* You wish to have users who desire this functionality to install and manage a software product that is maintained outside of this package.
No, entrypoints can be delivered in the same package. I said above that if it's appropriately done, we can include it here. I'm just saying that it should be implemented according to the extension interface that I have already defined. 13 days ago I said:
If it's suitable, then it can go into the tree
And that's what I meant.
* You have developed what I and others have requested, but prefer not to share.
My module is highly tailored to my own situation, and uses another module that I have which is effectively a "library for my house" which abstracts away a lot of stuff like connecting to my bus, authentication, certain static details about my house, and a standard message format that everything on my MQTT bus uses for consistency. As such, my nx584 plugin mostly just translates the nx584 message into the format I want to see on my bus. I used to use a different messaging technology before MQTT, and my "house library" abstracts all of that away for me. I can't share the house module because it has sensitive details about my setup in it. But, since I don't want to be accused of not sharing, here is the sanitized nx584 plugin, plus a snippet of the setup.py for the module that actually installs it:
https://gist.github.com/kk7ds/65e0c6db43c0092ce0e0a20eb47cd398
Hopefully you see that it doesn't help directly, because there's no MQTT specifics in there, and that's why I didn't offer it up before. You can write a module that behaves this way but that connects to a configurable MQTT system and formats the messages in some generic way. You can do that here in this tree/project - again, entrypoints do not need to be external.
I'm pretty offended by your accusation. I share almost everything I write (including this project here). I work professionally on opensource, having shared almost every line of my work product for the last 20 years, in addition to all of my own personal projects. I haven't shared the internal security-sensitive details of my own home automation setup for obvious reasons, but I split out the generic things like this nx584 library so that other people can benefit from the work I've done.
Please don't accuse me of not sharing.
I didn't intend to offend, and I actually don't feel I accused you of anything. I asked for confirmation of how I interpreted your statements.
Not everyone here has all over your glorious 20 years experience, and perhaps are trying to learn. Perhaps they need to ask copious questions, need examples and snippets of software to study, and require more clarity to understand. Clearly, this is not that environment today.
I hope what you have provided allows someone to give value to the community.
First, as a long-time user of this package, thanks to all the previous developers !!!
While trying to examine if I have a faulty NX-8E, I ended up adding a MQTT client to the pyn584 package which connects to a MQTT server and updates zone and partition status info.
I found that the MQTT connection was remarkable faster (sometimes several seconds). I currently only use the data for zone status, but could easily incorporate partition alarm arm/disarm actions.
If this would be of interest to the code owner, I could flush out more user parameters and security features of MQTT client connections for user defined inputs. I have it working for my purposes, and the alarm hardware is so old, there are fewer users each day. I just wanted to test the waters before going thru the effort to submit a PR.
Thoughts?