Rule Machine - Ignoring attribute null value

I have a Samsung TV connected to HE via ST. One of the attributes of the TV is the TvChannelName which shows the current running app (e.g. Netflix, Hulu). When no app is running (so watching a HDMI source), this attribute shows null in the device page. However, in rule machine, the attribute still shows the previous value just before it became null.

For my RM triggers and actions, I need to be able to track when no app is running. Please how do I fix this?

Thanks

Also worth noting that it appears that after some time, HE replaces the null value on the device page with the previous value.

Rule Machine is not going to show a null value for an attribute. It's not a valid value. This needs to be addressed in the driver.

Thanks...

Any guidance on how to deal with it in the driver? Should I add in a check for nulls and translate it to a value?

Yeah, something like that. The attribute should always have a value, so you should come up with a value such as "noAppRunning", that you can test for in RM.

I also don't understand why null isn't a valid value for an attribute. Null means null i.e. the attribute has no value. But I see that others have tried to fight this battle and HE has refused to change it so that's not about to happen here.

Apps need to distinguish between non-values (i.e. null) and values. Null means no value. RM 'custom attribute' is looking for a value. Is that so hard to do? This isn't ST.

You should also be aware that the hub does not send events with null values.

It's actually come up with a couple of the drivers (LG TV) and this. Would have been nice if in RM, we could say if the custom attribute is null, do xxx.

Was just saying that in most other platforms, null is a valid value (not just ST). Thanks for the info though. Would work around it.

Since the hub won't send a null value in an event (something that indeed is not going to change since it's meaningless and opens up all sorts of other error situations), how can RM be expected to look for a null value?

If it's come up in other drivers, that's probably because those drivers were developed against some other hub, not this hub. It's irrelevant what other hubs do.

Null has its importance in code, including RM, the hub, drivers, and elsewhere. It means: there is no value for this object. An attribute carries meaning, and in your case that meaning isn't "null", it is "no app is running". If you want to convey that meaning, then send that value.

For me, the tv channel name is not "no app is running". It's blank meaning this attribute doesn't have a value right now because there's no tv channel. Different ways of thinking I guess

"no tv channel ". That has meaning. Null does not have meaning, just interpretation by code. What kind of UI would present "null" as something a user should understand what to do with?

Sounds good. We'd agree to disagree. Thanks though!

@bravenel So I'm using HubConnect to get my TV state from ST. According to the HubConnect guys, there's no way to modify the attribute value. So if it comes in with a null from ST, I can't change it.

Please anything else I can do here? Hoping to be able to track the current app running (and if no app is running) on the TV for my automations.

Thanks

You're running a driver on the Hubitat side. You have to fix it there.

Had to read up a bit on the HubConnect API and code to figure it out. Made the change now to handle nulls though

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.