Plugin Error Handling

I am working on a Blue Iris plugin. One plugin instance manages all the cameras (devices) on a single server. Plugin Settings specify the Server name, IP Address, Username & Password. I have two Blue Iris servers, so I have two plugin instances. It is working pretty well.

My question about implementing Plugin Error Handling.

For example, if I were to specify he wrong username or password, the Plugin’s onConnect() gets the Settings for the plugin instance and calls my biLogin(). The Blue Iris Login API returns a failure status with reason “no matching user/pwd”. I parse and throw the error and catch it in onConnect() but other than writing to the console log, how can it be returned and displayed to the user somehow, in a popup if possible.

The plugin is being invoked through the use of the DeviceBrowser to load up the tiles.

Thanks /keith

When the user changes those settings on the actual Settings page in the app you will see the popup. Or when the user 1st adds your plugin & prompts for those Settings, it’ll also display your error message in a nice popup. Those are the only 2 times the Home Remote will display error messages in a popup message. During normal runtime when they aren’t actual changing settings no popups will be displayed.

Thank you again Bill :smiley:
Tested with Synchronize Devices … Works like a charm

BlueIris Connect Failure

1 Like

I was wondering if I could use the Scene functionality to dynamically display a pop up message to the user during runtime; the goal is to alert the user if connection to Blue Iris fails. During “Device Synchronization” I’m able to throw an Error and have it displayed.

I’ve added two new attributes to my Blue Iris plugin device: “HasError” and “ErrorMessage”. The plugin onConnect() initializes HasError=false and ErrorMessage=""

During runtime, if the connection to the BI server fails, HasError is set to true and ErrorMessage accordingly.

The Scene triggers on HasError = true, with an Action to PopPage that will display the ErrorMessage value. With the BI settings configured with an invalid password to cause the connection to fail, I run the app in the designer but I never see the page pop up.

So … I added display labels in the BI camera page to show me the values of HasError and ErrorMessage. When running, I very briefly I see “HasError=false”, but then the value false disappears. I am logging the fact that the connection error occurs and that I’m setting HasError to true. I would have expected to see displayed: HasError=false, then HasError=true when the connection fails.

Q: What is the LifeCycle of a Device? Is there a proper place to initialize Attribute values? Would it be in onConnect()? Would these Attributes be cleared by the framework at some point after onConnect() is called?

Q: Are these Attributes I’ve added persisted anywhere? I had thought they were transient and had no value until the plug actually sets then.

Q: Does using the Scene feature seem like an appropriate way of dynamically displaying an error message to the user?

Thanks! /keith

You can use a ScriptAction in your Scene to call the JS “alert” or “prompt” functions. Or just have your Scene try to set an Attribute in your plugin. When you try to set an attribute in your plugin, the app will also show those error messages from onConnect. So maybe that’s the best option.

You can initialize them wherever. It can be in onConnect or onPoll. It really kind of depends on the plugin & where makes the most sense.

They are not. You should always set them in either onConnect or onPoll. They automatically get reset with Unknown values when disconnected.

If you just want the plugin to show an error message when the plugin is down, then you don’t really need a scene. Have the Actions for one of your buttons try to set an Attribute on your plugin device. During that scenario, the app will show your error plugin messages in a popup.