Hey, this is a simple wrapper for the Loewe SOAP API. It's not complete, but it's enough for my needs. Feel free to contribute.
Please note, that the code is mostly auto-generated by wsdl-tsclient, but modified by hand to make it work better using the Loewe SOAP API, as it often handles a bit difficult!
I am already coding for about 4 years, but this is my first published library / SDK - so feel free to contribute and improve it - also concerning readability and code quality in libraries, as I am not that experienced in Module / SDK development :)
npm install loewe-jsIn order to use the library, you first have to download the WSDL file from your TV. It is located here: http://:905/lowew_tablet_0001?wsdl Alternatively, you can use the WSDL file from this repository, but it might be outdated. (loewe didn't change it since 2018, so feel free :)
The Loewe API is no API, you love to use - but I want to make you have a best experience using it! (at least as far as it's possible ;)
This ist the API Flow:
- Send a login request: Call
RequestAuthwith the needed parameters (see tabcompletion or typing files), but put?as the ClientId - Receive the new ClientId. Note, that the
AccessStatusvalue currently isPending. - Wait some seconds and call
RequestAuthagain with the same parameters, but now with the ClientId you received in step 2. - Receive the Response containing the same information except, the
AccessStatusvalue is nowAccepted.
You can now use the ClientId and fcid for further requests. It's not clear how long the ClientId is valid. I experienced a lifetime of the time while the TV isn't restarted (standby ok, but no deep-sleep), but docs are saying "until the TV needs resources and cancels the ClientId".
Hints on the Credentials: The fcid is like a username. The ClientId is like a token. DeviceType can be selected freely. DeviceName can be selected freely. DeviceUUID should be a MAC-Address like string RequesterName can be selected freely.
import { createClientAsync } from 'loewe-js';
const authData = {
fcid: "fcid",
DeviceType: "deviceType",
DeviceName: "deviceName",
DeviceUUID: "deviceUUID",
RequesterName: "requesterName",
ClientId: "?"
}
createClientAsync("path/to/wsdl.wsdl", {
endpoint: "http://<ip-of-tv>:905/loewe_tablet_0001"
})
.then(c => {
c.RequestAccess(authData)
.then(authResponse => {
const clientId = authResponse[0].ClientId;
// send further requests with the clientId
})
})The response data is serialized to JSON, so you can use it directly. It's located inside the first array element.
I just had the same problem ;) I haven't known much about SOAP myself, so I found out, there's an easy way. Look at the demo.ts file in this packages directory. Important are:
- the
namespaceArrayElements: falseoption in thecreateClientAsynccall - the
InputEventSequencewith its Array of XML nodes containing the attributes defining the RCKey
looks a bit difficult or annoying - but works completely fine with the built-in serializer!
Feel free to contribute to this project. Just fork it and create a pull request. Any Bugfixes or new features are welcome.