Author Topic: New Plugin: SiteSensor  (Read 6591 times)

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
New Plugin: SiteSensor
« on: August 24, 2017, 08:32:49 am »
I had need to probe a few local and remote web services from my Vera, and use the responses to trigger scenes. I got tired of pasting my code snippets around, so I wrapped them into a plugin I call SiteSensor.

SiteSensor probes a remote web site or service and can look for a matching pattern in the response, or request and parse a JSON response and put selected values through simple expressions.

It's now released in the plugin store, and documentation (with examples) is here: http://www.toggledbits.com/sitesensor/

It runs on UI7 and openLuup, and is available in the Alt App Store as well.


REVISION HISTORY
2018-07-29: Version 1.9 released. Changes handling of ArmedTripped and LastTrip to Vera semantics, which is to say, doesn't touch them anymore, and relies on Vera or openLuup to provide updates when needed.

2018-06-24: Version 1.8 released to AltAppStore and Vera Plugin Marketplace (expected availability 6/25). See changelog.

2018-02-11: Version 1.5 released. This is a maintenance release only, officially publishing a fix for a luaxp problem that caused dot-notation traversal of data to fail in some instances.

2018-02-05: Version 1.4 released. This version contains the following fixes and enhancements:
  • Provides additional scene/notification/PLEG events for the 8 user-definable expressions;
  • Adds UI on the control panel to enable and disable request logging, show the request logs, and indicate current overall status of the plugin;
  • In an effort to be recognized by more external interfaces, changes the device category and subcategory to masquerade as a door sensor (may need to revisit this particular choice);
  • Adds support for the ImperiHome ISS API, because masquerading by category (above) wasn't enough to get ImperiHome to recognize it;
  • Uses a new version luaxp to get access to more expression handling features and fixes, in particular time and date functions;
  • Supports re-evaluation of expressions between queries to remote APIs, which specifically allows current-time-based comparison expressions to operate with high resolution without spamming the remote API with requests for data;
  • Sets a default ModeSetting string in an attempt to avoid Vera's default from quietly changing armed status without explicit user direction.
« Last Edit: July 31, 2018, 09:17:17 am by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline akbooer

  • Master Member
  • *******
  • Posts: 6153
  • Karma: +275/-69
  • "Less is more"
Re: New Plugin: SiteSensor
« Reply #1 on: August 24, 2017, 09:29:02 am »
It runs on UI7 and openLuup. I'll be releasing it in the Alternate App Store shortly.

Ah, excellent. Seems like a more capable enhancement to the ping sensor.

Thanks for planning the AltAppStore distribution!  I'll try it when it's there.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: New Plugin: SiteSensor
« Reply #2 on: August 27, 2017, 01:30:04 pm »
Hi @rigpapa

Looks like a great plugin, very versatile thanks so much for sharing..

