func nextStart(p *xml.Decoder) (xml.StartElement, error) {
	for {
		t, err := p.Token()
		if err != nil || t == nil {
			return xml.StartElement{}, err
		}
		switch t := t.(type) {
		case xml.StartElement:
			return t, nil
		}
	}
}
https://github.com/petele/PiHomeControl
http://petelepage.com/blog/2013/07/home-automation-for-geeks/
/*
Client:
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" to="x.com">
Server:
<?xml version='1.0' encoding='iso-8859-1'?><stream:stream from='x.com' id='001418d7' version='1.0' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism></mechanisms></stream:features>

Client:
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">Z3Vlc3RAeC5jb20AZ3Vlc3QAZ3Vlc3Q=</auth>
Server:
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>

Client:
<stream:stream xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams" version="1.0" to="x.com">
Server:
<stream:stream from='x.com' id='001418d7' version='1.0' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'><stream:features><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/><session xmlns='urn:ietf:params:xml:nx:xmpp-session'/></stream:features>

Client:
<iq type="set" id="bind"><bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"><resource>gatorade</resource></bind></iq>
Server:
<iq id='bind' type='result'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'><jid>1111/gatorade</jid></bind></iq>

Client:
<iq type="get" id="662413" from="guest"><oa xmlns="connect.logitech.com" mime="vnd.logitech.connect/vnd.logitech.pair">method=pair:name=harmonyjs#iOS6.0.1#iPhone</oa></iq>
Server:
<iq/><iq id="662413" to="guest" type="get"><oa xmlns='connect.logitech.com' mime='vnd.logitech.connect/vnd.logitech.pair' errorcode='200' errorstring='OK'><![CDATA[serverIdentity=95f8d8c4-8fe1-4712-bf49-a374ce916c45:hubId=106:identity=95f8d8c4-8fe1-4712-bf49-a374ce916c45:status=succeeded:protocolVersion={XMPP="1.0", HTTP="1.0", RF="1.0", WEBSOCKET="1.0"}:hubProfiles={Harmony="2.0"}:productId=Pimento:friendlyName=Harmony Hub]]></oa></iq>

Client:
</stream:stream>
Server:
</stream:stream>



TODO: CLI/API for getting config

<iq type="get" id="182632"><oa xmlns="connect.logitech.com" mime="vnd.logitech.harmony/vnd.logitech.harmony.engine?config"></oa></iq><iq/><iq id="182632" type="get"><oa xmlns='connect.logitech.com' mime='vnd.logitech.harmony/vnd.logitech.harmony.engine?config' errorcode='200' errorstring='OK'><![CDATA[{"activity":[{"rules":[],"label":"Watch TV","isTuningDefault":false,"activityTypeDisplayName":"Default","enterActions":[],"fixit":{"47917687":{"id":"47917687","Input":"Game","Power":"On"},"47918441":{"id":"47918441","Power":"On"}},"baseImageUri":"https:\/\/rcbu-test-ssl-amr.s3.amazonaws.com\/","zones":null,"type":"VirtualTelevisionN","isAVActivity":true,"id":"28648157","suggestedDisplay":"Default","controlGroup":[{"name":"NumericBasic","function":[{"action":"{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number0","label":"0"},{"action":"{\"command\":\"1\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number1","label":"1"},{"action":"{\"command\":\"2\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number2","label":"2"},{"action":"{\"command\":\"3\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number3","label":"3"},{"action":"{\"command\":\"4\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number4","label":"4"},{"action":"{\"command\":\"5\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number5","label":"5"},{"action":"{\"command\":\"6\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number6","label":"6"},{"action":"{\"command\":\"7\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number7","label":"7"},{"action":"{\"command\":\"8\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number8","label":"8"},{"action":"{\"command\":\"9\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number9","label":"9"}]},{"name":"Volume","function":[{"action":"{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Mute","label":"Mute"},{"action":"{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeDown","label":"Volume Down"},{"action":"{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeUp","label":"Volume Up"}]},{"name":"Channel","function":[{"action":"{\"command\":\"ChannelPrev\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PrevChannel","label":"Prev Channel"},{"action":"{\"command\":\"ChannelDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"ChannelDown","label":"Channel Down"},{"action":"{\"command\":\"ChannelUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"ChannelUp","label":"Channel Up"}]},{"name":"NavigationBasic","function":[{"action":"{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionDown","label":"Direction Down"},{"action":"{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionLeft","label":"Direction Left"},{"action":"{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionRight","label":"Direction Right"},{"action":"{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionUp","label":"Direction Up"},{"action":"{\"command\":\"Ok\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Select","label":"Select"}]},{"name":"TransportBasic","function":[{"action":"{\"command\":\"Stop\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Stop","label":"Stop"},{"action":"{\"command\":\"Play\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Play","label":"Play"},{"action":"{\"command\":\"Rewind\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Rewind","label":"Rewind"},{"action":"{\"command\":\"Pause\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Pause","label":"Pause"},{"action":"{\"command\":\"FastForward\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"FastForward","label":"Fast Forward"}]},{"name":"TransportRecording","function":[{"action":"{\"command\":\"Record\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Record","label":"Record"}]},{"name":"NavigationDVD","function":[{"action":"{\"command\":\"Subtitle\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Subtitle","label":"Subtitle"},{"action":"{\"command\":\"Back\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Back","label":"Back"}]},{"name":"NavigationDSTB","function":[{"action":"{\"command\":\"List\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"List","label":"List"},{"action":"{\"command\":\"Search\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Search","label":"Search"}]},{"name":"GameType3","function":[{"action":"{\"command\":\"Home\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Home","label":"Home"}]},{"name":"NavigationExtended","function":[{"action":"{\"command\":\"Guide\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Guide","label":"Guide"},{"action":"{\"command\":\"Info\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Info","label":"Info"},{"action":"{\"command\":\"Exit\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Exit","label":"Exit"},{"action":"{\"command\":\"PageDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PageDown","label":"Page Down"},{"action":"{\"command\":\"PageUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PageUp","label":"Page Up"}]},{"name":"DisplayMode","function":[{"action":"{\"command\":\"Aspect\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Aspect","label":"Aspect"}]},{"name":"ColoredButtons","function":[{"action":"{\"command\":\"Green\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Green","label":"Green"},{"action":"{\"command\":\"Red\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Red","label":"Red"},{"action":"{\"command\":\"Blue\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Blue","label":"Blue"},{"action":"{\"command\":\"Yellow\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Yellow","label":"Yellow"}]},{"name":"Teletext","function":[{"action":"{\"command\":\"Teletext\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Teletext","label":"Teletext"}]}],"sequences":[],"activityOrder":1,"roles":{"ChannelChangingActivityRole":"47918441","DisplayActivityRole":"47918441","VolumeActivityRole":"47917687"},"VolumeActivityRole":"47917687","isMultiZone":false,"icon":"userdata: 0x4454e0"},{"rules":[],"label":"Test","isTuningDefault":false,"activityTypeDisplayName":"Default","enterActions":[],"fixit":{"47917687":{"id":"47917687","Input":"Game","Power":"On"},"47918441":{"id":"47918441","Power":"Off"}},"icon":"userdata: 0x4454e0","zones":null,"suggestedDisplay":"Default","isAVActivity":true,"id":"28647596","type":"VirtualCdMulti","sequences":[],"controlGroup":[{"name":"NumericBasic","function":[{"action":"{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number0","label":"0"},{"action":"{\"command\":\"1\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number1","label":"1"},{"action":"{\"command\":\"2\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number2","label":"2"},{"action":"{\"command\":\"3\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number3","label":"3"},{"action":"{\"command\":\"4\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number4","label":"4"},{"action":"{\"command\":\"5\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number5","label":"5"},{"action":"{\"command\":\"6\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number6","label":"6"},{"action":"{\"command\":\"7\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number7","label":"7"},{"action":"{\"command\":\"8\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number8","label":"8"},{"action":"{\"command\":\"9\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number9","label":"9"}]},{"name":"Volume","function":[{"action":"{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Mute","label":"Mute"},{"action":"{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeDown","label":"Volume Down"},{"action":"{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeUp","label":"Volume Up"}]},{"name":"NavigationBasic","function":[{"action":"{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionDown","label":"Direction Down"},{"action":"{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionLeft","label":"Direction Left"},{"action":"{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionRight","label":"Direction Right"},{"action":"{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionUp","label":"Direction Up"},{"action":"{\"command\":\"Enter\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Select","label":"Select"}]},{"name":"TransportBasic","function":[{"action":"{\"command\":\"UsbStop\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Stop","label":"Stop"},{"action":"{\"command\":\"UsbPlay\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Play","label":"Play"},{"action":"{\"command\":\"UsbRewind\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Rewind","label":"Rewind"},{"action":"{\"command\":\"UsbPause\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Pause","label":"Pause"},{"action":"{\"command\":\"UsbFastForward\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"FastForward","label":"Fast Forward"}]},{"name":"TransportExtended","function":[{"action":"{\"command\":\"UsbSkipBack\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"SkipBackward","label":"Skip Backward"},{"action":"{\"command\":\"UsbSkipForward\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"SkipForward","label":"Skip Forward"}]},{"name":"NavigationDVD","function":[{"action":"{\"command\":\"Return\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Return","label":"Return"}]},{"name":"GameType3","function":[{"action":"{\"command\":\"Home\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Home","label":"Home"}]},{"name":"RadioTuner","function":[{"action":"{\"command\":\"PresetPrev\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"PrevPreset","label":"Prev Preset"},{"action":"{\"command\":\"TuneDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ScanDown","label":"Scan Down"},{"action":"{\"command\":\"TuneUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ScanUp","label":"Scan Up"},{"action":"{\"command\":\"PresetNext\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"NextPreset","label":"Next Preset"},{"action":"{\"command\":\"DirectTune\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectTune","label":"Direct Tune"}]},{"name":"Setup","function":[{"action":"{\"command\":\"Sleep\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Sleep","label":"Sleep"}]}],"VolumeActivityRole":"47917687","imageKey":"Activity\/3AEBFA09-DE9A-46F5-86FB-AC5E585295FB.png","roles":{"PlayMediaActivityRole":"47917687","VolumeActivityRole":"47917687"},"activityOrder":0,"isMultiZone":false,"baseImageUri":"https:\/\/rcbu-test-ssl-amr.s3.amazonaws.com\/"},{"type":"PowerOff","isAVActivity":false,"label":"PowerOff","id":"-1","activityTypeDisplayName":"Default","controlGroup":[],"sequences":[],"fixit":{"47917687":{"id":"47917687","Power":"Off"},"47918441":{"id":"47918441","Power":"Off"}},"enterActions":[],"roles":[],"rules":[],"icon":"Default","suggestedDisplay":"Default"}],"sequence":[],"device":[{"label":"Onkyo AV Receiver","deviceAddedDate":"\/Date(1507143635950+0000)\/","ControlPort":7,"deviceProfileUri":"svcs.myharmony.com\/res\/device\/47917687-3k\/ZqyVVQlWYjk0gZU7w8yckKgFOigZqVE\/GpixiKPg=","manufacturer":"Onkyo","icon":"5","suggestedDisplay":"DEFAULT","deviceTypeDisplayName":"StereoReceiver","powerFeatures":{"PowerOnActions":[{"__type":"IRPressAction","IRCommandName":"PowerOn","Order":1,"Duration":null,"ActionId":0}],"PowerOffActions":[{"__type":"IRPressAction","IRCommandName":"PowerOff","Order":1,"Duration":null,"ActionId":0}]},"uuid":"aab01371-bd13-71b9-d61a-7109bdb9b40d","Capabilities":[1,5,8,62],"controlGroup":[{"name":"Power","function":[{"action":"{\"command\":\"PowerOff\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"PowerOff","label":"Power Off"},{"action":"{\"command\":\"PowerOn\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"PowerOn","label":"Power On"},{"action":"{\"command\":\"PowerToggle\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"PowerToggle","label":"Power Toggle"}]},{"name":"NumericBasic","function":[{"action":"{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number0","label":"0"},{"action":"{\"command\":\"1\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number1","label":"1"},{"action":"{\"command\":\"2\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number2","label":"2"},{"action":"{\"command\":\"3\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number3","label":"3"},{"action":"{\"command\":\"4\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number4","label":"4"},{"action":"{\"command\":\"5\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number5","label":"5"},{"action":"{\"command\":\"6\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number6","label":"6"},{"action":"{\"command\":\"7\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number7","label":"7"},{"action":"{\"command\":\"8\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number8","label":"8"},{"action":"{\"command\":\"9\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Number9","label":"9"}]},{"name":"Volume","function":[{"action":"{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Mute","label":"Mute"},{"action":"{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeDown","label":"Volume Down"},{"action":"{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"VolumeUp","label":"Volume Up"}]},{"name":"NavigationBasic","function":[{"action":"{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionDown","label":"Direction Down"},{"action":"{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionLeft","label":"Direction Left"},{"action":"{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionRight","label":"Direction Right"},{"action":"{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectionUp","label":"Direction Up"},{"action":"{\"command\":\"Enter\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Select","label":"Select"}]},{"name":"TransportBasic","function":[{"action":"{\"command\":\"UsbStop\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Stop","label":"Stop"},{"action":"{\"command\":\"UsbPlay\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Play","label":"Play"},{"action":"{\"command\":\"UsbRewind\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Rewind","label":"Rewind"},{"action":"{\"command\":\"UsbPause\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Pause","label":"Pause"},{"action":"{\"command\":\"UsbFastForward\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"FastForward","label":"Fast Forward"}]},{"name":"TransportExtended","function":[{"action":"{\"command\":\"UsbSkipBack\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"SkipBackward","label":"Skip Backward"},{"action":"{\"command\":\"UsbSkipForward\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"SkipForward","label":"Skip Forward"}]},{"name":"NavigationDVD","function":[{"action":"{\"command\":\"Return\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Return","label":"Return"}]},{"name":"RadioTuner","function":[{"action":"{\"command\":\"PresetPrev\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"PrevPreset","label":"Prev Preset"},{"action":"{\"command\":\"TuneDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ScanDown","label":"Scan Down"},{"action":"{\"command\":\"TuneUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ScanUp","label":"Scan Up"},{"action":"{\"command\":\"PresetNext\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"NextPreset","label":"Next Preset"},{"action":"{\"command\":\"DirectTune\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"DirectTune","label":"Direct Tune"}]},{"name":"Setup","function":[{"action":"{\"command\":\"Q Setup\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Setup","label":"Setup"},{"action":"{\"command\":\"Sleep\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Sleep","label":"Sleep"}]},{"name":"DisplayMode","function":[{"action":"{\"command\":\"Display\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Display","label":"Display"}]},{"name":"Miscellaneous","function":[{"action":"{\"command\":\"ChannelSelect\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ChannelSelect","label":"ChannelSelect"},{"action":"{\"command\":\"Dimmer\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Dimmer","label":"Dimmer"},{"action":"{\"command\":\"HdmiOut1\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"HdmiOut1","label":"HdmiOut1"},{"action":"{\"command\":\"HdmiOut2\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"HdmiOut2","label":"HdmiOut2"},{"action":"{\"command\":\"HdmiOutBoth\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"HdmiOutBoth","label":"HdmiOutBoth"},{"action":"{\"command\":\"HdmiOutWrap\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"HdmiOutWrap","label":"HdmiOutWrap"},{"action":"{\"command\":\"Home\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"Home","label":"Home"},{"action":"{\"command\":\"InputAm\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputAm","label":"InputAm"},{"action":"{\"command\":\"InputAux\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputAux","label":"InputAux"},{"action":"{\"command\":\"InputBd\\\/Dvd\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputBd\/Dvd","label":"InputBd\/Dvd"},{"action":"{\"command\":\"InputCbl\\\/Sat\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputCbl\/Sat","label":"InputCbl\/Sat"},{"action":"{\"command\":\"InputExtra1\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputExtra1","label":"InputExtra1"},{"action":"{\"command\":\"InputExtra2\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputExtra2","label":"InputExtra2"},{"action":"{\"command\":\"InputFm\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputFm","label":"InputFm"},{"action":"{\"command\":\"InputGame\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputGame","label":"InputGame"},{"action":"{\"command\":\"InputInternetRadio\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputInternetRadio","label":"InputInternetRadio"},{"action":"{\"command\":\"InputMusicServer\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputMusicServer","label":"InputMusicServer"},{"action":"{\"command\":\"InputNet\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputNet","label":"InputNet"},{"action":"{\"command\":\"InputPc\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputPc","label":"InputPc"},{"action":"{\"command\":\"InputTv\\\/Cd\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputTv\/Cd","label":"InputTv\/Cd"},{"action":"{\"command\":\"InputUsb\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"InputUsb","label":"InputUsb"},{"action":"{\"command\":\"ModeGame\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ModeGame","label":"ModeGame"},{"action":"{\"command\":\"ModeMovie\\\/Tv\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ModeMovie\/Tv","label":"ModeMovie\/Tv"},{"action":"{\"command\":\"ModeMusic\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ModeMusic","label":"ModeMusic"},{"action":"{\"command\":\"ModeStereo\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"ModeStereo","label":"ModeStereo"},{"action":"{\"command\":\"UsbDisplay\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbDisplay","label":"UsbDisplay"},{"action":"{\"command\":\"UsbDown\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbDown","label":"UsbDown"},{"action":"{\"command\":\"UsbLeft\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbLeft","label":"UsbLeft"},{"action":"{\"command\":\"UsbMenu\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbMenu","label":"UsbMenu"},{"action":"{\"command\":\"UsbMode\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbMode","label":"UsbMode"},{"action":"{\"command\":\"UsbRandom\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbRandom","label":"UsbRandom"},{"action":"{\"command\":\"UsbRepeat\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbRepeat","label":"UsbRepeat"},{"action":"{\"command\":\"UsbReturn\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbReturn","label":"UsbReturn"},{"action":"{\"command\":\"UsbRight\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbRight","label":"UsbRight"},{"action":"{\"command\":\"UsbSearch\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbSearch","label":"UsbSearch"},{"action":"{\"command\":\"UsbSelect\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbSelect","label":"UsbSelect"},{"action":"{\"command\":\"UsbSetup\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbSetup","label":"UsbSetup"},{"action":"{\"command\":\"UsbTopMenu\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbTopMenu","label":"UsbTopMenu"},{"action":"{\"command\":\"UsbUp\",\"type\":\"IRCommand\",\"deviceId\":\"47917687\"}","name":"UsbUp","label":"UsbUp"}]}],"DongleRFID":0,"IsKeyboardAssociated":false,"model":"TX-NR515","type":"StereoReceiver","id":"47917687","Transport":1,"isManualPower":"false"},{"label":"Philips TV","deviceAddedDate":"\/Date(1507145506360+0000)\/","ControlPort":7,"deviceProfileUri":"svcs.myharmony.com\/res\/device\/47918441-lfIh\/z53o4veNcTfl0fn2UdX+U5kb2\/\/tOAEcJ+MDm8=","manufacturer":"Philips","icon":"1","suggestedDisplay":"DEFAULT","deviceTypeDisplayName":"Television","powerFeatures":{"PowerOnActions":[{"__type":"IRPressAction","IRCommandName":"PowerOn","Order":0,"Duration":null,"ActionId":0}],"PowerOffActions":[{"__type":"IRPressAction","IRCommandName":"PowerOff","Order":0,"Duration":null,"ActionId":0}]},"Capabilities":[1,2,3,5,8,24],"controlGroup":[{"name":"Power","function":[{"action":"{\"command\":\"PowerOff\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PowerOff","label":"Power Off"},{"action":"{\"command\":\"PowerOn\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PowerOn","label":"Power On"},{"action":"{\"command\":\"PowerToggle\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PowerToggle","label":"Power Toggle"}]},{"name":"NumericBasic","function":[{"action":"{\"command\":\"0\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number0","label":"0"},{"action":"{\"command\":\"1\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number1","label":"1"},{"action":"{\"command\":\"2\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number2","label":"2"},{"action":"{\"command\":\"3\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number3","label":"3"},{"action":"{\"command\":\"4\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number4","label":"4"},{"action":"{\"command\":\"5\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number5","label":"5"},{"action":"{\"command\":\"6\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number6","label":"6"},{"action":"{\"command\":\"7\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number7","label":"7"},{"action":"{\"command\":\"8\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number8","label":"8"},{"action":"{\"command\":\"9\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Number9","label":"9"}]},{"name":"Volume","function":[{"action":"{\"command\":\"Mute\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Mute","label":"Mute"},{"action":"{\"command\":\"VolumeDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"VolumeDown","label":"Volume Down"},{"action":"{\"command\":\"VolumeUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"VolumeUp","label":"Volume Up"}]},{"name":"Channel","function":[{"action":"{\"command\":\"ChannelPrev\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PrevChannel","label":"Prev Channel"},{"action":"{\"command\":\"ChannelDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"ChannelDown","label":"Channel Down"},{"action":"{\"command\":\"ChannelUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"ChannelUp","label":"Channel Up"}]},{"name":"NavigationBasic","function":[{"action":"{\"command\":\"DirectionDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionDown","label":"Direction Down"},{"action":"{\"command\":\"DirectionLeft\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionLeft","label":"Direction Left"},{"action":"{\"command\":\"DirectionRight\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionRight","label":"Direction Right"},{"action":"{\"command\":\"DirectionUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"DirectionUp","label":"Direction Up"},{"action":"{\"command\":\"Ok\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Select","label":"Select"}]},{"name":"TransportBasic","function":[{"action":"{\"command\":\"Stop\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Stop","label":"Stop"},{"action":"{\"command\":\"Play\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Play","label":"Play"},{"action":"{\"command\":\"Rewind\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Rewind","label":"Rewind"},{"action":"{\"command\":\"Pause\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Pause","label":"Pause"},{"action":"{\"command\":\"FastForward\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"FastForward","label":"Fast Forward"}]},{"name":"TransportRecording","function":[{"action":"{\"command\":\"Record\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Record","label":"Record"}]},{"name":"NavigationDVD","function":[{"action":"{\"command\":\"Subtitle\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Subtitle","label":"Subtitle"},{"action":"{\"command\":\"Back\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Back","label":"Back"}]},{"name":"Teletext","function":[{"action":"{\"command\":\"Teletext\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Teletext","label":"Teletext"}]},{"name":"NavigationDSTB","function":[{"action":"{\"command\":\"List\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"List","label":"List"},{"action":"{\"command\":\"Search\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Search","label":"Search"}]},{"name":"ColoredButtons","function":[{"action":"{\"command\":\"Green\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Green","label":"Green"},{"action":"{\"command\":\"Red\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Red","label":"Red"},{"action":"{\"command\":\"Blue\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Blue","label":"Blue"},{"action":"{\"command\":\"Yellow\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Yellow","label":"Yellow"}]},{"name":"NavigationExtended","function":[{"action":"{\"command\":\"Guide\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Guide","label":"Guide"},{"action":"{\"command\":\"Info\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Info","label":"Info"},{"action":"{\"command\":\"PageDown\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PageDown","label":"Page Down"},{"action":"{\"command\":\"PageUp\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"PageUp","label":"Page Up"},{"action":"{\"command\":\"Exit\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Exit","label":"Exit"}]},{"name":"DisplayMode","function":[{"action":"{\"command\":\"Aspect\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Aspect","label":"Aspect"}]},{"name":"GoogleTVNavigation","function":[{"action":"{\"command\":\"Settings\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Settings","label":"Settings"}]},{"name":"Miscellaneous","function":[{"action":"{\"command\":\"2D\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"2D","label":"2D"},{"action":"{\"command\":\"3D\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"3D","label":"3D"},{"action":"{\"command\":\"Ambilight\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Ambilight","label":"Ambilight"},{"action":"{\"command\":\"Help\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Help","label":"Help"},{"action":"{\"command\":\"Home\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Home","label":"Home"},{"action":"{\"command\":\"InputHdmi1\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputHdmi1","label":"InputHdmi1"},{"action":"{\"command\":\"InputHdmi2\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputHdmi2","label":"InputHdmi2"},{"action":"{\"command\":\"InputHdmi3\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputHdmi3","label":"InputHdmi3"},{"action":"{\"command\":\"InputHdmi4\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputHdmi4","label":"InputHdmi4"},{"action":"{\"command\":\"InputNetwork\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputNetwork","label":"InputNetwork"},{"action":"{\"command\":\"InputScart\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputScart","label":"InputScart"},{"action":"{\"command\":\"InputUsb\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"InputUsb","label":"InputUsb"},{"action":"{\"command\":\"Multiview\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Multiview","label":"Multiview"},{"action":"{\"command\":\"Options\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Options","label":"Options"},{"action":"{\"command\":\"SmartTv\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"SmartTv","label":"SmartTv"},{"action":"{\"command\":\"Source\",\"type\":\"IRCommand\",\"deviceId\":\"47918441\"}","name":"Source","label":"Source"}]}],"DongleRFID":0,"IsKeyboardAssociated":false,"model":"55PUS7909","type":"Television","id":"47918441","Transport":1,"isManualPower":"false"}],"sla":{"latestSLAAcceptedDate":"\/Date(1507143310180+0000)\/","latestSLAAccepted":true},"content":{"contentUserHost":"https:\/\/content.dhg.myharmony.com\/1.0\/User;{userProfileUri}","contentDeviceHost":"https:\/\/content.dhg.myharmony.com\/1.0\/Device;{deviceProfileUri}","contentServiceHost":"https:\/\/content.dhg.myharmony.com\/1.0\/Service\/{providerId}","contentImageHost":"https:\/\/d1tk8oqnnsddt5.cloudfront.net\/1.0\/station\/{stationId}\/image;maxX=40;maxY=40","householdUserProfileUri":"svcs.myharmony.com\/res\/\/household\/8219819-kW+5RwnBrXPTDavh1G1+3G0iI9xvlfCTCSg6XO0thdY=\/user\/default"},"global":{"timeStampHash":"7f4aaf9d-7d1e-4aed-8f36-641da1b123ed9299c3cd-8d2b-4ec7-8ae0-116ae854e9ab\/51447553-5935-4dba-b33d-54d9db33fa5be7d082aa-46de-49e1-99ec-c6364a7151f15331a1bd-56c2-4c90-ad1e-b3dfeb2d41c311254819Harmony+Huben-USFIMS-e2bee8d2-a4c6-484c-b629-6ddab8bf656b0137866762254445643europe%2fhelsinkiTrue17308367611;4aa53e6141ece12b039f90109bbbf539","locale":"en-US"}}]]></oa></iq>

Scan XML token stream to find next StartElement.
package harmonyhub
import (
	"context"
	"encoding/base64"
	"encoding/xml"
	"errors"
	"fmt"
	"log"
	"net"
	"time"
	"golang.org/x/net/html/charset"
)
var errNotConnected = errors.New("not connected")