Basic LUA code not running from action question

I’ve been working with PLEG to automate our 9 ecobee thermostats and running through some issues. The basic scenario is that I want open windows to turn off AC when cool is being called for and fire up the circ fans. While stepping through triggers and conditionals, I’m running into a problem when running code in a PLEG action. The controls for the stats are very limited in the GUI, so code is pretty much required.

This code works exactly as expected when testing from the Develop Apps “Test Luup” interface. The Ecobee stat in question turns on the fan.

local service_id = "urn:upnp-org:serviceId:HVAC_FanOperatingMode1" local action = "SetMode" local args = {NewMode="ContinuousOn"} -- or "Auto" local dev_num = 60 -- Our Ecobee R&D Thermostat Device ID luup.call_action(service_id, action, args, dev_num)

If I copy/paste this same code into an action in PLEG and click “Run it Now”, nothing happens when monitoring the Ecobee stat. The PLEG log (set to debug in a separate file) shows “RunNext: LUA continue”. If I try to debug using the “log to VERA file”, the log never loads when I try to display it from PLEG.

My condition is called “c1” and the PLEG log shows this condition is true (I’m testing with a virtual switch and a few window sensors). So when t1 (trigger one virtual switch) is true, it looks like my condition is toggled to “true”, but nothing happens on the stat, and the log does’t provide any information on why the code (above) is failing in the action.

Sun Mar 06 13:15:1.081 - RunNext:Condition:c1 Index:1
Sun Mar 06 13:15:1.411 - RunNext:Lua Continue
Sun Mar 06 13:15:1.412 - SaveActionDB:{}

Any suggestions on how I might be able to sort out what’s going on? I’m a Vera newby, so please assume “child like intellect” in terms of replies :slight_smile:


Did you RELOAD LUA after making changes ?

Like Richard said be sure you reload after you set your changes, but you also do not need code to complete this you can just use the setmode option in your ecobee and set newmode to continuouson or auto

ML, thanks for that tip. I’ve been using code to control the ecobee in order to learn the basic snippets I need. Control via the gui is missing essential bits like resumeprogram, and the ability to set climate holds. I’ve also edited the ecobee_1 xml file so that fan and climate holds are not indefinite, but rather just until the next scheduled event.

Richard, I ended up doing a restore on the Vera Edge box, reauthorized the ecobee app (get pin) and managed to get things working as expected. Thanks for the “reload Lua” tip using the buttons you’ve provided in all the tabs…will definitely remember that going forward.

I was hoping not to have to get too deep into the Vera Box, but it’s pretty obvious at this point that PLEG is pretty much mandatory for what I’m trying to do. I’m trying to automate night cooling etc. in a 9000 sq/ft building with 9 ecobee stats, ventilator fans etc. Between PLEG and the Combination Switch App, I figure we’re good :slight_smile:

Between automation (shuts off a pile of non-essentials when security system is armed) and aggressive setbacks with the 9 Ecobee3 stats, we’ve cut our gas usage for heat by 25%, and power use by about 15%.

Is there a way to turn off AC cooling with a PLEG logic action without using Luup code?
If not, how would I do it with luup code?

Yes you can send commands to your thermostat without LUA.

I found the solution to using PLEG to shut off AC. By default the action window for my thermostats opens in advanced mode. If one switches to the basic mode with the slider near top, an image of thermostat appears. One then just clicks on the OFF button and save the action.

Best Home Automation shopping experience. Shop at getvera!

© 2021 Ezlo Innovation, All Rights Reserved. Terms of Use | Privacy Policy | Forum Rules