New Plugin: SiteSensor

It’s all or nothing. If you implement the function, AltUI puts the title in the box, but leaves the rest up to the function. And it does nasty things like set a ginormous default font size (62px on my desktop, 42 on my phone), and that widget CSS, that just make formatting it in there nightmare. Just the fact that the icons in the default presentation are over-scaled to a larger size (makes them kind of blurry and ugly) and there’s quite a bit of hard-coding for certain device types, makes me think this is something that was done early on but hasn’t revisited in a while. The function isn’t even documented in his current plugin guide; I found it by reading his code.

Thank you. Pretty happy with the outcome actually. See attached

Looks good! And thanks for introducing me to a feature I had completely missed!

Alright new question here. I have been playing with the returned expression and am trying to apply a global function to one of the returned variables within the expression field but it does not appear to work. I tried to add the function (rounding of the number) to the LuaXP file which I assume is being used for evaluation but it did not work either.

How would you allow the use of global variables and functions in the expression field?

Edit: nevermind. I looked at the luaxp code and found that the round function is natively there… my bad

Glad you found your answer. I’ve been out of the country for a month, sorry I couldn’t reply quickly enough for a pointer to save you time. I’ll work at making the function library documentation more easily accessible.

Hey rigpapa, a minor thing but on ALTUI, the icon for the Sitesensor in the altAppstore shows up as http://apps.mios.com/http://www.toggledbits.com/sitesensor/assets/sitesensor-default.png which of course is not valid. I suspect it is a problem when switching between the mios repo to github when updating plugin version. It might be a simple fix in the alt app store as well.

Thanks for letting me know! I’ll check it out…

@rafale77 Hmmm. I’m not seeing an issue with the icon in my installation, nor do I see a problem with the URL in the AltAppStore config for the plugin. Am I looking in the right place for what you’re describing?

Interesting. I am seeing the problem only on the “Plugin” screen where it lists all my installed plugins on my openLuup installation. Not in the AltAppStore. I wonder where this url is stored.

Note that even if you get the link corrected in the AppStore, you need to either uninstall and reinstall the plugin in openLuup or you need to edit the user_data.json to correct it. I made a mistake with my icon location in the AppStore and fixed it, but the plugin list wasn’t getting updated. Editing the user_data.json was easy enough for me in this case.

I don’t know how your icon link got messed up, but I know I managed to do that myself.

I just checked and nope, it’s not in the user_data.json. The url is not stored there.

Maybe we are talking about something else, but every one of the plugins in my user_data.json has an Icon: line which has either a file location or a URL in openLuup. Sample picture attached. But maybe you are referring to something else? Or the plugin is missing this field entirely?

What I meant was that this field has the correct URL in the user_data file. It is not where the problem is. I have no idea where that wrong URL is coming from and where it is read.

What I was trying to point out is that if @rigpapa or anyone else has fixed the wrong URL in the AppStore since you installed it, your plugin won’t be updated unless you delete and reinstall it or edit the user_data.json. And that may or may not be the problem you are seeing - just mentioning it.

Absolutely correct, see…
http://forum.micasaverde.com/index.php/topic,84980.msg388187.html#msg388187

I see, I got it fixed by stopping openLuup and manually editing the json file. It was just the https problem. I was looking for the invalid “apps.mios” url which I could not find which is what confused me.

I’m getting a startup error in the openLuup startup log.

2018-06-09 15:56:15.047 openLuup.chdev:: [string ""]:39: unexpected symbol near '}' 2018-06-09 15:56:15.047 luup.create_device:: [86] D_SiteSensor1.xml / I_SiteSensor1.xml / D_SiteSensor1.json

There were no errors during installation from the altApp store. Current sitesensor is 1.6. The program is installed and the UI appears functional, however, I tried to create a link to the https://api.sunrise-sunset.org as outlined in your blog post, but the plugin does not seem to respond.

The values you suggested for this particular link were input into each field, (there are some misnamed fields in the blog description) and after a luup reload, the values persist, however the plugin does not appear to produce any result.

I set to true constants for debug, altUI, and openLuup at the top of the sitesensor lua file. After doing so and with a luup reload, I can see that setting the armed switch in the UI for the sensor creates a log entry, as does toggling log requests. However there is still no visible action and the UI on the control tab reads tripped, without any of the other fields in the UI displaying information.

Hope all that helps.

edit Request Timeout: should be 60, not 28000 and Request Interval should be listed --set for 28000
“Re-Evaluate Trip Expression” should be “Re-evaluate the expressions” and should read to set to a minute not seconds.

Changing the [tt]debug[/tt] constant will add more logging info. The two lines you posted don’t help much. Post more log, or better yet, email it to me (email address on my profile).

Don’t need to change [tt]isALTUI[/tt] or [tt]isOpenLuup[/tt], these are managed by detection at startup.

You might ask @akbooer about the startup error. Although it’s near the SiteSensor plugin load, and without more context, it’s hard to discern what’s going on there, but off-hand it doesn’t look like a SiteSensor issue. And the fact that you say its logging things when you try to arm/disarm/etc. suggests the plugin started and you’ve got at least a somewhat running device.

It would also help to run this request and send me the output with the logs:

http://your-openluup-ip:3480/data_request?id=lr_SiteSensor&action=status

Oh, and if you are running the recent OpenLuup update with the new XML parser, you need to install the “stable” version of SiteSensor.

Yes, I’m running the test version of openLuup with the new XML parser. Where is the “stable” version of SiteSensor?

Also getting a 501 error to the status command.

“No handler for data_request?id=lr_SiteSensor”