SUPLA API Client for PHP
Your home connected. www.supla.org
Installation
Requires PHP 7.3 or later.
Install with Composer.
Getting Started
<?php
require_once(__DIR__ . '/vendor/autoload.php');
use Supla\ApiClient\Api\ChannelsApi;
use Supla\ApiClient\Model\ChannelFunctionEnumNames;
// Get access token from OAuth flow or use a Personal Access Token
$accessToken = '<YOUR_ACCESS_TOKEN_HERE>';
$config = Supla\ApiClient\Configuration::getDefaultConfiguration()->setAccessToken($accessToken);
$apiInstance = new ChannelsApi( new GuzzleHttp\Client(), $config);
try {
$result = $apiInstance->getChannels([ChannelFunctionEnumNames::LIGHTSWITCH]);
print_r($result);
} catch (Exception $e) {
echo 'Exception when calling SUPLA API: ', $e->getMessage(), PHP_EOL;
}
API Endpoints
All URIs are relative to https://YOUR_SUPLA_SERVER/api/v2.4.0
.
Class | Method | HTTP request | Description |
---|---|---|---|
AccessIdentifiersApi | createAccessIdentifier | POST /accessids | Create a new Access Identifier |
AccessIdentifiersApi | deleteAccessIdentifier | DELETE /accessids/{id} | Delete the access identifier |
AccessIdentifiersApi | getAccessIdentifier | GET /accessids/{id} | Get AID by ID |
AccessIdentifiersApi | getAccessIdentifiers | GET /accessids | Get Access Identifiers |
AccessIdentifiersApi | updateAccessIdentifier | PUT /accessids/{id} | Update the access identifier |
ChannelGroupsApi | createChannelGroup | POST /channel-groups | Create a new channel group |
ChannelGroupsApi | deleteChannelGroup | DELETE /channel-groups/{id} | Delete the channel group |
ChannelGroupsApi | executeActionOnChannelGroup | PATCH /channel-groups/{id} | |
ChannelGroupsApi | getChannelGroup | GET /channel-groups/{id} | Get Channel Group |
ChannelGroupsApi | getChannelGroupDirectLinks | GET /channel-groups/{channelGroup}/direct-links | Get channel group direct links |
ChannelGroupsApi | getChannelGroupScenes | GET /channel-groups/{channelGroup}/scenes | Get channel group scenes |
ChannelGroupsApi | getChannelGroups | GET /channel-groups | Get Channel Groups |
ChannelGroupsApi | updateChannelGroup | PUT /channel-groups/{id} | Update the channel group |
ChannelsApi | configureChannel | PATCH /channels/{id}/settings | |
ChannelsApi | createChannelReaction | POST /channels/{channel}/reactions | Create channel reaction |
ChannelsApi | deleteChannelMeasurementLogs | DELETE /channels/{channel}/measurement-logs | Delete channel measurement logs. |
ChannelsApi | deleteChannelReaction | DELETE /channels/{channel}/reactions/{reaction} | Delete channel reaction |
ChannelsApi | downloadChannelMeasurementLogs | GET /channels/{channel}/measurement-logs-download | Get measurement logs as a zipped CSV file. |
ChannelsApi | executeAction | PATCH /channels/{id} | |
ChannelsApi | getChannel | GET /channels/{id} | Get Channel |
ChannelsApi | getChannelChannelGroups | GET /channels/{id}/channel-groups | Get Channel Groups that the given channel belongs to |
ChannelsApi | getChannelDirectLinks | GET /channels/{channel}/direct-links | Get channel direct links |
ChannelsApi | getChannelMeasurementLogs | GET /channels/{channel}/measurement-logs | Get channel measurement logs. |
ChannelsApi | getChannelNotifications | GET /channels/{channel}/notifications | |
ChannelsApi | getChannelReaction | GET /channels/{channel}/reactions/{reaction} | Get channel reaction |
ChannelsApi | getChannelReactions | GET /channels/{channel}/reactions | Get channel reactions |
ChannelsApi | getChannelScenes | GET /channels/{channel}/scenes | Get channel scenes |
ChannelsApi | getChannels | GET /channels | Get Channels |
ChannelsApi | updateChannel | PUT /channels/{id} | |
ChannelsApi | updateChannelReaction | PUT /channels/{channel}/reactions/{reaction} | Update channel reaction |
ClientAppsApi | deleteClientApp | DELETE /client-apps/{id} | Delete the client app |
ClientAppsApi | getClientApps | GET /client-apps | Get Client Apps |
ClientAppsApi | updateClientApp | PUT /client-apps/{id} | Update the client app |
DevicesApi | deleteDevice | DELETE /iodevices/{id} | Delete the device |
DevicesApi | executeDeviceAction | PATCH /iodevices/{id} | |
DevicesApi | getIoDevice | GET /iodevices/{id} | Get Device |
DevicesApi | getIoDeviceNotifications | GET /iodevices/{device}/notifications | |
DevicesApi | getIoDevices | GET /iodevices | Get Devices |
DevicesApi | updateDevice | PUT /iodevices/{id} | |
DirectLinksApi | getDirectLink | GET /direct-links/{directLink} | Get direct link |
DirectLinksApi | getDirectLinks | GET /direct-links | Get Direct Links |
LocationsApi | createLocation | POST /locations | Create a new location |
LocationsApi | deleteLocation | DELETE /locations/{id} | Delete the location |
LocationsApi | getLocation | GET /locations/{id} | Get location by ID |
LocationsApi | getLocations | GET /locations | Get locations |
LocationsApi | updateLocation | PUT /locations/{id} | Update the location |
NotificationsApi | getNotification | GET /notifications/{id} | Get Notification |
NotificationsApi | sendNotification | PATCH /notifications | Send a notification. |
NotificationsApi | updateNotification | PUT /notifications/{notification} | |
OAuthApi | issueAccessToken | POST /oauth/v2/token | Issues an access token based on authorization_code or refresh_token. |
ScenesApi | createScene | POST /scenes | Create a scene |
ScenesApi | deleteScene | DELETE /scenes/{scene} | Delete the scene |
ScenesApi | executeScene | PATCH /scenes/{scene} | |
ScenesApi | getScene | GET /scenes/{scene} | Get Scene |
ScenesApi | getSceneDirectLinks | GET /scenes/{scene}/direct-links | Get scene direct links |
ScenesApi | getSceneScenes | GET /scenes/{scene}/scenes | Get scene scenes |
ScenesApi | getScenes | GET /scenes | Get Scenes |
ScenesApi | updateScene | PUT /scenes/{scene} | Update the scene |
SchedulesApi | getSchedules | GET /schedules | Get Schedules |
ServerApi | getServerInfo | GET /server-info | Get the server info |
ServerApi | getSuplaServerStatus | GET /server-status | Get the SUPLA Server status |
ServerApi | getTokenInfo | GET /token-info | Returns information about used access token |
UserIconsApi | createUserIcon | POST /user-icons | Create a new User Icon |
UserIconsApi | createUserIconBase64 | POST /user-icons.base64 | Create a new User Icon sent in Base64 format. |
UserIconsApi | deleteUserIcon | DELETE /user-icons/{id} | Delete the User Icon |
UserIconsApi | getUserIcon | GET /user-icons/{id} | Get User Icon |
UserIconsApi | getUserIconImage | GET /user-icons/{id}/{imageIndex} | Get User Icon image at specified index |
UserIconsApi | getUserIcons | GET /user-icons | List User Icons |
UsersApi | getCurrentUser | GET /users/current | Get info about user for the token. |
Models
- AccessIdentifier
- AccessIdentifierRelationsCount
- AccessTokenRequestBody
- ActionableSubject
- ActionableSubjectTypeNames
- ActiveHoursDef
- Channel
- ChannelActionParams
- ChannelActionParamsCopy
- ChannelActionParamsDimmer
- ChannelActionParamsDuration
- ChannelActionParamsPercentage
- ChannelActionParamsRgbw
- ChannelActionParamsRgbwOneOf
- ChannelActionParamsRgbwOneOf1
- ChannelActionParamsRgbwOneOf2
- ChannelActionParamsRgbwOneOf2Hsv
- ChannelActionParamsRgbwOneOf3
- ChannelActionParamsRgbwOneOf3Rgb
- ChannelActionParamsSend
- ChannelConfig
- ChannelConfigActionTrigger
- ChannelConfigAlexaSettings
- ChannelConfigAlexaSettingsAlexa
- ChannelConfigControllingTheGate
- ChannelConfigControllingTheGateClosingRule
- ChannelConfigElectricityMeter
- ChannelConfigGoogleHomeSettings
- ChannelConfigGoogleHomeSettingsGoogleHome
- ChannelConfigHumidity
- ChannelConfigHumidityAndThermometer
- ChannelConfigHvacThermostat
- ChannelConfigHvacThermostatSchedule
- ChannelConfigHvacThermostatTemperatureConstraints
- ChannelConfigHvacThermostatTemperatures
- ChannelConfigImpulseCounter
- ChannelConfigInvertedLogic
- ChannelConfigStaircaseTimer
- ChannelConfigThermometer
- ChannelFunction
- ChannelFunctionAction
- ChannelGroup
- ChannelGroupRelationsCount
- ChannelRelationsCount
- ChannelState
- ChannelStateBrightness
- ChannelStateColor
- ChannelStateColorAndBrightness
- ChannelStateConnected
- ChannelStateDepth
- ChannelStateDistance
- ChannelStateDouble
- ChannelStateElectricityMeter
- ChannelStateElectricityMeterPhase
- ChannelStateHumidity
- ChannelStateHumidityAndTemperature
- ChannelStateImpulseCounter
- ChannelStateOnOff
- ChannelStateRelay
- ChannelStateRollerShutter
- ChannelStateSensor
- ChannelStateSensorPartial
- ChannelStateTemperature
- ChannelStateValve
- ChannelType
- ClientApp
- Device
- DeviceConfig
- DeviceConfigHomeScreen
- DeviceManufacturer
- DeviceRelationsCount
- DirectLink
- DirectLinkActiveDateRange
- ErrorResponse
- InlineObject
- InlineObject1
- InlineObject10
- InlineObject11
- InlineObject12
- InlineObject14
- InlineObject2
- InlineObject3
- InlineObject4
- InlineObject5
- InlineObject6
- InlineObject7
- InlineObject8
- InlineObject9
- InlineResponse200
- InlineResponse2001
- InlineResponse2002
- InlineResponse2003
- InlineResponse200Timezone
- InlineResponse400
- InlineResponse4001
- InlineResponse4002
- InlineResponse4003
- InlineResponse409
- InlineResponse503
- Location
- LocationRelationsCount
- Notification
- Reaction
- ReactionTrigger
- ReactionTriggerChange
- ReactionTriggerChangeOnChange
- ReactionTriggerEq
- ReactionTriggerEqOnChangeTo
- ReactionTriggerFieldNames
- ReactionTriggerGe
- ReactionTriggerGeOnChangeTo
- ReactionTriggerGeOnChangeToResume
- ReactionTriggerGt
- ReactionTriggerGtOnChangeTo
- ReactionTriggerGtOnChangeToResume
- ReactionTriggerLe
- ReactionTriggerLeOnChangeTo
- ReactionTriggerLeOnChangeToResume
- ReactionTriggerLt
- ReactionTriggerLtOnChangeTo
- ReactionTriggerLtOnChangeToResume
- ReactionTriggerNe
- ReactionTriggerNeOnChangeTo
- Scene
- SceneOperation
- SceneRelationsCount
- SceneState
- ScenesOperations
- Schedule
- ScheduleClosestExecutions
- ScheduleConfigEntry
- ScheduleConfigEntryAction
- ScheduleScheduledExecution
- ScheduleScheduledExecutionResult
- ScheduleState
- User
- UserAgreements
- UserApiRateLimit
- UserApiRateLimitRule
- UserApiRateLimitStatus
- UserIcon
- UserLimits
- UserLimitsPushNotificationsPerHour
Authorization
Personal Access Token
Generate a Personal Access Token for you in the Integrations section on https://cloud.supla.org or your server instance.
OAuth2
- Flow:
authorizationCode
- Authorization URL:
https://cloud.supla.org/oauth/v2/auth
if the app is public orhttps://YOUR_SUPLA_SERVER/oauth/v2/auth
otherwise - Scopes:
accessids_r
: Access Identifiers (read)accessids_rw
: Access Identifiers (read and modify)account_r
: User account and e-mail address (read)account_rw
: User account (read and modify)channels_r
: Channels (read)channels_rw
: Channels (read and modify)channels_ea
: Channels (execute actions)channels_files
: Download files from API (measurements history, user icons)channelgroups_r
: Channel groups (read)channelgroups_rw
: Channel groups (read and modify)channelgroups_ea
: Channel groups (execute actions)clientapps_r
: Client apps (read)clientapps_rw
: Client apps (read and modify)directlinks_r
: Direct links (read)directlinks_rw
: Direct links (read and modify)iodevices_r
: IO Devices (read)iodevices_rw
: IO Devices (read and modify)locations_r
: Locations (read)locations_rw
: Locations (read and modify)scenes_r
: Scenes (read)scenes_rw
: Scenes (read and modify)scenes_ea
: Scenes (execute actions)schedules_r
: Schedules (read)schedules_rw
: Schedules (read and modify)state_webhook
: Access to state webhooksmqtt_broker
: MQTT Broker settingsoffline_access
: Issue refresh token
- Example Auth URL:
/oauth/v2/auth?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code&scope=account_r%20channels_r&state=example-state
Sources
This PHP package is automatically generated by the OpenAPI Generator project:
- Targeted Cloud version:
23.09.02-69-g0347cdcf
- Build package:
org.openapitools.codegen.languages.PhpClientCodegen