Config XML
This is how my XML should look like, as you can see i am very dependent on attributes. I got different objects: sensors having evaluation rules (could be two nodes wired together) and rules consisting of a trigger and a condition.
<sensor_configuration>
<sensors>
<sensor sensor_id="cloud_connected">
<sensor_class>unknown</sensor_class>
</sensor>
<sensor sensor_id="Vibration_Alarm">
<sensor_class>boolean</sensor_class>
<unit/>
<state_evaluation_expressions>
<state_evaluation_expression>
<expression>value</expression>
<true severity="200">Vibration alert</true>
<false severity="0">OK</false>
</state_evaluation_expression>
</state_evaluation_expressions>
</sensor>
<sensor sensor_id="Ventilator">
<sensor_class>boolean</sensor_class>
<unit/>
<state_evaluation_expressions>
<state_evaluation_expression>
<expression>value</expression>
<true severity="100">ON</true>
<false severity="0">OFF</false>
</state_evaluation_expression>
</state_evaluation_expressions>
<sensor_gateway sensor_gateway_id="gw_X20DO6639_coils_2">
<demux>
<keys>
<key>24</key>
</keys>
</demux>
</sensor_gateway>
</sensor>
</sensors>
<ac_rules>
<rule rule_id="Raise_cumulative_alarm">
<triggers>
<trigger sensor_id="Temp_Alarm" trigger_topic="calibrated_result" value_name="temp_alarm" value_type="boolean"/>
<trigger sensor_id="Door_Alarm" trigger_topic="calibrated_result" value_name="door_alarm" value_type="boolean"/>
<trigger sensor_id="Vibration_Alarm" trigger_topic="calibrated_result" value_name="vibration_alarm" value_type="boolean"/>
</triggers>
<conditions>
<condition expr="door_alarm or temp_alarm or vibration_alarm">
<true>
<result_list>
<result result_value="True" sensor_id="Alarm" value_type="boolean"/>
</result_list>
</true>
</condition>
</conditions>
</rule>
</ac_rules>
</sensor_configuration>
[{"id":"bb92a879.13de68","type":"tab","label":"sensor config flow to XML"},{"id":"d1268305.9a67f8","type":"inject","z":"bb92a879.13de68","name":"","topic":"","payload":"Vibration Sensor","payloadType":"str","repeat":"","crontab":"","once":false,"x":283.5,"y":207,"wires":[["62974f13.593028","80689a73.f16e68","54c1cbed.110444"]]},{"id":"62974f13.593028","type":"function","z":"bb92a879.13de68","name":"state_evaluation","func":"\nreturn msg;","outputs":1,"noerr":0,"x":503.5,"y":89,"wires":[[]]},{"id":"80689a73.f16e68","type":"function","z":"bb92a879.13de68","name":"ac_rule","func":"\nreturn msg;","outputs":1,"noerr":0,"x":494.5,"y":148,"wires":[[]]},{"id":"b41d7492.b846e8","type":"inject","z":"bb92a879.13de68","name":"","topic":"","payload":"Temperature Sensor","payloadType":"str","repeat":"","crontab":"","once":false,"x":267,"y":319,"wires":[["54c1cbed.110444"]]},{"id":"34015175.ec001e","type":"inject","z":"bb92a879.13de68","name":"","topic":"","payload":"Door Alarm","payloadType":"str","repeat":"","crontab":"","once":false,"x":282,"y":263,"wires":[["54c1cbed.110444"]]},{"id":"54c1cbed.110444","type":"function","z":"bb92a879.13de68","name":"Condition","func":"\nreturn msg;","outputs":1,"noerr":0,"x":550.5,"y":486,"wires":[["d85ba25a.603d7"]]},{"id":"d85ba25a.603d7","type":"function","z":"bb92a879.13de68","name":"Raise Alarm","func":"\nreturn msg;","outputs":1,"noerr":0,"x":779.5,"y":485,"wires":[[]]},{"id":"7eef4ddb.95b72c","type":"inject","z":"bb92a879.13de68","name":"","topic":"","payload":"My Flow","payloadType":"flow","repeat":"","crontab":"","once":false,"x":252.5,"y":605,"wires":[["541a7079.153b2"]]},{"id":"541a7079.153b2","type":"json","z":"bb92a879.13de68","name":"","x":481.5,"y":604,"wires":[["c7b07b60.c915a"]]},{"id":"c7b07b60.c915a","type":"xml","z":"bb92a879.13de68","name":"","attr":"","chr":"","x":736.5,"y":604,"wires":[[]]},{"id":"37e285bb.a87d92","type":"comment","z":"bb92a879.13de68","name":"Sensor Config Flow","info":"the above represents the sensor configuration. I would then like to export this flow and run it through the below flow that creates json out of the JS objects and finally XMl via xml2json?","x":304.5,"y":152,"wires":[]},{"id":"bc992d63.e949d8","type":"comment","z":"bb92a879.13de68","name":"Create XML from input flow above through xml2json","info":"","x":363.5,"y":564,"wires":[]}][
{
"id": "4ec80b49.c05b24",
"type": "tab",
"label": "sensor config flow to XML"
},
{
"id": "c0242e33.b9e918",
"type": "inject",
"z": "4ec80b49.c05b24",
"name": "",
"topic": "",
"payload": "Vibration Sensor",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 283.5,
"y": 207,
"wires": [
[
"482c456c.68bd04",
"ac65a476.016c9",
"4cf9bc41.620c14"
]
]
},
{
"id": "482c456c.68bd04",
"type": "function",
"z": "4ec80b49.c05b24",
"name": "state_evaluation",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 503.5,
"y": 89,
"wires": [
[]
]
},
{
"id": "ac65a476.016c9",
"type": "function",
"z": "4ec80b49.c05b24",
"name": "ac_rule",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 494.5,
"y": 148,
"wires": [
[]
]
},
{
"id": "1e126b77.18cd1d",
"type": "inject",
"z": "4ec80b49.c05b24",
"name": "",
"topic": "",
"payload": "Temperature Sensor",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 267,
"y": 319,
"wires": [
[
"4cf9bc41.620c14"
]
]
},
{
"id": "ad73cedb.a51cd8",
"type": "inject",
"z": "4ec80b49.c05b24",
"name": "",
"topic": "",
"payload": "Door Alarm",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"x": 282,
"y": 263,
"wires": [
[
"4cf9bc41.620c14"
]
]
},
{
"id": "4cf9bc41.620c14",
"type": "function",
"z": "4ec80b49.c05b24",
"name": "Condition",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 550.5,
"y": 486,
"wires": [
[
"d00307ba.aa3898"
]
]
},
{
"id": "d00307ba.aa3898",
"type": "function",
"z": "4ec80b49.c05b24",
"name": "Raise Alarm",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 779.5,
"y": 485,
"wires": [
[]
]
},
{
"id": "64dea5af.c86b34",
"type": "inject",
"z": "4ec80b49.c05b24",
"name": "",
"topic": "",
"payload": "My Flow",
"payloadType": "flow",
"repeat": "",
"crontab": "",
"once": false,
"x": 252.5,
"y": 605,
"wires": [
[
"f1ecfa72.21fda8"
]
]
},
{
"id": "f1ecfa72.21fda8",
"type": "json",
"z": "4ec80b49.c05b24",
"name": "",
"x": 481.5,
"y": 604,
"wires": [
[
"b547c7a7.690c"
]
]
},
{
"id": "b547c7a7.690c",
"type": "xml",
"z": "4ec80b49.c05b24",
"name": "",
"attr": "",
"chr": "",
"x": 736.5,
"y": 604,
"wires": [
[]
]
},
{
"id": "b70a08b.bc4fb78",
"type": "comment",
"z": "4ec80b49.c05b24",
"name": "Sensor Config Flow",
"info": "the above represents the sensor configuration. I would then like to export this flow and run it through the below flow that creates json out of the JS objects and finally XMl via xml2json?",
"x": 304.5,
"y": 152,
"wires": []
},
{
"id": "8b425a7d.a29128",
"type": "comment",
"z": "4ec80b49.c05b24",
"name": "Create XML from input flow above through xml2json",
"info": "",
"x": 363.5,
"y": 564,
"wires": []
}
]--
http://nodered.org
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+unsubscribe@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/96cb9f4f-4fe8-4512-aa0c-be07773c8fc0%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/ghet3XMxyf4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
To view this discussion on the web, visit https://groups.google.com/d/msgid/node-red/CAF%3DvhqeaAoq5DqPJ_AtcNtfA5fUDDyQMT5Nvi%3Do8y3XhQRMYOA%40mail.gmail.com.