I am trying to build a back-end webservice in PHP to control Supla devices.
I have a hosted linux server at my ISP and I have an Alexa Custom Skill hosted at Amazon.
The amazon skill is for an existing client of mine and already works very well. What it does is take amazon "intents" and convert them to various forms of communication with other devcies. For example it might post JSON to another webservice, or send MQTT messages to a broker. My hosted server also logs device inventories, service requests and so on in a MySQL database. This is all working well.
So what I can't get my head round is the control flow for Supla.
Here's what I have done:
I have looked at the PHP Supla Client at : https://github.com/SUPLA/api-client-php
I have created an OAuth Application under "My OAuth Apps" on Supla.
I have authorised that app in my account at Supla.
I have used "composer" to install the required components on my server.
(We can assume for the purposes of getting this working that my account is the only account) Account linking will come one I get my head round the control flow. I already do amazon account linking, so I should be able to cope with that.
Here's where I am stuck.
The instructions at https://github.com/SUPLA/api-client-php are missing. They stop at a very brief example: $client->getServerInfo();
What I'd like is an example of how my PHP Webservice should now work.
I've done this bit:
Code: Select all
<?php
$client = new \Supla\ApiClient\SuplaApiClient([
'server' => 'svrX.supla.org',
'clientId' => 'YOUR_CLIENT_ID',
'secret' => 'YOUR_SECRET',
'username' => 'YOUR_USERNAME',
'password' => 'YOUR_PASSWORD',
]);
Does anyone have any example code for a back-end web service in PHP?