Expressions page
Expression is a code expressed with the Lua language. It can use named items and devices in an expression body. It allows all kinds of arithmetic, boolean, floating-point and string operations in it.
1.1 It is possible to manage expressions on “Expressions” (1) page. There you can find list of expressions (2) and “Add New expression” (3) button.
1.2 To create Expression click on “Add New expression”
Enter expression name (1), Enter expression content (2), press “Create Expression” (4) button or cancel (3) it.
Expressions in Triggers
You can use Expressions instead of Value in Local MeshBot Triggers. To use Expression instead of Value click on the dropdown (1) and choose “Expression”. Then select specific expression (2).
Local MeshBot. Updates for Vidoo in Triggers
We added support for Face and Object detection. Now, it is possible to use 3 different categories as an event source:
6.1 Motion. Select Motion type, sensor state and camera.
Maybe the Ezlo staff can give us some examples or documentation to get us started?
I am hopeless at writing expression code in MSR, so expect to have the same problems with the new Ezlo Lua expression code also.
I can give you one MSR example rule I have that uses some local variables / expressions to do some calculations and work out which of my battery operated devices have a current battery level below 10% and then in the rules actions it sends me out notifications to Telegram and Google Home TTS etc.
The expression language used in MSR is called lexpjs and has some help documentation here on Github.
In my example rule I have three local variables / expressions.
The first one works out all the devices on my Vera Plus hub that are battery operated devices.
The second one works out of those devices which have a battery level below 10%
The third one puts that in to a human readable sentence like “Porch Motion Sensor at 1%”
In the same rules actions I then sent out notifications, for example this one is for Telegram and I use the ${{battery_low_names}} variable name in my notification text.
So in this example the notification I receive would read “check battery level porch motion sensor at 1%”
How could you re-create this rule in Meshbots with your new LUA expression code language ?
Also here is another example of some MSR expression code, that will look for any devices that have failed i.e. the CommFailure variable on a device is 1. The second expression / variable puts that in to a friendly human readable name that can be used in a notification to Telegram.
So I have been evaluating the current state of EZlogic to host some of my everyday Vera automation logic on an Ezlo Plus.
One example is my Vera using DarkSky to determine if it is gloomy outside while we are home during the day, and if so, it turns on some lights to brighten our interior environment. Seems like a pretty good use case that can serve as a learning exemplar for the community.
Step one is to create some sort of trigger when the weather is gloomy (i.e. cloud cover > 90%, or overcast or foggy or rain). There appear to be several different EZLogic options:
Use the AccuWeather or OpenWeather NuCAL integrations
Create a Meshbot that makes an https request to the appropriate weather service to get the conditions and use that as a trigger in another Meshbot
Write a isGloomyWeather Lua expression that makes an https request to the appropriate weather service and sets itself to true/false accordingly and use it as a trigger
I tried the NuCAL weather integrations but none of them would register in EZLogic 0.13.2. I tried both Safari and Microsoft Edge. Note, there is also a typo in the NUCal enrollment dialog.
Regardless, my primary question here is, which one of the trigger options above does the Ezlo team recommend or is there a better way to create this trigger? I will be happy to share my learnings here for others’ benefit…
I can’t speak for the ezlo team, but I can tell you that the NuCAL integration is still in “coming soon” status, thus the reason it didn’t work for you - it’s not quite ready to use yet.
Once it is, I would think that would be the best option here (and for many other things), almost certainly better than a “manual” http request
Hi, @blacey its not officially launched yet so we need couple of more days to have it working as you requested here. So basically we will start with Openweather and you will be able to store the weather results (temp or gloomy etc) into a variable/expression and then in another meshbot you will be able to use it with ease as a trigger.
Also the Services page will have a complete redesign of course …
Okay, I’ll put my meshbot-ing on the back burner until such time that one of the NuCAL weather plugin is available. It would be great if you offered an AmbientWeather NuCAL plugin too.
On the Vera firmware hub I’m currently using this 3rd party plugin for weather that gives you some nice weather plugin devices directly into the Vera GUI.
I’m using it with Open Weather Map but it also supports these weather providers.
DarkSky
Wunder Ground
Accu Weather
Open Weather
Ambient Weather
Buienradar (the Netherlands only)
Would be nice to have a similar weather plugin for Ezlo hubs that creates actual plugin weather devices or will NuCal integration also do this?
I just noticed something else: The Dynamic Dashboard doesn’t seem to update automatically. I noticed this with the values of the thermostats, which always stayed the same until I refreshed the browser window. Is that a mistake or something intentional?
Its a bug if its doing that. Lots of things on the Ezlogic web GUI require a hard refresh of the browser to update and not just in the dynamic dashboard area but in other areas of the GUI also, which is annoying.
Ok, so if I wanted to use an EZLogic Expression as my Meshbot trigger, instead of using a NuCAL plugin, is there a json parser available to the Lua expression engine? If so, can you point me to a brief example?
Sounds good but in the mean time, is there a way to parse a json string in a Lua “Expression”. I’d like to try to implement my weather condition meshbot trigger as a Lua expression.