Rule Machine AND Custom Attribute that is a String value with 2 hour pull

I am having a fit with this Rule Machine notification. I have an MQTT pull coming in and I can create a Rule Machine Rule that works if I just pull that value based on "Changed". I am just getting way too many notifications since Solar values change so often. Looks like this and what I want when the notification comes in:

  • EG4 - Solar EG4 Battery Level - 89

Being the payload is a string I do not get the < > etc. options even though the string value is a number....dang rabbit... If Battery <70 AND >50 THEN... will not work with string values as far as I can tell and read.

I have one rule working for PV Solar IN that contains "00" so 100watts, 200 watts, etc... The issue is these values still happen more than I need to know so trying to add some time or other condition between checking.

image

But I want to add a delay to do it only every 2 hours, Mins, whatever and I am not getting any values if I select "Any Value" or "Contains" with a Periodic Time.

Another attempt that does not work... Exceeds? Can't it is string not integer???

If I add 2 Actions I get an OR condition and should be an AND so Run every 2 hours AND IF contains "00" send a notification... can't seem to get the AND working. Might be interpreting it wrong... but it ain't working sooo ???

image

I get them every 10 mins or so with this rule ^^^^

I am getting empty values in my notifications and I can see there is a value in the 4 items I am trying to pull. They should look like the original working rule:

  • EG4 - Solar EG4 Battery Level - 89

But adding every two hours as a trigger or a condition I get something like...

  • Solar Assistant - Triggered -

So confused. Anyone have any ideas?

Thanks

If you have a string that is just a number you can convert it to a number,

When you set your battery decimal there is an option called string. The string variable must be a valid decimal but it will convert it and then you can perform math operations on the new decimal variable.

Here is an example of a routine I use to take a string from my Ecobee thermostat and convert it to a decimal number.

That metric is making my brain hurt ;-D

I think I am limited to what is available to me.

I cannot set anything on the solar nor want to. I am just trying to get the 'payload' or %value%.

Not sure how you made those Actions, what did you select? I see the EcoBee, I also have, but not there yet :wink:

Here is what my Local Variables looks like on the one rule that is working and sending too many.

image

I would love to be able to trigger an Action on less than or greater than, but I only get these options

image

I am just sending a Notification to Pushover and Email to alert me on Solar Status/Behavior, so nothing to turn on or change, just report. Just not so damn many notices... I am tracking:

  • PV IN (watts and they change more than every minute
  • PV Load - how much power am I using
  • PV Battery Level - Is the solar charging it up or do I need to plug into the grid
  • PV Battery Temp - Is it too cold or hot

Thanks

What action allows you to set? not seeing that as an option for me.

One way to stop a rule from triggering often is to use a private Boolean required expression. Below is an example of a rule that sends me a pushover message once an hour, while the 18000 limit runtime is exceeded. How the message is sent is not important that is a separate rule, but it only will send it once an hour. You can use this with the changed trigger you have. Every time the value changes you set the PB false. then send your notification. Then set a delay to set the PB back true. Set the delay for whatever amount of time you want to wait. Once the PB is set back true the rule will trigger again on a change. Using the required expression, as long as the PB is False the rule will not trigger.

The rule below uses a wait. If I change the filter and reset the Ecobee runtime it will = 0 and continue, otherwise it will timeout in one hour. Then the next increase in the runtime will trigger the rule again and I get another Pushover notification.

The set is just set variable.

You could also use a separate rule that converts the data to a decimal number and puts it in a hub variable that you trigger on and use an expression for your trigger as I do in the rule below. runtime > 18000.

OK.. I just don't see the trigger option you are using. I do not see any trigger that lets me set a variable of any kind? to see your Variable reports Ecobee...

So I guess I need to know the Name of the trigger to use and what capability to select to get me there. and same with the actions.

Thanks

What driver is the "Solar EG4 Battery Level" device using? It appears that the driver should be changed to properly use the "Battery" attribute, which should already be a numeric value. My hypothesis is that whatever custom driver is being used is not properly outputting the data as a number. Fixing the root cause should help to make Rule Machine work much better.

3 Likes

MQTT Driver

Ecobee Runtime minutes is a hub variable.

As @ogiewon mentions the data coming back from your driver is a string. You could create another rule that takes that string and converts the string to a number, in a hub variable. You could then trigger off that variable.

The rule I posted above sets the variable TomorrowLow, which is a decimal hub variable, to the local string variable StringLow. Since it is a hub variable I can trigger off of that variable in another rule.

1 Like

I was about to suggest the same thing. Believe @mkgough is using a custom version of a MQTT driver as he mentions in this post.

@mkgough assuming my above statement is correct I would suggest focusing on making the driver filter out and parsing the values you need from your device vs trying to do a lot of parsing in Rule Machine.

1 Like

I am only getting the 4 payloads I want, it's just a single payload value from the 4 devices, but solar values change a lot, like outside temperature does, so just trying to create a rule to check for changes or a value less often than “changed” which can be multiple per minute.

Understand and that is why I a suggesting you update your driver to filter out the "noise" similar to the inbuilt drivers do with only logging events when temperature is over X degree changes. Check out this driver I helped create for occupancy sensor where the distance value is only updated based on a preference setting. Otherwise an event isn't logged and it is ignored: