sendEvent with isStateChange=true not forcing event refresh?

I'm trying to show an SVG image as an attribute of a device. If the SVG were less than 1024 characters, I could just cram all of the SVG into the value of the attribute itself (even though hubitat staff would cringe at it). In an attempt to skirt the 1024 character limit, I am rendering the SVG at a cloud endpoint and setting the attribute value to be an img tag that references the endpoint. So:

device.sendEvent(name:"attribute", value: "<img src=\"${endpointUrl}\"/>", displayed: true, isStateChange: true)

This works just fine, mostly. The image shows up as an attribute and all seems to be well until the image is changed. Those image changes are not being pushed / recognized by the hub as events to be updated. This remains the case even though I am sending the event with isStateChange set to true. Is that not supposed to force the hub to refresh the attribute's value even if its content hasn't changed (since the cloud endpoint hasn't changed)? I even tried putting in a random number as the id of the img tag, to try to trick the hub into thinking something had changed. Or maybe it's forcing the hub to send the event, but the browser is caching the previous image? What do you think?

This is likely your issue. Add a something like "?version=34"
(where 34 would be a new number each update) to the end of the URL so that it changes.

2 Likes

That did it! Thanks!

1 Like