New Plugin - miniUniFi (minimal UniFi access)

Posted on
Thu Oct 29, 2020 8:59 am
FlyingDiver offline
User avatar
Posts: 5565
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - miniUniFi (minimal UniFi access)

Open an issue on GitHub for this. Looks like the SQL plugin is trying to treat something as an integer when it shouldn't.

Use the plugin menu command to write the controller data to the log, then put that output in a zip file and post it to the GitHub issue.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 29, 2020 9:04 am
FlyingDiver offline
User avatar
Posts: 5565
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - miniUniFi (minimal UniFi access)

Oh, and find that state (port_table_5_poe_power) in the state list for the device and post the value.

On my POE switch, those values look like:

Code: Select all
                        "poe_power": "3.40",
                        "poe_power": "0.00",
                        "poe_power": "3.38",
                        "poe_power": "3.13",
                        "poe_power": "2.50",


All of which convert to a float easily.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 29, 2020 9:27 am
FlyingDiver offline
User avatar
Posts: 5565
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - miniUniFi (minimal UniFi access)

FWIW, I just enabled the SQL Logger on my development system, and it's not having any problems with my UniFi devices.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 29, 2020 10:38 am
autolog offline
Posts: 3576
Joined: Sep 10, 2013
Location: West Sussex, UK [GMT aka UTC]

Re: New Plugin - miniUniFi (minimal UniFi access)

I think I have discovered the issue - it looks like it might be a problem with the SQL Logger.

The fields causing the problem are e.g. :
  • port_table_8_rx_bytes : 68743589237 (integer)
  • port_table_0_tx_bytes : 13073677746 (integer)
  • etc

Using Valentina Studio to interrogate the indigo device schema schema for the device, the field types for these fields are defined as integer which can hold a maxim value of -2147483648 to +2147483647. Those values listed above are larger.

The fields need to be of type bigint which can hold -9223372036854775808 to 9223372036854775807.

Either that or your plugin needs to store them as strings.

I will try and do a fix by changing the field types to bigint and see what happens. :)

I'll report back shortly and post the above to Github. :)

Posted on
Thu Oct 29, 2020 6:31 pm
FlyingDiver offline
User avatar
Posts: 5565
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - miniUniFi (minimal UniFi access)

Anyone else seeing any issues with 0.0.15? I'm going to re-tag it to 0.1.0 and release in a day or two if not.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Oct 29, 2020 6:37 pm
Korey offline
User avatar
Posts: 705
Joined: Jun 04, 2008
Location: Henderson, NV

Re: New Plugin - miniUniFi (minimal UniFi access)

FlyingDiver wrote:
Anyone else seeing any issues with 0.0.15? I'm going to re-tag it to 0.1.0 and release in a day or two if not.


Running for almost 24 hours.. All good here!

Thanks for this handy plugin! :D

--
Korey

Posted on
Fri Oct 30, 2020 6:41 am
jalves offline
Posts: 650
Joined: Jun 16, 2013

Re: New Plugin - miniUniFi (minimal UniFi access)

FlyingDiver wrote:
Anyone else seeing any issues with 0.0.15? I'm going to re-tag it to 0.1.0 and release in a day or two if not.


Looking good here. Running 24 hours and triggers are functioning as expected.

Running Indigo 2021.1 on a 27" iMac (mid-2017), 40G memory, 1T Fusion Drive, OS X 12.0.1
Jeff

Posted on
Fri Oct 30, 2020 9:52 am
jalves offline
Posts: 650
Joined: Jun 16, 2013

Re: New Plugin - miniUniFi (minimal UniFi access)

jalves wrote:
FlyingDiver wrote:
Anyone else seeing any issues with 0.0.15? I'm going to re-tag it to 0.1.0 and release in a day or two if not.


Looking good here. Running 24 hours and triggers are functioning as expected.

Replying to my own post here. Not a problem with the plug-in but a "practical use" question:

I set up a trigger that fires whenever my iPhone drops off the network, which simply records the event in the log for now. That works fine. But in looking back at my log I notice that my phone (as well as my wife and my son) phone will randomly drop off the network even though we are home and not even using the phone. They quickly reconnect (within a minute or two). But, in order for my trigger not to fire inadvertently I got smart and added a condition that checks how long it has been off using the seconds feature of the plugin. I set it to only fire if the seconds is greater than 120 thinking that it would take care of the issue. But wait....

I was just away for ~90 minutes. I checked my logs and nothing was recorded. Scratching my head about that I finally realized that since the trigger fires when the state changes, the number of seconds since last seen will never be more than 30 because that's how often the plugin checks for status.

So, any suggestions as to how to set up the trigger that will delay an action for, say 10 minutes, when a device drops off the network?

Running Indigo 2021.1 on a 27" iMac (mid-2017), 40G memory, 1T Fusion Drive, OS X 12.0.1
Jeff

Posted on
Fri Oct 30, 2020 9:54 am
FlyingDiver offline
User avatar
Posts: 5565
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: New Plugin - miniUniFi (minimal UniFi access)

Set the trigger for that state becoming greater than 600.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Fri Oct 30, 2020 10:12 am
jalves offline
Posts: 650
Joined: Jun 16, 2013

Re: New Plugin - miniUniFi (minimal UniFi access)

FlyingDiver wrote:
Set the trigger for that state becoming greater than 600.

Of course! Sometimes I get tunnel vision. ;)

Running Indigo 2021.1 on a 27" iMac (mid-2017), 40G memory, 1T Fusion Drive, OS X 12.0.1
Jeff

Who is online

Users browsing this forum: No registered users and 1 guest