Code Monkey home page Code Monkey logo

hspi_webhooknotifications's Introduction

WebHook Notifications for HomeSeer HS3

This is a very simple free, open-source plugin to send HTTP POST requests to a configured URL whenever a device in HS3 has its value changed or set.

This might be useful if you want to control some other system based on changes in HS3 devices.

Installation

Until this plugin is included in the HomeSeer plugin updater, you will need to install it manually. Download HSPI_WebHookNotifications.exe from the latest release and drop it into your HS3 directory (where HomeSeerAPI.dll is located). Then restart HS3.

Make sure you don't change the filename or the plugin won't work. No additional DLLs are required.

Configuration

Enable the plugin from the Plug-Ins > Manage page. Once enabled, it should warn you that no WebHook URL is configured. Click on the plugin's name to access the settings page, where you should enter the URL you want the plugin to make an HTTP POST request to whenever an HS3 device has its value set or changed.

WebHook Format

WebHook requests are HTTP POST requests with a Content-Type of application/json and a JSON-encoded request body. Every request contains an eventType property, which is a string indicating what type of event just happened. The rest of the JSON object contains different properties depending on what type of event happened. Possible events and their associated data:

  • VALUE_SET - Seemingly happens whenever a device's value is set to its current value (the value didn't change)
    • address - The string address of the device in question. If the device has a code set, then this will be the device's address with the code appended.
      • Identical to the "Address" column in HS3
    • newValue - The value this device just had set, as a string
    • oldValue - The value this device had previously, as a string (same as newValue for this event)
    • ref - The ref number of the device that got set
  • VALUE_CHANGE - Seemingly happens whenever a device's value is set to a new, different value
    • address - The string address of the device in question. If the device has a code set, then this will be the device's address with the code appended.
      • Identical to the "Address" column in HS3
    • newValue - The value this device just had set, as a string
    • oldValue - The value this device had previously, as a string
    • ref - The ref number of the device that got set
  • STRING_CHANGE - Seemingly happens whenever a device's string value is set to a new, different value
    • address - The string address of the device in question. If the device has a code set, then this will be the device's address with the code appended.
      • Identical to the "Address" column in HS3
    • newValue - The value this device just had set, as a string
    • ref - The ref number of the device that got set

Software Support

This plugin is tested and works under:

  • Windows (Windows 10 version 1803)
  • Linux (Raspbian 9 Stretch)
  • Mono version 4.6.2

hspi_webhooknotifications's People

Contributors

doctormckay avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

hspi_webhooknotifications's Issues

Persistent errors

Hello again.
After some trial and error I've decided to reinstall linux repository completely, so now I use Ubuntu 18.04.

But there are two persistent errors I get all the time, they literally fill my homeseer log.

  1. error: Unable to send WebHook http://127.0.0.1/webhook/index.php: The server returned an invalid or unrecognized response.
    It's not clear from the manual to the plugin what kind of answer it expects to get. I've tried several things, but result stays the same. From what I've got, query succeeds and values are delivered all the same, but it still bothers me a bit.

  2. error: System.NullReferenceException: Object reference not set to an instance of an object at HSPI_WebHookNotifications.HSPI.HSEvent (HomeSeerAPI.Enums+HSEvent eventType, System.Object[] parameters) [0x00172] in <50c2843d36d04fe5b8981e50b22445c9>:0
    This error usually spams several minutes after homeseer's reboot. And I can't tell anything about it aside from this quote.

Best regards,
Sergey Kazanov.

Update to new version, can't set configuration

I just updated to version 2.0.7142.3656, and when i start the plugin, i get the error about configuration. The plugin name is not a hot link, clicking on it does nothing. How do I get to the configuration page.
Capture

Can not save configuration

Log is filled with:
WebHook Notifications Debug | debug: Ignoring event VALUE_SET because no webhook endpoint is configured.
Entries...

Everytime I try to check a box or input in a url I get:
WebHook Notifications | warn: System.MissingMethodException: Method not found: System.Func`5 System.Net.Http.HttpClientHandler.get_DangerousAcceptAnyServerCertificateValidator() at HSPI_WebHookNotifications.HSPI.PostBackProc (System.String pageName, System.String data, System.String user, System.Int32 userRights) [0x000f3] in <50c2843d36d04fe5b8981e50b22445c9>

Problem defining settings for plugin

Hello.

I'm having a problem defining settings. They just revert to blanks and I'm having this error in log:
Code:
warn: System.MissingMethodException: System.Func'5System.Net.Http.HttpClientHandler.get_DangerousAcceptAnyServerCertificateValidator() at HSPI_WebHookNotifications.HSPI.PostBackProc (System.String pageName, System.String data, System.String user, System.Int32 userRights) [0x000f3] in <50c2843d36d04fe5b8981e50b22445c9>:0
I do realize, that it's probably not caused by any plugin specifics, since I use quite unortodox setup for controller (OpenSUSE on quite old hardware), but the thing is:

  1. It worked just fine before I reinstalled the system from a scratch (because hdd malfunction)
  2. All the rest including Z-Wave plugin works just fine.
  3. If I remember it right, last time I've set it up plugin was in previous version

What I noticed is that there's a new setting option concerning safe/unsafe connections and I see something similar in error message.
Do I lack some mono library with needed function?

I've also posted the same question on HS forum: https://forums.homeseer.com/forum/internet-or-network-related-plug-ins/internet-or-network-discussion/1321069-problem-defining-settings-for-webhook-notifications-plugin

Error/Exception after installation of latest plugin version

Hi, I'm having difficulty getting HomeSeer (HS3 ZEE S2 Edition 3.0.0.548) to install/enable the latest version of the HSPI_WebHookNotifications. Looking at the logfile it appears to be installing OK but then when it goes to enable the plugin I see the following exception in the HS log:

Screen Shot 2019-11-29 at 4 59 42 PM

Not sure if this is significant, but I had previous versions of the plugin installed and running but at some point I think I disabled this plugin from the Plugins > Manage page. (Can't remember exactly but I think it might have been the 1.0 version of the plugin).

Is there something I can do in HS to fix this? Let me know if more detail is needed here...

thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.