I went to mysql to fix it, somehow I had an input whose nodeid did not exist in the device table.
This is an input I created manually, in the previous version of the emoncms UI… I don’t have precise reproducible steps unfortunately.
I see JS code to try and ask the server to create missing devices, but somehow that didn’t kick in here…
@TrystanLea - yes it goes away.
[edit]
is there a requirement to check and see if there is a device name specified?
[edit2]
Should the devices array be passed here.
I can’t reproduce anymore, but when debugging I did find a funky device (different properties, missing description, and with the message that appears in Brian’s log), which seems to come from device_model.php.
The line Trystan points to assumes that the device is either null or correct, the above breaks that assumption…
That’s definitely the line that triggers the exception, but just commenting it out will still leave you with malformed device objects in the array… so probably a defect waiting to happen
When getting the device list from Redis the code post-processes the array, calling this->get(), and it doesn’t check that that get() call was successful; instead it just inserts an error response in the device array…
… and the code assumes it simply received a deviceId.
The problem is all over the place in device module: several of its functions return either an object (deviceid, device), or an error array (success: false, message: xxx).
And none of the usages of the module are testing for that.
I don’t have time to look into this further, maybe next week…
To reproduce, simply use this:
MariaDB [emoncms]> update input set nodeid='bogus' where id=292;
This is merged in after another merge fixing an issue where the input view did not work if the device module was not installed - hence other changes that might not look familiar.