-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
All over in the code are blocks like:
const splitStr = orderStr.split('_');
const id = splitStr[1];
const attribute = splitStr[2];
const events = graphData[id][attribute];
This breaks if your device has a parameter like production_energy_today. Most likely creating an "order string" like this is just a bad idea. Instead of concatenating multiple values into a string, why not just pass multiple values around or even a JSON object?
But I think in many cases a brittle fix might be something like const attribute = splitStr.slice(2).join('_') which will re-construct the original attribute name. This works so long as "attribute" was the last item in the order string (eg it'll work for attribute_38_consumption_energy_today but won't work for things like attribute_consumption_energy_today_38)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels