An error occurred during the script execution: index=1, size=1

Hi guys,

I’m trying to send a notification when a temp sensor drops below a certain number but am getting this error?

An error occurred during the script execution: index=1, size=1

rule “Master Bedroom Temperature Alerts”
when
Item Master_Bedroom changed
then
if (Master_Bedroom.state > 22) {
sendPushbulletNote(“Master Bedroom Temperature above 22°”)
}
else if (Master_Bedroom.state < 18) {
sendPushbulletNote(“Master Bedroom Temperature under 18°”)
}
end

Ps Where have the code fences gone?

cheers
Matt

Is Master_Bedroom using UoM? Either way, you will need to cast it’s state to Number or QuantityType. If the latter, the value you are comparing to needs to also be a QuantityType.

They are still there, just invisible. It is easier to just put an empty line, then ``` on the line before and after your code or log.

1 Like

thanks for your reply, any chance of an example? as nothing is working.

There are lots of examples in the forum. Documentation has some too.

if (Master_Bedroom.getStateAs(QuantityType) > 20|°C) {

cheers fella,

i was close but miles away…

1 Like