Correct, the socket interfacer is a very basic input that accepts a space separated string of values
No, not easily, you would need to alter a significant amount of emonhub code to do that.
What you could do is add an entry to emonhub.conf [nodes] section under the node id you have chosen for your temp sensor node and either use the names = line for the ids if you wish to use the ids as mqtt topics and input names or add another line “ids =” which emonhub would ignore and get your script to read the emonhub.conf directly. The emonhub.conf can already be edited via the emoncms web pages.
eg1 (using example settings from earlier in this thread)
[[30]]
nodename = sockettest
[[[rx]]]
names = abcd1234
units = C
would publish the temp value to a mqtt topic and input name of “abcd1234” whilst your script could also read the emonhub.conf and use the “names =” line as the list of ids, or
eg2
[[30]]
nodename = sockettest
[[[rx]]]
names = val_A
units = C
ids = abcd1234
keep them seperate, where the name is used for mqtt topic and input name whilst the ids line is read by your script to read and position the values, emonhub would ignore the additional line and it could all be edited/maintained via the emoncms emonhub config page.
The config file is read using the ConfigObj Python module, which is already installed and functional if emonhub is working.
Something like
from configobj import ConfigObj
list_of_ids = ConfigObj(/path/to/emonhub.conf)['nodes']['30']['rx']['ids']
for id in list_of_ids:
# do something with id
might work (untested) I do not know for sure that 2 scripts can access the same file, but unless you add some code to pick up changes whilst running, your script will only read the file when started.
You have 2 options, add some code to your script to check the conf every n seconds and potentially experience clashes with emonhub and/or emoncms (might well be fine though) OR if changes are going to be infrequent you can restart your script some how to pick up the changes.