Author Topic: AquaSuiteWriter - AquaSuite into LCDHost  (Read 26427 times)

RiC0MD

  • Newbie
  • *
  • Posts: 49
AquaSuiteWriter - AquaSuite into LCDHost
« on: 2014-03-16 22:48:35 »
----UPDATE----
With the new release of AquaSuite supporting plugins, I've rewrote the logic into an AquaSuite plugin rather then having to run another app.  See the change notes below for the new zip and where to put the DLL.



---Original post below --
Hi All,

I wrote a simple little C# .NET app that will take the input of aquasuite's XML outputs, and reorganize the XML data into a simplier method that LH_DataViewer for LCDHost can read easily, and _without_ the use of a datamap.

Find attached the exe, you must have the .NET 4.0 runtime libraries installed.

How To Use:
1) Unzip the exe, and place it into the folder where you're saving your XML output.
2) Adjust your AquaSuite output, the filename must contain "aqua-" (minus the quotes) at the start, and not contain -mod (See attached screenshot)
3) Launch AquaSuiteWriter.exe, it will look for all files in its own folder that start with aqua (aqua*.xml)
4) When the program detects changes to the direction on this / these files, it will automatically process them and output them as aqua_yourname-mod.xml

Using the new XML in your LCDHost layout
Now that you should be seeing a new XML with -mod in its name, open it and take a look in notepad.
1) First thing we need is a DataConnector opening the XML and importing the data, if you don't have one in LCDHost, add one and point it to the newly created XML file. (See #2 attached screenshot)
2) Now we need to output the imported data to the layout, using DataViewerText (See screen shot #3).  Going back to our XML, here's how we figure out the Data Template.  In the example here, we're going to be looking at Flow rates:
Code: [Select]
<Sensors>
  <Flowrate>
    <value>132.7</value>
    <valuetype>flow</valuetype>
    <unit>l/h</unit>
    <device>mps</device>
  </Flowrate>
  <Internaltemperaturesensor>
    <value>29.91</value>
    <valuetype>temperature</valuetype>
    <unit>°C</unit>
    <device>mps</device>
  </Internaltemperaturesensor>
  <Externaltemperaturesensor>
    <value>29.24</value>
    <valuetype>temperature</valuetype>
    <unit>°C</unit>
    <device>mps</device>
  </Externaltemperaturesensor>
</Sensors>
Looking at the XML shown above (Modified Output from the program), we want the value of flowrate
<Sensors> <--- Ignore the root node of the XML always
  <Flowrate> <---First node of interest
    <value>132.7</value> <--Value of interest

Based on this our Data Template would look like
{Flowrate.value} which based on the XML would come out to 132.7
If we also wanted the unit of measure from AquaSuite we could do this
{Flowrate.value} {Flowrate.unit} which will give us
132.7 l/h

3) Repeat the above process for all the senor data pieces you wish to display in your layout, and your all set.


Misc Notes:

I would advise not setting AquaSuite to export any less then 10s, doing so causes aquasuite to lock the file so often its hard to open and read it.
The app will automatically fork itself in the background so you don't need to set it up as a scheduled task or anything like that, simply run it and off it will go.  If you want to kill the process off, you can do 1 of 2 things.  1) Execute it a second time, it will detect multiple instances and kill itself and all others off completely 2) Use task manager and find aquasuitewriter.exe and end it.

All this stems from the forum post http://forum.linkdata.se/lcdhost-discussion/lhdataviewer-issues-parsing-xml-746.0.html

Please let me know any issues, or requests, if this worked for you and you wish to donate BTC, you can do so to 1MrKJXEmM7GDaC1puR3wvgFHusCyMRA91g

Thanks all!
« Last Edit: 2014-06-24 22:23:51 by RiC0MD »

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #1 on: 2014-03-16 23:09:53 »
Version
.01 - Fixed a pathing issue
.02 - Uploaded the correct file
.03 - Fixed a possible issue of the watcher never processing the xml files after a random number of runs.  Also added command line -d to invoke a console window with debugging output.
.04 - Added duplicate name checking to avoid using data maps, will now append numbers to the end of the name of duplicate nodes.
1.0 - With the new version of AquaSuite finally allowing plugins, I've ported the code to run directly within AquaSuite and export it in the same format as AquaSuiteWriter did.  This greatly increases speed, and also stops the system from having to read XML just to convert it to XML.  Close AquaSuite 2014 2.3 and then take the DLL from the attached zip and place it into the plugins folder of aqua suite, typically c:\program files\aquasuite\plugins
« Last Edit: 2015-01-15 18:23:33 by RiC0MD »

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #2 on: 2014-03-17 10:38:20 »
Hi there,

