This plugin returns the value that belongs to a key from a file with lines in the form KEY=VALUE. It was written by Jonathan Hudson for the w1retap weather station logging software (1-Wire sensors), but it can be used with every file in this format.
| w1retap::readkey(file, key) | returns the value of key from file |
A file /tmp/.w1retap.dat with this content
OTMP0=12.34 C OPRS=1013.25 hPa
and this configuration
Variables {
tick 120000
file '/tmp/.w1retap.dat'
}
Widget Temp {
class 'Text'
expression w1retap::readkey(file, 'OTMP0')
prefix 'Extr '
width 10
align 'L'
update tick
}
Widget Press {
class 'Text'
expression w1retap::readkey(file, 'OPRS')
prefix 'Pres '
width 10
align 'L'
update tick
}
will display 'Extr 12.3' and 'Pres 1013'.
For other files in the form key=value see also file::readconf() of the file plugin.
No external libraries. The plugin is selected at build time with –with-plugins=w1retap (it is part of 'all').