Prowl - Send value instead of just text

Hi All,

I’m using Prowl for sending notifications. That bits is all working well.

What I want to be able to do is send varibles rather than just fixed messages. See here.

pushNotification("Analog Value A Device GA", "Value has changed")
val anaa = (xrf_anaa.state as DecimalType).intValue
pushNotification("Analog Value A Device GA", anaa)

I want to send the value of anaa which is an int. I’m getting this error.

Error during the execution of rule ‘Analog GA A’: Cannot cast org.openhab.core.library.types.StringType to org.openhab.core.library.types.DecimalType

Any help would be greatly received.

Many thanks

T

You can only send Strings so you have to convert anaa to a String. You might be able to do something as simple as

pushNotification("Analog Value A Device GA", xrf_anaa.state.toString)

If the value is a float you may need to do something like the following to trip off the decimal:

pushNotification("Analog Value A Device GA", Integer::toString((xfr_anaa.state as DecimalType).intValue)

@rlkoshak, thank you once again. Had this question and immediately found your reply. You have been a tremendous help over the years. Very much appreciate your support.