i am getting a crash of aquasuitewriter.exe.

Quote
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name=".NET Runtime" />
  <EventID Qualifiers="0">1026</EventID>
  <Level>2</Level>
  <Task>0</Task>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2014-03-17T10:29:06.000000000Z" />
  <EventRecordID>3134</EventRecordID>
  <Channel>Application</Channel>
  <Computer>Gamer-PC</Computer>
  <Security />
  </System>
- <EventData>
  <Data>Anwendung: aquasuitewriter.exe Frameworkversion: v4.0.30319 Beschreibung: Der Prozess wurde aufgrund eines Ausnahmefehlers beendet. Ausnahmeinformationen: System.ArgumentException Stapel: bei System.IO.FileSystemWatcher.set_Path(System.String) bei AquaSuiteWriter.Program.StartWatch() bei AquaSuiteWriter.Program.Main()</Data>
  </EventData>
  </Event>

Quote
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Application Error" />
  <EventID Qualifiers="0">1000</EventID>
  <Level>2</Level>
  <Task>100</Task>
  <Keywords>0x80000000000000</Keywords>
  <TimeCreated SystemTime="2014-03-17T10:29:06.000000000Z" />
  <EventRecordID>3135</EventRecordID>
  <Channel>Application</Channel>
  <Computer>Gamer-PC</Computer>
  <Security />
  </System>
- <EventData>
  <Data>aquasuitewriter.exe</Data>
  <Data>1.0.0.0</Data>
  <Data>53262389</Data>
  <Data>KERNELBASE.dll</Data>
  <Data>6.1.7601.18229</Data>
  <Data>51fb1677</Data>
  <Data>e0434352</Data>
  <Data>000000000000940d</Data>
  <Data>1a4c</Data>
  <Data>01cf41cbb9a408e1</Data>
  <Data>i_deletet_my_path\aquasuitewriter.exe</Data>
  <Data>C:\Windows\system32\KERNELBASE.dll</Data>
  <Data>f75d9beb-adbe-11e3-b922-f46d0457f32f</Data>
  </EventData>
  </Event>

i have .Net Framework 4.51 installed - running Win7 64 bit.

thx ;)

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #3 on: 2014-03-17 14:44:24 »
Hi Micpt,

Please check the second post, and see if that solves the crashing issue, if that doesn't work I'll embed some logging to better determine what the error is.
Thanks!

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #4 on: 2014-03-17 18:47:05 »
Me again,


downloaded the file
unzip
copy to my layoutfolder where also the Aquasuite - XML is (on a second harddisk)
name of Export = aqua-allsensors.xml
executed AquaSuiteWriter.exe with a doubleclick
it takes 10 to 15 seconds then :

Quote
Anwendung: AquaSuiteWriter.exe
Frameworkversion: v4.0.30319
Beschreibung: Der Prozess wurde aufgrund eines Ausnahmefehlers beendet. (The process was terminated due to an exception.)
Ausnahmeinformationen: System.ArgumentException
Stapel:
   bei System.IO.FileSystemWatcher.set_Path(System.String)
   bei AquaSuiteWriter.Program.StartWatch()
   bei AquaSuiteWriter.Program.Main()

Quote
Name der fehlerhaften Anwendung: AquaSuiteWriter.exe, Version: 1.0.0.0, Zeitstempel: 0x53262389
Name des fehlerhaften Moduls: KERNELBASE.dll, Version: 6.1.7601.18229, Zeitstempel: 0x51fb1677
Ausnahmecode: 0xe0434352
Fehleroffset: 0x000000000000940d
ID des fehlerhaften Prozesses: 0xd68
Startzeit der fehlerhaften Anwendung: 0x01cf420f643ca711
Pfad der fehlerhaften Anwendung: F:\APPLICATION\LCDHost\layouts\mic\AquaSuiteWriter.exe
Pfad des fehlerhaften Moduls: C:\Windows\system32\KERNELBASE.dll
Berichtskennung: a32a51ce-ae02-11e3-861e-f46d0457f32f

what i tried:
run AquaSuiteWriter.exe as Administrator
run AquaSuiteWriter.exe in compatiblity mode (Win7)
rename the Auqasuite-XML export file

all ended in a crash.

i am running Aquasuite Version Aquasuite 2014 1.3
Intervall for Export is 30 seconds.


sorry, i can´t provide more help - my skill in c/NET is under zero :(
« Last Edit: 2014-03-17 18:50:32 by micpt »

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #5 on: 2014-03-17 19:18:35 »
Micpt,

Clearly I'm an idiot and I uploaded the same version as the first :)  Give me a few minutes and Ill get the correct one attached.

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #6 on: 2014-03-18 11:49:32 »
Hehe,


could also happend to me ;)

Ok, now the AquaSuiteWriter is running .. also shown running in taskmanager - but i did not get a output-file.

im my Folder there is :

mic.xml - LCDHost Layoutfile
Aquasuite.xml - Aquasuite Export file
AquaSuiteWriter - running as admin and normal

i tried Aquasuite.xml and aquasuite.xml for xml export - no change.
i got no error
waitet 15 min - i can see the Aquasuite.xml is changing all 30 sec. - but i got no aqua_aquasuite-mod.xml (or similar)


RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #7 on: 2014-03-18 14:34:23 »
micpt,

Here's a version that doesn't hide itself and has a bunch of output logging, can you try running this and give me the output from the console window?  What you're describing seems like its not detecting the change, which is rather odd.  Also could you attach the output from AquaSuite so I could take a look?

Thanks!

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #8 on: 2014-03-18 16:37:49 »
Ok .. this time i used the command terminal (cmd.exe)

i got this after starting :

Quote
F:\APPLICATION\LCDHost\layouts\mic>AquaSuiteWriter.exe
Watching path: F:\APPLICATION\LCDHost\layouts\mic\
Checking if already running.
Check complete, starting.
Watching Path F:\APPLICATION\LCDHost\layouts\mic\
^C [this is CTRL+C after 5min of running]
F:\APPLICATION\LCDHost\layouts\mic>

You´re right - he doesn´t recognize the xml or the change

my Export-xml is :

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>

-<LogDataExport xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<name>aquasuite</name>

<exportTime>2014-03-18T17:34:41.8564874+01:00</exportTime>


-<logdata>


-<LogDataSet>

<t>2014-03-18T17:34:41.595</t>

<value>22.79</value>

<name>T-in</name>

<unit>°C</unit>

<valueType>temperature</valueType>

<device>aquaero</device>

</LogDataSet>


-<LogDataSet>

<t>2014-03-18T17:34:41.595</t>

<value>22.51</value>

<name>T-out</name>

<unit>°C</unit>

<valueType>temperature</valueType>

<device>aquaero</device>

</LogDataSet>


-<LogDataSet>

<t>2014-03-18T17:34:41.595</t>

<value>22.92</value>

<name>T-ext</name>

<unit>°C</unit>

<valueType>temperature</valueType>

<device>aquaero</device>

</LogDataSet>


-<LogDataSet>

<t>2014-03-18T17:34:41.595</t>

<value>101.3</value>

<name>I-Flow</name>

<unit>l/h</unit>

<valueType>flow</valueType>

<device>aquaero</device>

</LogDataSet>


-<LogDataSet>

<t>2014-03-18T17:34:41.640</t>

<value>21.8</value>

<name>Wassertemperatur</name>

<unit>°C</unit>

<valueType>temperature</valueType>

<device>aquastream XT</device>

</LogDataSet>

</logdata>

</LogDataExport>

file is also attached ;)

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #9 on: 2014-03-18 16:47:59 »
Ah-ha! Found it, my directions were slightly wrong, the filename should be aqua- (the dash is part of it), I didn't do just aqua in fear other aqua named based files might be in the folder, such as a layout, etc.

So you should be able to go back to the v.02 exe and just rename the output to aqua-suite.xml and everything should start working without issue.
Sorry should have caught that early on, Ill will make sure my directions are more clear.

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #10 on: 2014-03-18 18:50:47 »
I tried the V2 and it runs :)

But it don´t loop - with the start i get one time a -mod xml. this one will not be updated. I can check this @ the date&time :


