Need to count button pushes and then act - help please


#1

I"m using an Aeon dual clamp HEM to monitor power on a washer (clamp 1) and dryer (clamp 2) using a custom DTH that assigns a button push when the energy consumption hits a certain number of watts consumed. There are two virtual buttons (Button1 and Button2), one for each clamp.

I use this to monitor when the washer and dryer are done via watt consumption, and notify by flashing lights, etc. The washer is easy, as it drops to a low number of watts at the end of the cycle and stays there. My old dryer was the same.

However, I got a new dryer recently, and this dryer doesn’t have the same simple power consumption pattern. At the end of the cycle it drops to 8 watts four times, and then goes into wrinkle prevent mode (which can also drop to 8 watts). I want to use the repeatable event (four times at 8 watts) to mark the end of the cycle.

I have set my dryer clamp virtual button trigger to press at 8 watts, and need to count those four virtual button presses, and at the fourth, trigger my “dryer is done!” notifications.

I don’t see any example pistons in the wiki that have this capability to build off of. I know that part of the solution is creating a number variable and incrementing it up to 4, sending notifications, and then resetting the button to zero, but I couldn’t find help in the wiki on this.

Does anyone have a piston like this they can share, or can you help me w/some direction/pointers? Thanks!


#2

Create integer variable. In the same action of your button press do a set variable = variableName + 1.

Below that but in the same section. Add a condition. If variableName is 4 then do you notifications and set variable back to 0


#3

I’ll give it a try and see where I get to, thanks.


#4

I created the variable in the define section, and then set the If settings, and moved on to the then section. However, I don’t see an option, when in the “then” section, to set a value for the variable. The only options I see are for physical devices and system variables.

Can you help w/how I set the “+1” value of the variable?

I’ve set the variable up with starting value of 0.


#5

When you create the variable, make sure you have “nothing selected” and “no value set” for initial value. Otherwise it’ll reset to the 0 value you define every time it runs.

To increase the value each time it executes, try this:
Add an Action
Choose anything from the Devices menu
Under “Do” select “Set Variable”
Choose your variable in the dropdown list
Set your Value as an expression - in the text box type ‘YourVariableName+1’ without the single quote marks


#6

Thanks! Appreciate the help very much, would never have figured that out on my own.

Here’s where I ended up…I have a feeling it’s not right, but am not sure how to make it right. :slight_smile:

Thanks for looking at this.


#7

I think I see what you’re trying to do. If you can take a snapshot using the green button at the bottom of your piston, I’ll take a crack at cleaning it up tonight (or tomorrow if I fall asleep before it’s posted). :slight_smile:


#8

Wow…thanks very much. Really appreciate the chance to learn more about how to do this.


#9

I’m new to this too [installed my system Monday this week] and the people here have been super helpful to any questions I’ve had, so I’m glad to help anyone else!

I’ll clean this up now and will repost in a bit!


Apparently I’ve maxed out the number of posts I can make on my first day on the forum - hopefully I can edit this one and still get you what you need!

See if this does what you want? I didn’t have your items listed so you’ll have to re-select them from the dropdown.

To get this to import, try going to “add a new piston”, “Restore a piston using a backup code”, then enter the df5f code shown.

Any questions or hiccups, let me know!


#10

Cool, thanks, I’ll look at it now (at least until my wife tells me “PUT THAT COMPUTER AWAY!!” :slight_smile:

Wow. I’ve been using Core for a couple years (mostly simple stuff) and just converted to WebCore - this option to share and import pistons is amazing…I should have converted to WebCore much sooner.

I imported your piston and replaced the devices - it looks “right” unlike my effort. :slight_smile: I won’t be able to test now until tomorrow - wife looked at me like I was crazy when I suggested I might get some towels wet and put them in the dryer right now. She might be right, but I’m having fun making the world (or at least our house) a cooler place to be. :smiley:


#11

@Danabw can you share both piston for washer and dryer once you get them to work. Thanks


#12

Sure. You should also see this thread.


#13

OK, things have changed overnight…I reviewed the Aeon HEM washer and dryer logs again and found that I don’t need to use counters for the dryer, and I can’t use them w/the washer. Apologies for asking the wrong question.

The dryer logs make it look like it should be simple, based on a button push and hold state, and the washer logs are so chaotic that a timer seems like the best option (we run the same cycle pretty much all of the time).

I tried two versions of a dryer log based on Aeon HEM states, one looking for two different virtual button states (pushed, then held), and another looking for a dryerstatus=on.

None of my pistons worked.

I’ve included them below, as well as a link to a spreadsheet I created with the Aeon HEM washer and dryer clamp logs from two different cycles from each.

Appreciate help in getting the pistons to work.

Washer/Dryer logs

Dryer Pistons:

Washer piston:


#14

Just throwing this out there… The best way I’ve found to tune thresholds for energy meter readings is by logging the power to a Fuel Stream for a few power cycles. You will be able to clearly see the power usage on the fuel stream chart.

Here is an example of a piston that logs to a Fuel Stream. Just don’t leave it logging to the steam forever, please.


#15

You’re close but the nested if’s need a tweak in order to work properly. When the outer if evaluates to true the inner one is evaluated immediately thereafter. However in practice the inner event would happen later on.

There is a Followed By operator that allows you to match a set of conditions then wait for another set of conditions to match. To use it you would edit your outer if and convert the conditions to a group. Then, add a new condition to the if for the trigger that follows at a later time. Finally click the operator between the conditions and change it to Followed By. It will look roughly like

if
    (
        Keypad pushed
        and
        Time is between
     )
    followed by
    Keypad held
then

I hope that helps! I also have a dryer monitored by Aeon HEM so I’ll stick around to help.


#16

When I use the Followed by option, it is inserted as “Followed by within 1 minute” by default. I cannot find any way to change that “1 minute” parameter.

46 AM

Also, when I set the Follow by option, the dialog as an option to set “Not negated” or “Negated.” Not sure which option to choose.


#17

My apologies, instructing from memory did not work out well there. The approach that I use is basically two separate if’s where the first if sets a variable running = true and the second if checks the finished trigger and that running is true. The second one then sets running = false after it triggers.


#18

@ipaterson

Cool, thanks for the update, that seems to make it much simpler (though I’ve totally confused myself so many times w/this that I have little trust in myself at this point.) :slight_smile:

Attached updated piston…

One question, I have intentionally put the action to set the “dryerRunning” variable to False in two places so I could ask a question about that.

Should it be inside the “then” statement w/the other actions, or in the “end with” statement? I wanted to find out if one location was considered better than the other.

Really appreciate your help and feedback, thank you.


#19

You have two with blocks there inside an else if, the end with line just marks the end of that block. Either works, occasionally I use separate with blocks for separate groups of logic because they are easier to reorganize later as a group.


#20

DOH!

I started the washer tonight to do a load, and see how my two washer pistons would work.

The simple timer (start timer if button one is pushed) kicked off w/out issue.

The other piston that uses a washerRunning variable to help start the timer did not start. Realized that the first section of that piston evaluates the variable and looks for a “false” value…I didn’t initialize the variable w/false so it had no value so the piston didn’t run! Oops…I’ve set the variable to initialize w/“false” as the value, so it should work next time.

However, since the simpler piston that just starts the timer off a push is working, if that holds up looks like that will do it for the washer.