Scene Event Help for a Newbie

Trying to write a Luup event and can’t figure out where to put the code.

I have the Luup code correct, but in the events tab of a scene; It makes me chose a device and then only associated events are available to that device. There is a Luup button at the side of the event, but I’m not sure what putting code in there would do. All I’m really trying to do is pull some information from a device (TED5000) and say if something occurs then execute a command.

This is all I’m trying to do:

local lul_watts1=luup.variable_get(“urn:micasaverde-com:serviceId:EnergyMetering1”,“Watts”,29)
local lul_watts2=luup.variable_get(“urn:micasaverde-com:serviceId:EnergyMetering1”,“Watts”,31)
if( tonumber(lul_watts1)==0 ) and ( tonumber(lul_watts2)==0 ) then
return false
end

Just can’t figure out where to put this to make it work. I would have thought I would have been able to create just a Luup event, but it seems that any Luup code has to be attached to another event as I said earlier.

As you can tell; I’m new to this stuff so any help is appreciated.

Mark

Marc,

I can’t help you yet with the location of the code, as my system is on the way, but I am interested in what you are trying to do, since I also have a TED5000 that I just installed a few weeks ago. What are you executing?

Putting Lua code there is the same thing as putting the code in the Scene’s Luup tab.

You can create a scene with a timer and tell it to run every minute, and then put your code in the Luup tab.

Thanks for this mcvflorin, I’ll give that a try, makes sense.

@Cherokee180c (nice plane BTW) I live in Arizona so to keep electricity down in summer; I am on what is called a “time of use” and “demand” plan (they call it “Combined advantage” here). What this means is; on off peak times, electricity is relatively very cheap (.04c per Kwh) but between the hours of noon and 7pm it’s very expensive, plus there is a “demand charge” where they take the amount of electric you use in any one peak hour throughout the month and charge big bucks based on that hour, so the trick is to use just about all of your electric in off-peak hours, unless you have a solar system. That’s easy in winter but not so much in summer when it’s 110 outside. So, I have a solar system that generates about 8kwh’s per hour through the peak times in summer, my AC units (2 on the house) use around 6kwh’s each, so what I’m doing with Vera in this case is running the AC units alternating them, so I keep the usage within what the solar is generating and thus have almost no demand charge in that time. All of the checks I’m doing with TED5000 is making sure that I’m generating enough electric to run the AC units and that the load on the house is not going too high, and if all is not good, then shut them down. This particular event here (watts at 0 on both solar and load) would tell me that something was wrong with the TED5000 reporting (as 0 watts is how TED shows up when it’s not communicating correctly) and I would shut the AC units down based on that.

Turned out to be a long description, sorry about that but hope it helps.

Mark

@MarkC,
I used to live in Arizona so I know what you are up against. In summer months the bill on our house ran over $400. I used a program I wrote to record all the amps used on the major circuits so I could evaluate where all the juice was going. I discovered that my compressors created a 110 amp surge every time they came on. I fitted them with a soft start unit and reduced the surge to @60 amps…I had two 5 ton compressors. It is a small investment to reduce the demand charges…
We use three phase compressors on our yachts that are driven by frequency drives…they take in single phase 220 and put out three phase 220 and vary the frequency to make the compressor run at any speed you want. We only have 50 amps available at the dock so power management is a big deal…using the frequency drives there is NO surge, the motors ramp up and ramp down. The part I never thought about is that when you are in Peak load times you simply slow down the compressors. It’s not an all or nothing game that way. After seeing what can be done I am amazed that in Arizona homes are not built with better HVAC systems! I was going to set up my swimming pool to be the heat exchanger to increase efficiency as well but instead I moved to San Diego where I no longer have HVAC! Ha
Regards
Tim Alls
AllSeas Yachts

Hi Tim,

Yep, I hear you, I’ve been dealing with that too. The AC units on my house are pretty new (both 5 ton too) so there is no real surge whtn they start, just a little but not as much as yours did. Bill used to be around $500/month.

I now have the electric bill on a 4000 sq ft house down to less than $100 a month, and I keep the house at 73, so it’s not bad really, just like fine tuning, because I get bored :slight_smile:

Mark

Wow that is impressive. We have time of use meters as well, but no demand charge. I got pissed off at BGE because they made it almost impossible to beat the flat rate comparison even after moving all usage to the nonpeak hours as nobody is home all day. I switched to a third party supplier here now to simply get a better flat rate. Rate is now $.09/kWh but when you add fixed charges, taxes and distribution it is .13/kWh. I found and fixed a return duct balancing problem with my system saving almost 40% usage with the TED already. My system was running 5 hours to recover from setback as all the air was being pulled from the first floor return and it was re-cooling the same air. I blocked off 90% of the first floor return and doubled my airfow on my second floor return where all the hot air was trapped. It recovered from a 85 degree setback to 75degrees the other day with 99deg outside temp in under 2 hours now. Idiots used a gap in the drywall as the return duct and put the same 18x18 vents in series on the first and second floors in an open foyer design. I guess they never figured out air follows the path of least resistsnce. TED let me see exactly what was going on with the A/C run times and measure the improvements as I made changes.

It may not stay this way, but our juice (public utility district in Oregon) is so cheap, switching to LED lights and trying to throttle usage is a environmental/moral cause rather than fiscal. $0.0483/kWH for the first 1000, $0.0541/kWH above that. We don’t have demand, reactive charges yet. Non-residential has tiered rates for non-residential, but so far for us, it’s all flat.

–Richard