Convert the Pollen Index from the Device Handler Virtual Sentor to an Illuminance Number in a Virtual Device that has Illuminance Capability

I am trying to convert the Pollen Count number from a Pollen count Device Handler to a Lux number through use of Webcore. The reason for this is I want to have my Actiontiles have a tile that displays the Pollen count in a Decimals format, not just a whole number. Actiontiles does not have a Pollen Count capability, but it does have illuminance.
I already have converted the Pollen Count index measurement to a temperature capability, but that only gives me a whole number, no decimals.
Any way to convert the Pollen Count (which does display decimals to a device that will show decimals)? Either through webcore or some other means?

See if you can use the image generator discussed in this link…

As far as I can see, SmartThings doesn’t actually have a standard pollen count capability so ActionTiles has little to work with. I didn’t know there was a standard unit anyway.

If you have the code for the device handler it seems easier to just add the temperature or illuminance capability to it and create the attribute at source. Both capabilities are defined to allow decimal numbers.

So in trying to make the Pollen Count (which does create a number with decimals in Smartthings) but not usable by Actiontiles, are you suggesting to change the Pollen count Device Handler, or somehow change the Virtual Device I am using which I used Smartthings Virtual Temperature Sensor as the device type to at least get a number from the actual Pollen Count device? When I capture the attribute from the Pollen Count it’s capturing Pollen Count’s index. That’s when somehow there is no longer a decimal being returned.
Here is what probably pertains in the Pollen Count device handler:
definition (name: “Pollen Virtual Sensor”, namespace: “jschlackman”, author: “”) {
capability “Sensor”
capability “Polling”

attribute “index”, “number”
attribute “category”, “string”
attribute “triggers”, “string”
attribute “location”, “string”

What would you suggest that could be added/changed to possibly make this work with ActionTiles? Would there need to be any other input information somewhere else in the code?

I seem to remember the Simulated Temperature Sensor only uses integer values, presumably because that’s what whoever created it found most useful for test purposes. I am actually suggesting changing the pollen sensor slightly and getting rid of the virtual/simulated intermediary completely.

Yes, what you have there is a device that defines two standard capabilities, ‘Sensor’ (which is a deprecated but still useful capability that just means the device has attributes), and ‘Polling’ (a deprecated capability that says the device has a ‘poll’ command - I believe it was once called at fixed periods but I am not sure if that still happens).

The device handler then creates four custom attributes to handle the pollen count. That is purely the author’s invention. Many apps won’t be able to read them because they only work with standard capabilities. Some apps, like webCoRE, try a bit harder and can read them.

What I am suggesting is that you add:

capability "Illuminance Measurement"

after the other two capabilities, and then go down to what was line 130 where it says send( name: "index", value: period.index ) and add the line:

send( name: "illuminance", value: period.index )

Save and publish that and it should make your device handler look like an illuminance sensor with values matching the pollen index.

I can’t promise it will behave nicely in the new app, but that can be fixed if needed.

I did update the Device Handler as you suggested. Thanks. I am able to see a new device I called PollenNew, and in Smartthings list it is there with a value in it. Actiontiles tile comes up on the dashboard with a tile but no data in it.
Here is what I am trying to do in webcore to populate data so that Actiontiles can use it:
Any suggestions would be deeply appreciated

Device Handler updated:

You shouldn’t need anything in webCoRE at all. The illuminance should update whenever the pollen index does. Unless I missed something.

the original Device Handler does not check for any illuminance. The problem is the device value for Pollen is not compatible with Actiontiles capabilities. That is why I thought I could just get a value from one attribute and use it in another attribute that Actiontiles recognizes.

Yes, you can define a separate virtual device handler with a capability that ActionTiles recognises and then use webCoRE to subscribe to the changes in the pollen attribute and run a command to set the value in the virtual device. Nothing stopping you doing that if you want.

I was just suggesting you turn the pollen sensor into something that ActionTiles recognises and then you wouldn’t need the virtual device or webCoRE to help you out. With the changes I suggested the illuminance matches the pollen (as long as you update the device or wait up to an hour for the next poll).

* [illuminance]: 4.0
* [index]:       4.0
* [category]:    Low-Medium
* [triggers]:    Ragweed, Grasses, Chenopods
* [location]:    Phoenix, AZ

It displays in ActionTiles but the tile can’t be configured to remove the unit from the bottom and also isn’t showing the decimals, so it may be a poor choice.

Thanks, I noticed that Actiontiles did the same to mine with Illum Lux on the bottom even though my tile was blank for the number. How did you get the tile to display the number? In what way did you create the device? Can you send me the steps or code etc? I really appreciate the help you have provided.

Ah I see what might have happened. I had tired eyes when I gave the instructions in post 5. It should have said to add the line:

send( name: "illuminance", value: pollen.Index)
                                         | Should be uppercase

You might need to make the device update, either via the IDE or changing the settings, just to make sure a new pollen index has been fetched.

That did it!! I updated the Device Handler and reran the webcore piston and it populated the value into Actiontiles tile. It still is with lux on the bottom, but that is better than a degree icon above the number. The actual value here is 2.5, so Actiontiles does not allow for decimals on lux tiles, so at 2.5 the Pollen Count is 3 (no big deal). Thanks ever so much!


FYI, as of yesterday Actiontiles is allowing you to have the ability to include or not include units like temperature or lux etc:
The feature to hide units is available for the following Tiles:

Temperature Measurement
Relative Humidity Measurement
Energy Meter
Power Meter
Carbon Dioxide Measurement
Illuminance Measurement
Ultraviolet Index
Sound Pressure Level
Voltage Measurement