MH10-PM2.5 Driver help

Hey all

As I have mentioned before and will again at the risk of being redundant... I am not a developer :slight_smile:

Sure could use some help to get an MH10-PM2.5 Air Quality sensor working. @matt_k has been very supportive however he/I feel additional eyes on this might be beneficial and thought a new thread for this device type was appropriate

Here is the error I'm getting when using this code
https://pastebin.com/raw/Zmvf3T96

Not currently seeing the air quality value in Current States but do see Temp/Humidity
image

Here is the device signature

Anything else I can provide?

Thanks for any/all help
:slight_smile:

The only toInteger on line 273 is factoryReset.toInteger(), error says it doesn't have a value

        zwave.configurationV1.configurationSet(parameterNumber: 255, size: 1, scaledConfigurationValue: factoryReset.toInteger()),

Only place it gets set is in Preferences. It does have a default value of zero, but doesn't seem to have used that value in this instance. A quick fix would be to insert a statement similar to:

if (factoryReset == null) factoryReset = 0

prior to line 273

Thanks for jumping in :slight_smile:
Results if I understand the edit correctly

Try moving the if to line 259

No errors... yaaaaah

Now to expose the Air Quality Value so it can be used in Rules
image

1 Like

Anyone willing to take on getting the air quality value exposed to HE?

Pretty please :slight_smile:

I don’t see where you are storing state, but it looks like at line 162 map.value contains the value you want.

@thebearmay Thanks for helping out! I've done some work on this driver, based on an existing driver (see credits in code), but am far from a developer.

My experience to get the MH9 device to report all information is to check the debug logs (don't forget to enable debugging first) for additional sensor information. There is debugging in the code that will show all values and it will make it easier to identify the correct sensor type for air quality. Since Hubitat does not support a capability "Air quality" I've set it to CarbonDioxide to report the value.

Don’t have a device to test against, but have you seen anything in the logs from Case 17 lines: 157-164? Looks to me like those lines, if ever activated, would store a value for carbonDIoxide (you could actually change that to something like airQuality and not break anything).

If you’re not seeing anything there, are you seeing anything in the descriptionText driver state? (If so, you may want to add another debug line to write to the log in case there are multiple values coming through.)

With the addition of the If statement, I now see debug info in the log


Does this help?

Hmmmmm not seeing a response from 17, but you are getting one from 35.... what happens if you change case 17 to case 35, i.e. do we get a valid value?

Sure wish I spoke greek... LOL

I updated line 279 and 292 from 17 to 35 - did I get that right?

Edit above reflects both lines changed to 35

one more place, was about line 157

old:
case 17:

new
case 35:

I told you I know nothing about coding... LOL

What does the device page look like now, i.e. is there a value for carbonDioxide?

No, not yet

LOL. Think I found the issue, Case 35 is commented out...

Change (~line 156)
/* First check which sensor ID reports air quality

to
// First check which sensor ID reports air quality

and Remove the line that reads
*/
before the line that reads (~line 164)
default:

Winner WINNER


Anything else you see in the logs to address?

Looks like it's working. Like I said earlier, if you want to change carbonDioxide to airQuality or something else it won't break anything.

TY Soooo much and a big thanks to @matt_k for getting this started and the great work he put into it

Enjoy your HE'd life :slight_smile: