device.replacePluginPropsOnServer and device restarts

Posted on
Mon May 11, 2020 2:04 pm
neilk offline
Posts: 342
Joined: Jul 13, 2015
Location: Reading, UK

device.replacePluginPropsOnServer and device restarts

Hi all,

This may well fall into the "bleeding obvious" category but it did cause some head scratching for me. I have chosen to store a JSON response from the energy provider API using dev.pluginProps rather than a device state. I was getting a strange behaviour with unintended device restarts that were messing with my logic, but that of course did not generate any errors because it was working as designed. I eventually figured it out by trawling through the forum and was reasonably happy to find out it had confused those considerably smarter than me. The solution was to add the didDeviceCommPropertyChange to define which properties warrant a device restart, and conveniently the sample in this thread matched the "address" field I used for the UK Postcode.

This thread below explains the rationale perfectly, and every day is a school day !

I thought it may be worth bubbling this one up in cases it catches any other fledgling plugin developers.


Page 1 of 1

Who is online

Users browsing this forum: No registered users and 0 guests