Online Sensor plugin

ckeyes888
Posts: 2438
Joined: Thu Nov 26, 2009 2:41 pm
Location: Kalispell, MT

Re: Online Sensor plugin

Post by ckeyes888 »

Not so much Indigo 7 as much as going to 10.7. Seems I'll lose my caller ID, modem won't work under 10.7.
Not so sure my Applescripts will work anymore, unfortunately I use a ton of them. My Gnuplot Python stuff
will likely have to be redone etc.
If I had a clue how to fix things like that myself I'd likely do it but I don't and am not looking forward to the down time and many hours it will take muddling thru it all.
Just wish there was something new and cool I could do when I got it all back together but I'm not seeing anything
like that.

Thanks,

Carl
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

New version released. Improvements include:

• fix Indigo server API version
• refactor for efficiency
• update to latest speedtest.py
• reduce redundant/unnecessary communication with Indigo server
• allow shorter update interval for ping devices
• GitHubPluginUpdater
• new LAN Ping device type (if fingscan is overkill for your needs)
• each device is now fully threaded (makes the plugin MUCH more responsive)
• fix ipAddressUi issues
• tweaks and bug fixes

Links from the first post are still good.
User avatar
aldera
Posts: 229
Joined: Tue Aug 30, 2016 11:30 am
Location: Michigan, USA

Re: Online Sensor plugin

Post by aldera »

Hi,

I'm running your latest v0.0.9 and starting around 12:30 this morning I started getting an error. It's updating a variable I created called "myIP" to the IP address "1.0 302" when the actual address is "xx.129.240.165". I put "xx" in place of the actual octet to hide my real address. Every 5 minutes I check the IP address and Internet status. After it updates the myIP variable to 1.0 302, it then correctly shows my real IP address of xx.129.240.165 in the log but it never updates the variable to it. If I manually change the myIP variable to xx.129.240.165, the next time your device does its check, it updates the variable back to 1.0 302 and the cycle starts again. I rebooted my Mac server. I'm running Indigo v7.0.3. Below is a sample of what is showing in the logs. I enabled debugging on your plugin. Any ideas? Thanks.

Code: Select all

Aug 9, 2017, 12:30:00 AM
   Schedule                        sGetIPAddressAndInternetStatus - This is a schedule that runs every five minutes to get current IP address and status
   Schedule                        sGetTrigger Status
   Online Sensor Error             not well-formed (invalid token): line 8, column 4

Aug 9, 2017, 12:32:45 AM
   Online Sensor                   "IPAddressSensor" new IP Address: 1.0 302
   Online Sensor Error             "IPAddressSensor" thread error:
   Online Sensor Error             argument must be 9-item sequence, not float
   Online Sensor Error             "InternetSensor" thread error:
   Online Sensor Error             argument must be 9-item sequence, not float

Aug 9, 2017, 11:26:59 AM - this is after the reboot of my server and Indigo startup
Started plugin "Online Sensor 0.0.9"
   Online Sensor Debug             startup
   Online Sensor Debug             Debug logging enabled
   Online Sensor Debug             1502293632.0
   Online Sensor Debug             deviceStartComm: InternetSensor
   Online Sensor Debug             Thread started: InternetSensor
   Online Sensor Debug             deviceStartComm: IPAddressSensor
   Online Sensor Debug             Thread started: IPAddressSensor
   Online Sensor Debug             deviceStartComm: SpeedTest Monitor
   Online Sensor Debug             Thread started: SpeedTest Monitor
   Started plugin "EPS - Device Extensions 1.53"
   Online Sensor                   "IPAddressSensor" new IP Address: xx.129.240.165
   Online Sensor Error             "IPAddressSensor" thread error:
   Online Sensor Error             argument must be 9-item sequence, not float

Aug 9, 2017, 11:37:49 AM
   Online Sensor                   "IPAddressSensor" new IP Address: xx.129.240.165 - I substituted "xx" to hide actual address
   Online Sensor Error             "IPAddressSensor" thread error:
   Online Sensor Error             argument must be 9-item sequence, not float
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