The Recipe idea is great, as that is where people will get sucked into using it, can I make a suggestion - could you maybe list just the names of the recipes you already have (there's 3 currently on your site)

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: New Plugin: SiteSensor
« Reply #3 on: August 27, 2017, 03:46:49 pm »
@parkerc -- absolutely!... but be a little more specific so I manage your expectations... where do you want me to list them?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline parkerc

  • Sr. Hero Member
  • ******
  • Posts: 2458
  • Karma: +35/-48
  • Life Moves Pretty Fast....
Re: New Plugin: SiteSensor
« Reply #4 on: August 29, 2017, 05:02:38 pm »
@parkerc ... where do you want me to list them?

What's normally best - is to just edit/update your very first post (at the top/above) as that'll be the first thing most people read when they come to check out your plugin via this forum.

Keep that first post high-level, by just appending the name and a brief explanation of the recipe- and if needed make reference (via a link) to any future/specific responses within your thread where youve perhaps gone into detail on a how to build a particular recipe etc.

Hope that helps..

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: New Plugin: SiteSensor
« Reply #5 on: August 29, 2017, 08:32:45 pm »

What's normally best [snip]

Hope that helps..

Absolutely!
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline Spanners

  • Sr. Member
  • ****
  • Posts: 258
  • Karma: +16/-5
Re: New Plugin: SiteSensor
« Reply #6 on: August 30, 2017, 08:10:41 pm »
This is a way cool plug in.

I'm currently using it to alert me when Overclockers Australia posts their weekly funny pics. :)

Looking forward to seeing if/how you implement POST queries and perhaps authentication in Lua. I'm using curl in my unifi sensor and I'd like to replace it with Lua.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1247
  • Karma: +62/-23
Re: New Plugin: SiteSensor
« Reply #7 on: November 25, 2017, 06:56:15 am »
Works great on the vera but somehow on openluup, I am not able to get to the settings page. The control panel on openluup stays empty. The AltUI on the vera works...
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Offline akbooer

  • Master Member
  • *******
  • Posts: 6153
  • Karma: +275/-69
  • "Less is more"
Re: New Plugin: SiteSensor
« Reply #8 on: November 25, 2017, 10:12:12 am »
Perhaps there is useful diagnostic information in the logs ...?
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: New Plugin: SiteSensor
« Reply #9 on: November 25, 2017, 10:45:36 am »
Works great on the vera but somehow on openluup, I am not able to get to the settings page. The control panel on openluup stays empty. The AltUI on the vera works...

Did you install from the Vera store or the Alternate App Store?
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1247
  • Karma: +62/-23
Re: New Plugin: SiteSensor
« Reply #10 on: November 25, 2017, 12:21:13 pm »
I tried both, and got the same result. Also tried to update the plugin after installing it, which made me end up with the GitHub version. The Alt Store says it is version 1.2.
The vera has version 1.3.
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!

Offline akbooer

  • Master Member
  • *******
  • Posts: 6153
  • Karma: +275/-69
  • "Less is more"
Re: New Plugin: SiteSensor
« Reply #11 on: November 25, 2017, 12:57:37 pm »
I loaded from AltAppStore and got v1.3, as expected.  The GitHub version, unspecified from the openLuup plugins page, should be the same. 

I get both Control and Settings tab on the device page, but I don't know what to do next...!

What openLuup and AltUI versions are you running?
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline akbooer

  • Master Member
  • *******
  • Posts: 6153
  • Karma: +275/-69
  • "Less is more"
Re: New Plugin: SiteSensor
« Reply #12 on: November 25, 2017, 01:08:58 pm »
but I don't know what to do next...

...so I followed the first example in the docs, and now I know my external IP!

All working just fine.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 672
  • Karma: +101/-1
Re: New Plugin: SiteSensor
« Reply #13 on: November 25, 2017, 01:18:18 pm »
There was a bug in the AltAppStore configuration for the plugin... my match pattern for GitHub was PHP-ish, not Lua-ish (%w in PHP != %w in Lua), so it was excluding the two JavaScript files that drive the UI. I didn't see it in testing because I had previously manually uploaded those files to my openLuup tree during development, so they were already there. Your experience, obviously, was going to very different, so apologies for not catching that earlier!

That was only in the 1.2 version configuration in the AltAppStore. It is fixed in the 1.3 version of the plugin in the AltAppStore.

Edit/postscript: I could not get the AltAppStore to update to v1.3 using the AltUI "Update" button to save my life. But, going back to the store, finding the plugin, and hitting the "AltUI" install button did the trick. Paging @amg0!
« Last Edit: November 25, 2017, 01:20:32 pm by rigpapa »
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline rafale77

  • Hero Member
  • *****
  • Posts: 1247
  • Karma: +62/-23
Re: New Plugin: SiteSensor
« Reply #14 on: November 26, 2017, 06:29:12 am »
Yup,
It is working now. Thank you!
openLuup (97 devices, 134 scenes, 20 apps) controlling HomeAss + VeraPlus (138 zwave nodes, 8 Zigbee nodes, 205 devices, 20 scenes , 2 app) Bridged to Homekit and Alexa. VeraPlus ExtRooted!