I am attempting to create a rule to dynamically adjust the fan speed when CO2 measurement reaches a certain value. I think my problem is that the measurement from my NetAtmo returns “xxx ppm” and not just a number. How can I strip out “ppm” from the returned string/value?
Thanks in advance
Item ‘MainIndoorStation_CO2’ changed from 666 ppm to 630 ppm
2021-11-07 11:40:58.721 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘AdditionalModuleGryogVilde_CO2’ changed from 571 ppm to 568 ppm
rule “Adjust Fan Speed”
when
Item AdditionalModuleMasterBedroom_CO2 changed
then
val Measurement = AdditionalModuleMasterBedroom_CO2.state as DecimalType
Thread::sleep(5000)
val threshold1 = 690
Thread::sleep(5000)