Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updateCurrentState - add URL request option #7

Closed
0ldF0x opened this issue Mar 29, 2019 · 7 comments
Closed

updateCurrentState - add URL request option #7

0ldF0x opened this issue Mar 29, 2019 · 7 comments
Labels
enhancement New feature or request

Comments

@0ldF0x
Copy link

0ldF0x commented Mar 29, 2019

Hi,
it would be great if you can expand a "updateCurrentState" method with ability to call URL on state change.
I've an alarm system, which I can trigger with URL link. What I want to do is to call "alarm on" URL when alarm is triggered and "alarm off" URL when alarm is disabled.
For URL request you could use something like:

var url = require('url');
...
    this.alarmOnUrl = url.parse(config['alarmOnUrl']);
...
 request({
           url: me.alarmOnUrl,
           method: 'GET',
       }, 
       function (error, response, body) {
       if (error) {
           // me.log('STATUS: ' + response.statusCode);
           // me.log(error.message);
           return callback(error);
       }

There should be option to define(optional) URL for every state (armed, triggered, ...).

@MiguelRipoll23 MiguelRipoll23 added the enhancement New feature or request label Mar 29, 2019
@MiguelRipoll23
Copy link
Owner

Hello!

A full URL for every state or something like this to avoid redundancy and improve clarity?

{
  'host': 'alarmsystem.local',
  'path_triggered': '__path_triggered_here__',
  'path_home': '__path_home_here__',
  'path_away': '__path_away_here__',
  ...
} 

Does your alarm system requires anything else like authentication, request headers, or parameters on the URL?

@0ldF0x
Copy link
Author

0ldF0x commented Mar 29, 2019

Hi,
actually I've found another plugin with similar functionality, check it out: https://github.com/codetwice/homebridge-http-securitysystem

I have home-made arduino alarm system which currently works only on local network and doesn't require any authentication. You trigger it with simple URL like this http://localhost/something.js/command=xxxx

@MiguelRipoll23
Copy link
Owner

Great, that's all I needed to know!

The homebridge-http-securitysystem plugin may be more suited for what you are asking but if you are missing out the feature to trigger it from a HomeKit accessory I'm okay with adding the feature and releasing the update as soon as possible this weekend 🙂

@0ldF0x
Copy link
Author

0ldF0x commented Mar 29, 2019

I want to use your plugin, so it would be great if you could add that feature! Thanks 👍

MiguelRipoll23 added a commit that referenced this issue Mar 30, 2019
@MiguelRipoll23
Copy link
Owner

I just released a new version (v1.2.0) that adds this feature 🎉

This is an example of the plugin's configuration based on the information you provided me about your web server:

{
    "accessory": "Security system",
    "name": "Security system",
    "default_mode": "home",
    "arm_seconds": 3,
    "trigger_seconds": 5,
    "host": "http://localhost",
    "path_home": "/something.js/command=home",
    "path_away": "/something.js/command=away",
    "path_night": "/something.js/command=night",
    "path_off": "/something.js/command=off",
    "path_triggered": "/something.js/command=triggered"
}

I'm glad you asked me to add this feature, sounds promising!

@0ldF0x
Copy link
Author

0ldF0x commented Mar 30, 2019

Works perfect! Thanks for the quick implementation.

@MiguelRipoll23
Copy link
Owner

You’re welcome! Feel free to follow-up this issue if there’s anything regarding this feature that could be improved or fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants