Page 1 of 1

XML Feedback command don't work !!!

Posted: Tue Jul 14, 2015 7:44 pm
by Mazze
Hej,

i can GET my XML File whit the command:

GET /config/xmlapi/statelist.cgi HTTP/1.0

And i GET:

<?xml version="1.0" encoding="ISO-8859-1"?>
-<stateList>
-<device ise_id="4210" name="Arbeitszimmer_Rollo">
-<channel ise_id="4211" name="Arbeitszimmer_Rollo:0" operate="" visible="">
<datapoint ise_id="4212" name="CUxD.CUX0200001:0.RSSI_PEER" operations="5" timestamp="0" valueunit="dBm" valuetype="8" value="0" type="RSSI_PEER"/>
</channel>
-<channel ise_id="4213" name="Arbeitszimmer_Rollo:1" operate="true" visible="true">
<datapoint ise_id="4216" name="CUxD.CUX0200001:1.STATE" operations="7" timestamp="1438066800" valueunit="" valuetype="2" value="true" type="STATE"/>
<datapoint ise_id="4217" name="CUxD.CUX0200001:1.TOGGLE" operations="2" timestamp="0" valueunit="" valuetype="2" value="" type="TOGGLE"/>
<datapoint ise_id="4215" name="CUxD.CUX0200001:1.PROG_TIMER" operations="7" timestamp="1437598645" valueunit="s" valuetype="4" value="0.000000" type="PROG_TIMER"/>
</channel>
</device>
-<device ise_id="4303" name="Garten_Decke_Licht">
-<channel ise_id="4304" name="Garten_Decke_Licht:0" operate="" visible="">
<datapoint ise_id="4305" name="CUxD.CUX0200010:0.RSSI_PEER" operations="5" timestamp="0" valueunit="dBm" valuetype="8" value="0" type="RSSI_PEER"/>
</channel>
-<channel ise_id="4306" name="Garten_Decke_Licht:1" operate="true" visible="true">
<datapoint ise_id="4309" name="CUxD.CUX0200010:1.STATE" operations="7" timestamp="1437598645" valueunit="" valuetype="2" value="false" type="STATE"/>
<datapoint ise_id="4310" name="CUxD.CUX0200010:1.TOGGLE" operations="2" timestamp="0" valueunit="" valuetype="2" value="" type="TOGGLE"/>
<datapoint ise_id="4308" name="CUxD.CUX0200010:1.PROG_TIMER" operations="7" timestamp="1437598645" valueunit="s" valuetype="4" value="0.000000" type="PROG_TIMER"/>
</channel>
</device>
.................
.....
..

Now i will the Feedback from:

<datapoint ise_id="4216" name="CUxD.CUX0200001:1.STATE" operations="7" timestamp="1438066800" valueunit="" valuetype="2" value="true" type="STATE"/>

i Need the Status from value="true"

i tasted a lot of commands, but no one Show me the info in de text as dynamiclabel

<datapoint ise_id="4216" value="(.*)"/>


what is wrong ?

Re: XML Feedback command don't work !!!

Posted: Tue Jul 28, 2015 1:56 pm
by Mazze
i hope anyone can help me.

Re: XML Feedback command don't work !!!

Posted: Wed Jul 29, 2015 1:27 pm
by Mazze
Ist it the Problem, that the file is an .cgi file that generate an XML Output ?

Becouse i can take the Output whit hercules and the GET Command !!

Re: XML Feedback command don't work !!!

Posted: Wed Jul 29, 2015 2:56 pm
by DemoPad
No, the response you see in Hercules should be the same response the app gets if you send the same command. Your regex looks wrong, try something like:

datapoint ise_id="([0-9]*)" name=

which should retrieve the numeric datapoint ise_id. If you see that on screen that will prove that you are communicating correctly. What is your response terminator set to? Look at the data in Hercules - and see what separates each line, it may be \x0A for example.

If you can't get it to work, set up Hercules as a TCP Server, and fire the command from the app at it (your PC's IP address) and manually send some data back, eg:

data=hello$0D

and use the regex:

data=(.*)

and you should see "hello' in your label - once you start that process you can make your response / the regex more closely match the data you actually see coming back.

Re: XML Feedback command don't work !!!

Posted: Wed Jul 29, 2015 3:29 pm
by Mazze
DemoPad wrote:No, the response you see in Hercules should be the same response the app gets if you send the same command. Your regex looks wrong, try something like:

datapoint ise_id="([0-9]*)" name=

which should retrieve the numeric datapoint ise_id. If you see that on screen that will prove that you are communicating correctly. What is your response terminator set to? Look at the data in Hercules - and see what separates each line, it may be \x0A for example.

If you can't get it to work, set up Hercules as a TCP Server, and fire the command from the app at it (your PC's IP address) and manually send some data back, eg:

data=hello$0D

and use the regex:

data=(.*)

and you should see "hello' in your label - once you start that process you can make your response / the regex more closely match the data you actually see coming back.

when i use \x0A or \x0D or take it together, i dont receive data from hercules: GET /config/xmlapi/statelist.cgi HTTP/1.0 \x0D

it only Output the file whitout anything of \x0D or \x0A, or \x0D\x0A

my Feedback from enigma2 System already OK. but from my homeautomation System dont give any Outputs.

when i copy some lines from hercules, i see that all Inputs from the XML life in 1 line:

Code: Select all

<device name='Wohnraum_Rollo_Rechts' ise_id='4228' ><channel name='Wohnraum_Rollo_Rechts:0' ise_id='4229' visible='' operate=''><datapoint name='CUxD.CUX0200003:0.RSSI_PEER' type='RSSI_PEER' ise_id='4230' value='0' valuetype='8' valueunit='dBm' timestamp='0' operations='5' /></channel><channel name='Wohnraum_Rollo_Rechts:1' ise_id='4231' visible='true' operate='true'><datapoint name='CUxD.CUX0200003:1.STATE' type='STATE' ise_id='4234' value='true' valuetype='2' valueunit='' timestamp='1438168804' operations='7' /><datapoint name='CUxD.CUX0200003:1.TOGGLE' type='TOGGLE' ise_id='4235' value='' valuetype='2' valueunit='' timestamp='0' operations='2' /><datapoint name='CUxD.CUX0200003:1.PROG_TIMER' type='PROG_TIMER' ise_id='4233' value='0.000000' valuetype='4' valueunit='s' timestamp='1438167382' operations='7' /></channel></device><device name='Wohnraum_SkyLine' ise_id='4267' ><channel name='Wohnraum_SkyLine:0' ise_id='4268' visible='' operate=''><datapoint name='CUxD.CUX0200006:0.RSSI_PEER' type='RSSI_PEER' ise_id='4269' value='0' valuetype='8' valueunit='dBm' timestamp='0' operations='5' /></channel><channel name='Wohnraum_SkyLine:1' ise_id='4270' visible='true' operate='true'><datapoint name='CUxD.CUX0200006:1.STATE' type='STATE' ise_id='4273' value='false' valuetype='2' valueunit='' timestamp='1438167382' operations='7' /><datapoint name='CUxD.CUX0200006:1.TOGGLE' type='TOGGLE' ise_id='4274' value='' valuetype='2' valueunit='' timestamp='0' operations='2' /><datapoint name='CUxD.CUX0200006:1.PROG_TIMER' type='PROG_TIMER' ise_id='4272' value='0.000000' valuetype='4' valueunit='s' timestamp='1438167382' operations='7' /></channel></device></stateList>
and the nummeric ise_id ist every actor of my System. that i can take the state Information from every actor himself !

i try to become the info, what is in the value="" from the datapoint ise_id="4216"
whit this regex: datapoint ise_id="4216" value="([A-Za-z0-9]*)" but the Output is clean

SORRY vor my HARDCORE English :)


That is the file, what create the XML Output from my homematic System !!!

Code: Select all

#!/bin/tclsh

