Rule Machine 4 Temperature Comparison

Hi friends!
I have a rule setup to compare the temperature from an outside source, to an inside source and activate a fan, easy enough! but I've hit a snag... the outside temperature only shows ? in the rule...

I am using the weewx driver from here: https://github.com/sgrayban/hubitat-weewx-driver/blob/master/Driver/weeWX-driver.groovy

to poll my personal weather station, and that works fine, in the device, I can see temperature reported just fine, on a dashboard tile, again, temperature reported just fine... so I'm at a loss as to what to look at next.

I've tried both a v3 and v4 rule machine rule, they both seem to do the same thing.

Any ideas? perhaps a bug?

Thanks!

Can you post a screenshot of the rule? And maybe the device page for the device you are getting outside temperature from. That will help people help you.

The problem is not in RM if the temp is being displayed as ?. The problem is in the device. Please post a picture of the edit device page for the device you are trying to get the outside temperature from.

Photos attached.

and one more of the dashboard tile...

Have you tried reversing the comparison, so that the outside temperature is on the right instead of on the left. It's a strange problem, and not immediately obvious what is wrong.

Also, could you post the events from the device (button at top of device page).

@bravenel, it seems I'm unable to reverse the condition... any time I try, even creating a brand new rule, I get

app:392019-08-19 14:22:24.905 errorgroovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.lang.Integer#plus. Cannot resolve which method to invoke for [null] due to overlapping prototypes between: [class java.lang.Character] [class java.lang.String] [class java.lang.Number] on line 4540 (mainPage)

and the rule-app blows up... have to delete it, won't open or anything...

So let me get this straight: You were trying to edit the condition you had, to be this

Temperature of Garage Thermostat > Rooftop Weather

Is that right? Were you doing it in the Manage or Create Conditions section?

Can you just create an empty rule, give it a name, go into Actions, and then into Manage or Create Conditions, and see if you can create that condition above.

The problem is in the driver. It's putting a string value into temperature, and it is supposed to be a number. This is on line 902 of the code you linked above.

sendEvent(name: "temperature", value: state.Temperature +" " +state.TU)

You need to contact the driver author and have them fix that. All of these sendEvents with strings for values need to be fixed to send numbers, not strings.

Yes. The value should never be the number AND the units... That's weird. Good catch Bruce.

Units is a field in an event:

sendEvent(name: "temperature", value: state.Temperature, units: state.TU)

well, That's cool! curious that it only seem to impact rule machine, but that makes sense...

I'm going to see if I can fix the driver myself, it doesn't seem like it's author is able to give it any time...

Also, Thank you!!

You can see the problem in the state display of the device:

27%20PM

Temperature should be 72.3, not 72.3°F.

well, that's good to know!

it seems I'm not going to be able to fix this that easily... the data, including the degrees F is coming from the far end... no idea how to strip that off. sooo, gotta figure that out!

Thanks everyone for the help!

No, it's coming from the driver, in the code I pointed out. The driver has the temperature value as a number internally, it's just messing it up in that one place (messing up several values, including temperature).

If you turn off display units, it should work. The code I showed above is the fix for the bad code around line 902.

That should be:

sendEvent(name: "temperature", value: state.Temperature, units: state.TU)

Indeed, I have display units turned off, but I can see the same in the raw JSON data the driver reads.

it looks like the driver is supposed to fix it around line 572, but something about that isn't stripping off the data...

am I wrong? (kinda guessing)

here's a segment of raw data from the source JSON file:

{
"title":"Current Values",
"location":"Rooftop Weather - Arvada, Colorado",
"time":"08/19/2019 03:45:00 PM",
"lat":"39° 50.47' N",
"lon":"105° 07.36' W",
"alt":"5659 feet",
"hardware":"WeatherLinkLive",
"uptime":"0 days, 17 hours, 28 minutes",
"serverUptime":"18 days, 16 hours, 27 minutes",
"weewxVersion":"3.9.1",
"stats": {
"current": {
"outTemp":"93.0°F",
"windchill":"93.0°F",
"heatIndex":"89.1°F",
"dewpoint":"30.7°F",
"humidity":"11%",
"insideHumidity":"50%",
"barometer":"30.098 inHg",
"windSpeed":"2 mph",
"windDir":"75°",
"windDirText":"ENE",
"windGust":"5 mph",
"windGustDir":" N/A",
"rainRate":"0.00 in/hr",
"insideTemp":"75.4°F"

},

You should ask @anon61068208 to fix it.

1 Like

That's fair, Thank you for the pointers @bravenel.

@anon61068208
I managed to get the temperature to work properly for what I needed by adding the following below line 577

temperatureRaw1 = temperatureRaw1.replace("°F", "")

Not sure the best way to clean all those up, but that's the only one I really wanted to work right now.
Hopefully if you have a few minutes or hours to poke at it, you might be better suited to a proper fix.

I'm happy to test if you need someone.

Thanks!