Skip to content

Fix for PM25 converter ClassCastException#938

Open
HubbleAstroid wants to merge 2 commits into
openhab:mainfrom
HubbleAstroid:main
Open

Fix for PM25 converter ClassCastException#938
HubbleAstroid wants to merge 2 commits into
openhab:mainfrom
HubbleAstroid:main

Conversation

@HubbleAstroid
Copy link
Copy Markdown

Minor change to handling double value from PM25 to fix Ikea PM2.5 monitor which causes java.lang.ClassCastException.

updateChannelState(new DecimalType(Math.pow(10.0, (Integer) val / 10000.0) - 1));

double pm25Value = ((Number) val).doubleValue();
updateChannelState(new DecimalType(Math.pow(10.0, pm25Value / 10000.0) - 1));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to make this all a single line to avoid creating the varialbe pm25Value

@cdjackson cdjackson added the bug label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants