Rpi_to_xml.py 402 Bytes
#!usr/bin/env python

import serial
from lxml import etree

xml = etree.parse('111-1.xml')

ser = serial.Serial("/dev/ttyACM0", 9600, timeout=1)
value = ser.readline()

for parametre in xml.getchildren():
    if 'name' in parametre.attrib and parametre.attrib['name'] == 'data':
        parametre.text = value
with open('111-1.xml', 'w') as myFile:
    myFile.write(etree.tounicode(xml))
myFile.close()