Xml file as datasource
-
Hi,
i upgraded my old server (nagasaki ms2100) to a laptop with ubuntu
Mango runs so smootly i realy love it.
The pachube option is realy realy niceI want to import the live data from my solarpanels
The logging program of the solarpanel sunnydatacontrol
make's an xml file with live data.How do i use that file as a data source
Kind regards
Sprokkie -
Hi Sprokkie,
Well, you have a couple options:
-
You can write a data source that finds (somehow) the xml files and loads the data in. Currently the creation of a data source is not trivial, but we (Serotonin) are seriously looking into how this can be simplified.
-
You can write some utility that converts the data into something that Mango can already accept. For example, a process could locate the xml files, parse them, and then put the data into a HTTP POST request that sends to Mango's HTTP receiver data source.
-
-
Hi mlohbihler.
The get and post ( option 2 ) is far out of my league.
For displaying the live data,
I made a staticcontent point in a view and put a simple xml to colum code in it and that did not work.The solarpanel has also a server that wil send the data to an java applet.
this is how that works:
In a static contens i place the code that loads a java applet from the tomcat root dir, that java applet connects to the server and displays the data
So displaying is possible, but not from all computers, some computers don't display the java applet, or a firewall prevents the connection to the server.Maybe that server and java applet can be used for a datasource.
The program i use for the solarpanels is sunnydatacontrol 3.9.3 and the SDCagent both programs are from sma.
It would be a big help if you can give a big push in the right direction for the post and get option.
cheers
Sprokkie -
It would be possible to create a data source that could connect to the server just like the Java applet does, but the protocol that is used would need to be known. Ideally SMA would make the source code of the applet available for refactoring.
Regarding transforming and posting the xml data, if you need help with this you can get support from Serotonin. Use the Contact Us page.
-
I am parsing XML from my TED (The Energy Detective) home energy monitor. A screen shot from my data source is attached. Basically, you need to know the structure of your XML and then have Mango go look for data using HTTP retriever and a little code that finds the data. Not complicated really.
Attachment: download link
-
Hi,
i tried your example but that did not work for me.
below is the xml file<OnlineData>
<Date>28.09.2010</Date>
<Time>08:51:30</Time>
?
<Devices>
?
<Device>
<Name>WR11E-06 SN:673710652</Name>
<SerNr>673710652</SerNr>
<PositionX>0</PositionX>
<PositionY>0</PositionY>
<PerformChanName>Pac</PerformChanName>
<Perform>0</Perform>
<ColorCount>90</ColorCount>
?
<Channels>
?
<Channel>
<Name>Vpv</Name>
<Value>150</Value>
<Unit>V</Unit>
</Channel>
?
<Channel>
<Name>Vpv-Setpoint</Name>
<Value>439</Value>
<Unit>V</Unit>
</Channel>
?
<Channel>
<Name>Iac</Name>
<Value>0</Value>
<Unit>mA</Unit>
</Channel>
?
<Channel>
<Name>Vac</Name>
<Value>224</Value>
<Unit>V</Unit>
</Channel>
?
<Channel>
<Name>Fac</Name>
<Value>49.98</Value>
<Unit>Hz</Unit>
</Channel>
?
<Channel>
<Name>Pac</Name>
<Value>0</Value>
<Unit>W</Unit>
</Channel>
?
<Channel>
<Name>Zac</Name>
<Value>0.000</Value>
<Unit>Ohm</Unit>
</Channel>
?
<Channel>
<Name>Riso</Name>
<Value>0</Value>
<Unit>kOhm</Unit>
</Channel>
?
<Channel>
<Name>Ipv</Name>
<Value>23</Value>
<Unit>mA</Unit>
</Channel>
?
<Channel>
<Name>E-total</Name>
<Value>830</Value>
<Unit>kWh</Unit>
</Channel>
?
<Channel>
<Name>h-total</Name>
<Value>4698</Value>
<Unit>h</Unit>
</Channel>
?
<Channel>
<Name>Power On</Name>
<Value>796</Value>
<Unit/>
</Channel>
?
<Channel>
<Name>Serial Number</Name>
<Value>673710652</Value>
<Unit/>
</Channel>
?
<Channel>
<Name>Mode</Name>
<Value>waiting</Value>
<Unit/>
</Channel>
?
<Channel>
<Name>Error</Name>
<Value>Riso</Value>
<Unit/>
</Channel>
</Channels>
</Device>
</Devices>
</OnlineData>ill think ik need a differend code to find the data.
regards
Sprokkie -
Your XML is similar to mine with the exeption that I DO NOT have any duplicate lines. What I mean is the you have multiple things called <value>. Mine are all unique. Maybe someone else cold help you out with the code for that. I am not a code writer!
You MUST make sure your URL is correct or the HTTP receiver will not even be able to find your XML. It took me a while to figure mine out. I had to go digging deep in the TED documentation.
This definitely should put you on the right track though.
-
With your example i was able to get some value's
Only the nested value's did not work. -
i found a csv file that had the same data
With the trick you showed me i get the data from that file.thx for pushing me t he right direction.