Nodes Meta CSV-Set¶
Save CSV data to node metadata at a specific metadata key path. CSV metadata is often used for tariff schedules in SolarNode, such as tariff schedule expressions.
Usage¶
s10k nodes meta csv-set [-s] [-mode=<displayMode>] -node=<nodeId>
[-path=<metadataPath>] [<csv>]
Options¶
Output¶
A success message. If the --verbose
option specified then this will be followed by a
pretty-printed copy of the saved CSV data, formatted according to the --display-mode
option.
String mode¶
The --string
option lets you encode the CSV data as a metadata string value, rather than
the default method of encoding it as arrays. For example take this sample CSV data:
Month,Day,Weekday,Time,cpdPeriodActive
"Jan-Apr,Oct-Dec",,,,0
May-Sep,,,,1
Here is how it would be saved as metadata at the key path /pm/cpd/schedule
normally, and with the
--string
option:
{
"pm" : {
"cpd" : {
"schedule" : [
[ "Month", "Day", "Weekday", "Time", "cpdPeriodActive" ],
[ "Jan-Apr,Oct-Dec", null, null, null, "0" ],
[ "May-Sep", null, null, null, "1" ]
]
}
}
}
{
"pm" : {
"cpd" : {
"schedule" : "Month,Day,Weekday,Time,cpdPeriodActive\r\n\"Jan-Apr,Oct-Dec\",,,,0\r\nMay-Sep,,,,1"
}
}
}
Examples¶
The data to save can be provided directly as a command argument, for example:
s10k nodes meta csv-set --node-id 101 \
--path /pm/cpd/schedule 'Key,Value\nA,B'
A file with the data can be referenced using @@
followed by the file path:
s10k nodes meta csv-set --node-id 101 \
--path /pm/cpd/schedule @@/path/to/data.csv
The data can be read from standard input, like this:
s10k nodes meta csv-set --node-id 101 \
--path /pm/cpd/schedule </path/to/data.csv
Similarly, the metadata content can be piped to the command, like this:
cat /path/to/data.csv |s10k --verbose --profile demo nodes meta csv-set \
--node-id 101 --path /pm/cpd/schedule --display-mode JSON
CSV saved to to path [/pm/cpd/schedule].
[
[ "Month", "Day", "Weekday", "Time", "cpdPeriodActive" ],
[ "Jan-Apr,Oct-Dec", null, null, null, "0" ],
[ "May-Sep", null, null, null, "1" ]
]