Hmm. This has something to do with converting datetime values. I won't be able to look into it until this evening, but in the meantime it would be helpful if you posted the configuration for the device and also maybe your date and time localization settings (i.e. how are dates and times displayed on your system).
User avatar
aldera
Posts: 229
Joined: Tue Aug 30, 2016 11:30 am
Location: Michigan, USA

Re: Online Sensor plugin

Post by aldera »

kmarkley wrote:Hmm. This has something to do with converting datetime values. I won't be able to look into it until this evening, but in the meantime it would be helpful if you posted the configuration for the device and also maybe your date and time localization settings (i.e. how are dates and times displayed on your system).
Here are graphics fir the plugin config, the 2 device configs, the Indigo setup and the Mac Server Date/Time config.
Attachments
Indigo Config.jpg
Indigo Config.jpg (39.67 KiB) Viewed 18444 times
Public Address Config.jpg
Public Address Config.jpg (19.02 KiB) Viewed 18444 times
Online Sensor Config.jpg
Online Sensor Config.jpg (39.68 KiB) Viewed 18444 times
MacServer DateTime Config.jpg
MacServer DateTime Config.jpg (31.18 KiB) Viewed 18444 times
Plugin Config.jpg
Plugin Config.jpg (17.14 KiB) Viewed 18444 times
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

I'm afraid you have mostly stumped me. There is only one place in the code that is looking for a 9-item sequence, which works fine for me

First, are you certain you are running v0.0.9? This line does not correspond to any of the debug logging in the plugin:

Code: Select all

   Online Sensor Debug             1502293632.0
Please re-download, install, and reload the plugin to be certain.

Next, please try deleting your device "IPAddressSensor". Do the other devices work ok? If so, try re-creating the deleted device.

If that doesn't help, maybe there's something hinky with your python install. Please create an action group of type Execute Script, and enter this script:

Code: Select all

import time

dev = indigo.devices['IPAddressSensor'] # Change the name if the new device has a different name
indigo.server.log(str(dev))

lc  = dev.lastChanged
indigo.server.log('lastChanged: '+str(lc))

tt  = lc.timetuple()
indigo.server.log('timetuple:   '+str(tt))

mt  = time.mktime(tt)
indigo.server.log('mktime:      '+str(mt))

lt  = time.localtime(mt)
indigo.server.log('localtime:   '+str(lt))

st  = time.strftime('%Y-%m-%d %H:%M:%S',lt)
indigo.server.log('strftime:    '+str(st))
Run the action and post the log results.

Lastly, you can download an updated version from github (unreleased at this point). This won't fix anything, but will hopefully provide some additional info on the errors.
https://github.com/kmarkley/Indigo-Onli ... master.zip

(FYI, when replacing the plugin, it should not be necessary to reboot the machine or restart the Indigo server. Just reload the plugin from the menu.)

----

As a side note, it is not necessary to create a schedule to update these devices. The plugin will update them all based on the frequency in the device config (5 minutes in your case). If you definitely want to use an Indigo schedule, you should set the Update Frequency to Disabled.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

So. I incremented the plugin version to 0.0.9 before I actually published the 0.0.9 release. This problem stems from a 'version' of the plugin (probably downloaded from master) prior to June 20. I went back and checked diffs on past commits, and can easily see when I changed that odd debug log line reported by aldera.

AFAIK, everything works in the actual 0.0.9 release. For the record, one should always download from the 'releases' section on github. Downloads from master are likely to be work-in-progress with bugs.

