Conversation
FindParams and ebusd_find split the telnet answer on line breaks AND commas:
const datas = str.split(/[\r?\n,]+/);
const names = datas[i].split(",");
The first split already flattens "ehp,Name\nehp,Other" into single tokens, so
the following split(",") finds nothing left and names[1] is always undefined.
FindParams therefore returned every entry with name undefined and the message
names sitting in the circuit field, plus one stray entry holding the bare
circuit. ebusd_find passed undefined as both name and comment to UpdateDP.
The admin compensated by reading item.circuit, which is why the polled
datapoint list still looked right.
The character class also contained "?" as a literal, so a message name
containing one got torn apart as well.
Splitting on line breaks only restores the pairing. The empty-entry filter
starts working too - it compared undefined to "", which is false in JS.
In ebusd_find the comment is now taken as the last field instead of the third
one: ebusd quotes it when it contains a comma, and 27 of 354 lines do.
Verified against ebusd on a real installation: 184 lines for "find -c ehp -F
circuit,name" now yield 147 unique {circuit, name} pairs, all names populated,
no stray entry. For "find -F circuit,name,comment" all 347 datapoints get
circuit, name and the full comment.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
FindParamsandebusd_findsplit the telnet answer on line breaks and commas:The first split already flattens
ehp,Name\nehp,Otherinto single tokens, so thefollowing
split(",")finds nothing left andnames[1]is alwaysundefined.FindParamsreturns every entry withnameundefined and the message namessitting in the
circuitfield, plus one stray entry holding the bare circuit.ebusd_findpassesundefinedas both name and comment toUpdateDP.The admin compensates by reading
item.circuit, which is why the polled datapointlist still looks right today — that is what kept this hidden.
The character class also contains
?as a literal, so a message name containingone gets torn apart as well.
Change
Split on line breaks only. That restores the pairing, and the existing empty-entry
filter starts working too — it compared
undefinedto"", which isfalsein JS.In
ebusd_findthe comment is now taken as the last field instead of the thirdone: ebusd quotes it when it contains a comma, and 27 of 354 lines in my
configuration do.
QueriedDPSettings.tsxswitches toitem.name, which is only correct once thebackend fills it.
Verified against a running ebusd
find -c ehp -F circuit,name, 184 linesnamepopulated 0×namepopulated 147×ebusd_find→UpdateDPundefinedNote on the build output
This PR touches sources only. Rebuilding here rewrites
admin/index_m.htmlandsrc-admin/build/index.htmlalmost entirely because the committed files use CRLFwhile the build writes LF — 148 lines of churn for one changed asset reference.
Happy to add the build output if you prefer it in the same PR.