Trigger changes from power of 0

What's the best way to write a rule where the trigger is where the outlet power changes from 0 to anything else?

I am a fan of private boolean for this. I have two rules, the first would be the PB part of the rule.

Trigger

  • power = changed

Actions

  • If power greater than (insert number) set private boolean true.
  • Else if power is less than (insert number) set private boolean false.

In rule 2, I use PB from rule 1 as the trigger.

You can theoretically do this in one rule, but I find it easier to keep them separated for diagnosis and just ease of understanding the rules in general. You also aren't triggering the main rule continuously because of the power changes. This I think helps especially with complex rules where you don't want to run through the logic every time the power value changes.

2 Likes

Is it possible to use a trigger like:

  • Power > 0.01 (or some number low enough to only be reached when the power is off.
  • How about Power > 0 ; is there a concern a power of zero is somehow an issue?

I would be worried a Power changed might be repeatedly triggered if the running power dithers.

That is pretty much exactly how I set mine (0.5W). It isn't exactly zero for off, just in case of glitches etc.

This method does take a tiny bit of tuning of on/off values to make it accurately reflect state, but to not constantly trigger.

That would trigger every time the power is greater than .01. Was really hoping to only have it trigger the one time it changed somehow. Same for power > 0.

This is a for a pretty big qled tv and the power can swing pretty wildly depending on the scene. I'll have to monitor it for a few days and see if I can find it's typical power band when on.

Something like this but for RM:

public class X
{
    private int x = 0;

    //some other code here

    public void setX(int proposedValueForX)
    {
       if(proposedValueForX != x)
       {
           doOneTimeTaskIfVariableHasChanged();
           x = proposedValueForX;
       }
    }
}

Maybe a wait would work. If X = 0 then wait until X != 0

This probably isn't structured correctly but this is what I came up with...

The purpose of this rule is to try and keep the Samsung TV integration app in sync with the status of the TV.

Yea I didn't think it through.

So it seems you want to run some code when the TV first turns "on". I would think the current never goes to zero.

Just for curiosity, does the TV have a USB port that gets powered then the TV goes "on"?

Power is currently at 0 as seen in the screenshot. It has a USB but I've never messed with it.

My Samsungs work this way. Use a Ecolink contact sensor and build a detector circuit (or use a relay)?

1 Like

My wash machine does the same. Just the timer is about 7W, but when beginning a spin can hit 500W or more. Agitation is in the 300W range.

This works fine for me, I don't seem to be overwhelming the hub, or getting false events.

The other part to consider is how you have your power reporting device configured. It can play a pretty large part in how often you get power reports. I have mine set to report on quite large changes only (50W change) to minimize the amount of reports I get. I have turned off all other power reporting for this plug.

I plan on adding about 20 of these for various things so I have to be careful how I structure them.

1 Like

I have about 10 of those Ecolink's sprinkled around the house. Trying to avoid adding more battery devices unless it's required.

1 Like

I would try to be sure that whatever device you pick can be "tuned" with lots of settings. For my Zooz Zen15 (appliance plug) you can tune the following. With other outlets, you might not get anything but Watts. I don't know what outlets have which settings.

I try keep them under control with a reasonable amount of tuning.

1 Like