(Note to self: don't increment version number until ready to release.)
User avatar
aldera
Posts: 229
Joined: Tue Aug 30, 2016 11:30 am
Location: Michigan, USA

Re: Online Sensor plugin

Post by aldera »

kmarkley wrote:I'm afraid you have mostly stumped me. There is only one place in the code that is looking for a 9-item sequence, which works fine for me

First, are you certain you are running v0.0.9? This line does not correspond to any of the debug logging in the plugin:

Code: Select all

   Online Sensor Debug             1502293632.0
Please re-download, install, and reload the plugin to be certain.

Next, please try deleting your device "IPAddressSensor". Do the other devices work ok? If so, try re-creating the deleted device.
I tried downloading the latest version and reinstalling it and reloading it but that didn't work. So I deleted the IPAddressSensor device, stopped Indigo Server, deleted the plugin from the Plugins folder, restarted Indigo, installed and enabled the plugin and everything seems to be working again.

Thanks again for the help. Appreciate it.
User avatar
Busta999
Posts: 714
Joined: Wed Mar 30, 2016 4:48 am
Location: Wales UK

Re: Online Sensor plugin

Post by Busta999 »

Running v0.0.9

The Speediest function worked fro 12 hours then I started getting

Code: Select all

 Online Sensor Debug             Debug logging enabled
   Online Sensor Debug             actionControlSensor: Speedtest DL 40mb
   Online Sensor                   "Speedtest DL 40mb" status request
   Online Sensor Error             Unable to acquire lock
   Online Sensor Debug             updating states on device "Speedtest DL 40mb":
   Online Sensor Debug                   onOffState: True
Since then it is reporting exactly the same DL, the UL speediest also reports the same.

Any ideas?
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

Looks like it exited abnormally. The lock is supposed to be released regardless, so obviously I need check/fix that.

Reloading the plugin will clear the problem. If it happens again, please let me know if there are steps to reproduce.
User avatar
Busta999
Posts: 714
Joined: Wed Mar 30, 2016 4:48 am
Location: Wales UK

Re: Online Sensor plugin

Post by Busta999 »

Hi

Have tried restarting plugin and restarting Indigo.

The UL test is working again the DL is not still.
User avatar
Busta999
Posts: 714
Joined: Wed Mar 30, 2016 4:48 am
Location: Wales UK

Re: Online Sensor plugin

Post by Busta999 »

Ok

Turned it Off

Deleted Online Sensor Devices
Recreated Online Devices for Speedtest and it now works.
kmarkley
Posts: 187
Joined: Tue Nov 15, 2016 8:04 pm

Re: Online Sensor plugin

Post by kmarkley »

The plugin only allows one speedtest to occur at a time. So if you're using different devices for UL and DL, you might see this problem if the DL device is trying to update while the UL device is still going. You could try using schedules to update each at different times instead of the builtin every-so-often settings which could easily collide (especially after restart if both devices are now due for an update).

I use a single device to test both UL and DL speeds, and I guess I assumed most others would as well.

I'm not sure it would be a good idea for the plugin to queue up multiple speedtests to execute sequentially. It's not hard to imagine a scenario where they get queued up faster than they ca n be completed.
User avatar
Busta999
Posts: 714
Joined: Wed Mar 30, 2016 4:48 am
Location: Wales UK

Re: Online Sensor plugin

Post by Busta999 »

no problem now running Dl and UL Speedtest as one item.

Wanted to run them separately so i could put a performance indicator on DL of 50Mb and 15Mb on UL, as I couldn't find a way to set both UL and DL speed limits in the plugin.

In the UK most broadband is ADSL, Usually 40Mb DL and 10Mb up although that is changing to 80 DL and 20UL - I'm getting about 60Mb down and 18Mb up.

I was seeing, a great deal of fluctuation in these speeds throughout the day, hence tracking - it seems to have stabilised now though, so less critical
User avatar
Colorado4Wheeler
Posts: 2794
Joined: Mon Jul 20, 2009 10:48 am
Location: Colorado

Re: Online Sensor plugin

Post by Colorado4Wheeler »

This is one of my favorite plugins. I was going to write one myself but you did such a great job I see no reason to do so. I went totally "low tech" on my implementation:
  1. Internet "sensor" updates every couple of minutes to make sure I'm online (I'm Comcast in Colorado, so it dies about every 2-3 days)
  2. Trigger when the device goes "Off" it turns off the power to my Xfinity router and enables a timer to continue recycling the modem every 20 minutes
  3. Trigger when the device goes "On" that it disables the timer that recycles the router every 20 minutes
So far this has automatically had my Internet back up in 5 or so minutes without any intervention from me. Thanks for an awesome plugin.
My Modest Contributions to Indigo:

HomeKit Bridge | Device Extensions | Security Manager | LCD Creator | Room-O-Matic | Smart Dimmer | Scene Toggle | Powermiser | Homebridge Buddy

Check Them Out Here
Post Reply

Return to “kmarkley's plugins”