load tclrega.so
puts -nonewline {Content-Type: text/xml
Access-Control-Allow-Origin: *

<?xml version="1.0" encoding="ISO-8859-1" ?><stateList>}

set ise_id 0
set show_internal 0

catch {
  set input $env(QUERY_STRING)
  set pairs [split $input &]
  foreach pair $pairs {
    if {0 != [regexp "^(\[^=]*)=(.*)$" $pair dummy varname val]} {
      set $varname $val      
    }    
  }
}

set comm "var ise_id=$ise_id;\n"
set comm "var show_internal=$show_internal;\n"


if { $ise_id != 0 } then {

  append comm {
        object obj = dom.GetObject(ise_id);
        if(obj.TypeName() == "HSSDP")
        {
            object oDP = obj;
            string dp = oDP.Name().StrValueByIndex(".", 2);

            Write("<datapoint");
            Write(" name='");WriteXML(oDP.Name());Write("'");
            Write(" type='");WriteXML(oDP.Name().StrValueByIndex(".", 2));Write("'");
            Write(" ise_id='");WriteXML(ise_id);Write("'");
            ! state fragt den aktuellen status des sensors/aktors ab, dauert lange
            if (show_internal == 1) {
                Write(" state='");WriteXML(oDP.State());Write("'");
            }
            ! value nimmt den von der ccu gecachten wert, moeglicherweise nicht korrekt. Ggf. bei einigen geraeten immer abfragen
            Write(" value='");WriteXML(oDP.Value());Write("'");
            Write(" valuetype='");WriteXML(oDP.ValueType());Write("'");
            Write(" timestamp='");WriteXML(oDP.Timestamp().ToInteger());Write("'");
            Write(" />");
        }
    }

} else {





append comm {

string sDevId;
string sChnId;
string sDPId;

	foreach (sDevId, root.Devices().EnumUsedIDs())
	{
		object oDevice   = dom.GetObject(sDevId);

		if( oDevice.ReadyConfig() && (oDevice.Name() != "Zentrale") && (oDevice.Name() != "HMW-RCV-50 BidCoS-Wir") )
		{
			Write("<device");
			Write(" name='" # oDevice.Name() # "'");
			Write(" ise_id='" # sDevId # "'");

			string interfaceid = oDevice.Interface();
			string servicechan = "" # dom.GetObject(interfaceid).Name() #"."#oDevice.Address()#":0";
			object schan = dom.GetObject(servicechan#".UNREACH");
			if(schan) { Write(" unreach='" # schan.Value() #"'"); }
			object schan = dom.GetObject(servicechan#".STICKY_UNREACH");
			if(schan) { Write(" sticky_unreach='" # schan.Value() #"'"); }
			object schan = dom.GetObject(servicechan#".CONFIG_PENDING");
			if(schan) { Write(" config_pending='" # schan.Value() #"'"); }
			
			Write(" >");  ! device tag schliessen

			foreach(sChnId, oDevice.Channels())
			{
				object oChannel = dom.GetObject(sChnId);
				if ( (! oChannel.Internal()) ||  oChannel.Internal()  )
				{

					Write("<channel name='");
					WriteXML( oChannel.Name() );
					Write("' ise_id='" # sChnId);					
					
					if (oChannel.Internal()) {
						Write("' visible='" );
						Write("' operate='");
						
					} else {
						Write("' visible='"); 
						WriteXML(oChannel.Visible());
						
						Write("' operate='");                        
						object o_sysVar = dom.GetObject(sChnId); 	
						if( o_sysVar.UserAccessRights(iulOtherThanAdmin) == iarFullAccess ) {
							Write("true");
						} else {
							Write("false");		
						} 
					}
					

					Write("'>");
					
					foreach(sDPId, oChannel.DPs().EnumUsedIDs())
					{
						object oDP = dom.GetObject(sDPId);
						if(oDP)
						{
							string dp = oDP.Name().StrValueByIndex(".", 2);

							if( (dp != "ON_TIME") && (dp != "INHIBIT") && (dp != "CMD_RETS") && (dp != "CMD_RETL") && (dp != "CMD_SETS") && (dp != "CMD_SETL") )
							{
								Write("<datapoint");
								Write(" name='"); WriteXML(oDP.Name());
								Write("' type='"); WriteXML(oDP.Name().StrValueByIndex(".", 2));
								Write("' ise_id='" # sDPId );
                                ! state fragt den aktuellen status des sensors/aktors ab, dauert lange
								if (show_internal == 1) {
                                        Write("' state='"); WriteXML(oDP.State());
                                }
                                ! value nimmt den von der ccu gecachten wert, moeglicherweise nicht korrekt. Ggf. bei einigen geraeten immer abfragen
								Write("' value='"); WriteXML(oDP.Value());
								Write("' valuetype='" # oDP.ValueType());
								Write("' valueunit='" # oDP.ValueUnit());
								Write("' timestamp='" # oDP.Timestamp().ToInteger());
								Write("' operations='" # oDP.Operations());
								Write("' />");
							}
						}
					}
					Write("</channel>");
				}
			}
			Write("</device>");
		}
	}

  }

  array set res [rega_script $comm]

  puts -nonewline $res(STDOUT)
}
puts -nonewline {</stateList>}



Re: XML Feedback command don't work !!!

Posted: Wed Jul 29, 2015 4:42 pm
by Mazze
Hercules:
when i take the command:
GET /config/xmlapi/statelist.cgi HTTP/1.0\x0D\x0A
GET /config/xmlapi/statelist.cgi HTTP/1.0\x0D
GET /config/xmlapi/statelist.cgi HTTP/1.0\x0A

i become this ERROR:
1.jpg
When i write:
GET /config/xmlapi/statelist.cgi HTTP/1.0

i become the complett statelist.cgi file
2.jpg
her is my Demopad configuration:
3.jpg

Re: XML Feedback command don't work !!!

Posted: Wed Jul 29, 2015 4:43 pm
by Mazze
4.jpg
5.jpg

Re: XML Feedback command don't work !!!

Posted: Thu Jul 30, 2015 11:33 pm
by trevorst
I have had success using /> as a terminator on some but not all XML files.
Try the following pattern with /> as the terminator:

<datapoint ise_id="4216".*value="(.*)" type="STATE"

Good luck.

Re: XML Feedback command don't work !!!

Posted: Tue Aug 04, 2015 1:45 pm
by Mazze
trevorst wrote:I have had success using /> as a terminator on some but not all XML files.
Try the following pattern with /> as the terminator:

<datapoint ise_id="4216".*value="(.*)" type="STATE"

Good luck.
when i us<datapoint ise_id="4216".*value="(.*)" type="STATE"/> is the same. nothing :(

Re: XML Feedback command don't work !!!

Posted: Tue Aug 04, 2015 2:25 pm
by trevorst
Don't add the /> to the input, use it as the terminator as the feedback terminator.

Re: XML Feedback command don't work !!!

Posted: Tue Aug 04, 2015 6:03 pm
by Mazze
trevorst wrote:Don't add the /> to the input, use it as the terminator as the feedback terminator.

sorry my mistakte, i mean, i have wrote:

<datapoint ise_id="4216".*value="(.*)" type="STATE"
in Data.

An in Device Responce /> !!!!

Re: XML Feedback command don't work !!!

Posted: Tue Aug 04, 2015 6:08 pm
by Mazze
1.jpg

Re: XML Feedback command don't work !!!

Posted: Sun Aug 09, 2015 10:49 am
by Mazze
nobody has any other idea ???

becouse homematic is the biggest home automation system in germany ! and her gives many user that like to build her own ipad app whit demoted. at the moment can only mediola communicate whit homematic, but the software ist 10% of demoted in the functionality !!

Re: XML Feedback command don't work !!!

Posted: Sat Aug 22, 2015 5:02 pm
by Mazze
Demopad, when i send you my XML file, can u test it and tell my how it like works ?

the Feedback, is the one and only Thing what not work :( but it is recommand to use Demopad as iPad Controller !!!