18.03.2014  20:07               739 aqua-export-mod.xml
18.03.2014  20:09             1.432 aqua-export.xml

Important Btw.: i just found out that LCDHost/Dataviewer will not recognize all Names with - in the name .. so my {T-in.value} will NOT show the data - you just getting "{T-in.value}" as Text.
{Tin.value} is ok - you get the Value

You have to rename that in Aquasuite.
« Last Edit: 2014-03-18 19:13:41 by micpt »

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #11 on: 2014-03-18 19:27:18 »
Hi Micpt,

If you'd like to translate I'm all for it.  I don't want to start another thread though, I feel like I'd be spamming the forums if I had 3 running for this one thing.

Thanks!

micpt

  • Full Member
  • ***
  • Posts: 159
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #12 on: 2014-03-18 23:30:26 »
any idea why it transforms only the first time at restart and then stops ?

I tried the debug version - it shows me that the app process all 30 sec but i get no new output (no file written). I checked if values have changed and they did. 


Quote
F:\APPLICATION\LCDHost\layouts\mic>AquaSuiteWriter.exe
Watching path: F:\APPLICATION\LCDHost\layouts\mic\
Checking if already running.
Check complete, starting.
Watching Path F:\APPLICATION\LCDHost\layouts\mic\
Processing file aqua-export.xml
Loading XML file <LogDataExport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml
ns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <name>aqua-export</name>
  <exportTime>2014-03-19T00:23:32.0205237+01:00</exportTime>
  <logdata>
    <LogDataSet>
      <t>2014-03-19T00:23:31.413</t>
      <value>25.36</value>
      <name>Wassertemperatur</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquastream XT</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>25.54</value>
      <name>Tin</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>25.41</value>
      <name>Tout</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>26.01</value>
      <name>Text</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>100.5</value>
      <name>Iflow</name>
      <unit>l/h</unit>
      <valueType>flow</valueType>
      <device>aquaero</device>
    </LogDataSet>
  </logdata>
</LogDataExport>
Writing XML file F:\APPLICATION\LCDHost\layouts\mic\aqua-export-mod.xml
Processing file aqua-export.xml
Loading XML file <LogDataExport xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml
ns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <name>aqua-export</name>
  <exportTime>2014-03-19T00:23:32.0205237+01:00</exportTime>
  <logdata>
    <LogDataSet>
      <t>2014-03-19T00:23:31.413</t>
      <value>25.36</value>
      <name>Wassertemperatur</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquastream XT</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>25.54</value>
      <name>Tin</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>25.41</value>
      <name>Tout</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>26.01</value>
      <name>Text</name>
      <unit>°C</unit>
      <valueType>temperature</valueType>
      <device>aquaero</device>
    </LogDataSet>
    <LogDataSet>
      <t>2014-03-19T00:23:31.933</t>
      <value>100.5</value>
      <name>Iflow</name>
      <unit>l/h</unit>
      <valueType>flow</valueType>
      <device>aquaero</device>
    </LogDataSet>
  </logdata>
</LogDataExport>
Writing XML file F:\APPLICATION\LCDHost\layouts\mic\aqua-export-mod.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml
Processing file aqua-export.xml

may i ask for two request (if its easy to add)

1)
the option for looptime will be a big plus for this App. Something to append like :AquaSuiteWriter.exe -l 30 (30 second looptime) - so each one can adjust the timing to his exporttime. Also values under 10 sec should be forbitten to avert the lock of the Aquasuite File.

2)
Debug Level - standard is off but if needed you can set a switch like : -d for show debug.

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #13 on: 2014-03-19 00:20:32 »
The orginal code I wrote had a static loop in it, which I wanted to avoid for this one.  It should run each time it see's aquasuite write out its xml file, so in theory the faster or slower aqua suite is set to, the faster this will rewrite it.

Ill see what I can do about a flag for debug on/off, and Ill start debugging as to why its not triggering, I haven't watched it in the debugger for a long period of time, so there might be a bug.

RiC0MD

  • Newbie
  • *
  • Posts: 49
Re: AquaSuiteWriter - AquaSuite into LCDHost
« Reply #14 on: 2014-03-19 01:14:16 »
micpt,

Grab the v.03 version and see if you're processing improves.  Also added as you suggested -d to invoke a debug window that will stay in for all future versions, default is off.

 

anything