Input a xml structure from a remote data logger

Hi all :grinning:
how can i use a xml structure from a rermote data-logger in emoncms ?
is it possible? the logger has an api and i get the following result as xml:

    <name>Temperatur Batterie</name>
                <date>03.05.2020 00:02:01</date>
                <date>03.05.2020 08:12:05</date>
                <date>04.12.2015 07:23:21</date>
                <date>14.01.2020 13:24:11</date>

i would like to show the temperatur in emoncms. emoncms is installed on raspberry.
Thanks in advance!


This text will be hidden


This text will be hidden

Edit by Mod to format XML

Hi Johann, welcome.

No there isn’t. You would need to process it first; Node-RED and Home Assistant have some builtin methods. Alternatively a Python script.

Have you looked to see if there is an option to tell the API to give you the data as JSON? Even then it will need processing into Key:Value pairs.

Hi Brian, first, thanks for the feedback. currently i convert the xml request into a json format with a php function. Now when i call the covert-script, the output is the following:

{“sensor”:{“id”:“104”,“name”:“Temperatur Batterie”,“current”:“23.81”,“unit”:"\u00b0C",“minmax”:{“today”:{“min”:{“value”:“21.81”,“date”:“03.05.2020 08:32:47”,“timestamp”:“1588487567”},“max”:{“value”:“23.87”,“date”:“03.05.2020 12:21:01”,“timestamp”:“1588501261”}},“absolute”:{“min”:{“value”:“13.50”,“date”:“04.12.2015 07:23:21”,“timestamp”:“1449210201”},“max”:{“value”:“32.43”,“date”:“14.01.2020 13:24:11”,“timestamp”:“1579004651”}}}}}

but how can i make a input in emoncms?
Many Thanks! Regards Johann

On the ‘Inputs’ page, top right,
Click on the API help.

You can either input via MQTT or HTTP API.

Both will take a JSON structure - the structure is listed there.


Time can be in epoch format as you have. If you do not specify a time, the received time is used.

MQTT topic format is emon/node/sensor

ah ok, thanks! i try with the url:

but the request failed with the message:
{“success”: false, “message”: “Input in not a valid JSON object”}

Do you have an idea whats wrong?

Yes, unless you changed the data above it does not match the required structure!



I am not sure this will work… although interesting if it does.