Implementing SPL (Sound Pressure Level) in ST - Code change required

Today I tried to implement a Sound Meter in Smartthings. I implemented it using the ‘Parent_ST_Anything_Ethernet’ which worked, i could see the dBA Sound Level events, but no child device was created. After some googling & GitHub I found that there was a Child DH for Sound in HubDuino but not ST:
https://github.com/DanielOgorchock/ST_Anything/blob/master/HubDuino/Drivers/child-sound-pressure-level.groovy

I created the about DH in Smartthings but the child device still did not create. After a bit of code rummaging I found the parent-st-anything-ethernet did not have a Switch/Case for Sound
https://github.com/DanielOgorchock/ST_Anything/blob/master/devicetypes/ogiewon/parent-st-anything-ethernet.src/parent-st-anything-ethernet.groovy

I added this to the Parent_ST_Anything_Ethernet Device Handler

			case "soundPressureLevel": 
            		deviceHandlerName = "Child Sound Pressure Level" 
            	break     

And it works:

Thought I’d share, in case anyone else wants to implement the sound pressure level.

@ogiewon - thought you might want to know, in case there is a GITHUB update required,

:slight_smile:

2 Likes

Thanks @Levanterman. I have updated the ST Parent DTHs as well as added a Child DTH for Sound Pressure. I have not tested these changes yet, but they are all in GutHub… :wink:

1 Like