From d358597298c58703ec6e1be69346b033b3be4202 Mon Sep 17 00:00:00 2001 From: Travis Cox Date: Tue, 24 Jan 2023 09:19:54 -0800 Subject: [PATCH] Initial YAML configurations --- bond/README.md | 1 + bond/config.yaml | 122 ++++++++++++++++ directv/README.md | 1 + directv/config.yaml | 59 ++++++++ google_sdm/README.md | 1 + google_sdm/config.yaml | 237 ++++++++++++++++++++++++++++++++ iaqualink/README.md | 1 + iaqualink/config.yaml | 140 +++++++++++++++++++ myq/README.md | 1 + myq/config.yaml | 83 +++++++++++ openweathermap/README.md | 1 + openweathermap/config.yaml | 57 ++++++++ rachio/README.md | 1 + rachio/config.yaml | 164 ++++++++++++++++++++++ ring/README.md | 1 + ring/config.yaml | 157 +++++++++++++++++++++ samsung_smartthings/README.md | 1 + samsung_smartthings/config.yaml | 57 ++++++++ tesla_car/README.md | 1 + tesla_car/config.yaml | 74 ++++++++++ unifi_network/README.md | 1 + unifi_network/config.yaml | 55 ++++++++ unifi_protect/README.md | 1 + unifi_protect/config.yml | 36 +++++ 24 files changed, 1253 insertions(+) create mode 100644 bond/README.md create mode 100644 bond/config.yaml create mode 100644 directv/README.md create mode 100644 directv/config.yaml create mode 100644 google_sdm/README.md create mode 100644 google_sdm/config.yaml create mode 100644 iaqualink/README.md create mode 100644 iaqualink/config.yaml create mode 100644 myq/README.md create mode 100644 myq/config.yaml create mode 100644 openweathermap/README.md create mode 100644 openweathermap/config.yaml create mode 100644 rachio/README.md create mode 100644 rachio/config.yaml create mode 100644 ring/README.md create mode 100644 ring/config.yaml create mode 100644 samsung_smartthings/README.md create mode 100644 samsung_smartthings/config.yaml create mode 100644 tesla_car/README.md create mode 100644 tesla_car/config.yaml create mode 100644 unifi_network/README.md create mode 100644 unifi_network/config.yaml create mode 100644 unifi_protect/README.md create mode 100644 unifi_protect/config.yml diff --git a/bond/README.md b/bond/README.md new file mode 100644 index 0000000..8c8292c --- /dev/null +++ b/bond/README.md @@ -0,0 +1 @@ +# Bond YAML \ No newline at end of file diff --git a/bond/config.yaml b/bond/config.yaml new file mode 100644 index 0000000..f098d26 --- /dev/null +++ b/bond/config.yaml @@ -0,0 +1,122 @@ +version: 1 + +api: + name: Bond Home + description: Interfaces with Bond Home bridge + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/Bond-Home + +variables: + ipAddress: + required: true + token: + required: true + sensitive: true + +headers: + - key: Content-Type + value: application/json + - key: BOND-Token + value: "{{var::token}}" + +functions: + devices: + url: "http://{{var::ipAddress}}/v2/devices" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + - action: function + items: "{{jsonPath::$.[*]}}" + function: deviceInfo + variables: + - name: deviceId + value: "{{item | tagPath}}" + - action: function + items: "{{jsonPath::$.[*]}}" + function: deviceState + variables: + - name: deviceId + value: "{{item | tagPath}}" + + deviceInfo: + url: "http://{{var::ipAddress}}/v2/devices/{{var::handler.deviceId}}" + method: get + actions: + - action: tag + path: "{{var::apiName}}/data/{{var::handler.deviceId}}" + type: jsonExpand + + deviceState: + url: "http://{{var::ipAddress}}/v2/devices/{{var::handler.deviceId}}/state" + method: get + actions: + - action: tag + path: "{{var::apiName}}/data/{{var::handler.deviceId}}" + type: jsonExpand + tags: + - name: light + dataType: Int4 + addIfNotExists: false + handler: + function: deviceAction + variables: + - name: action + value: ToggleLight + - name: deviceId + value: "{{var::handler.tagPath | split::[-2]}}" + - name: power + dataType: Int4 + addIfNotExists: false + handler: + function: deviceAction + variables: + - name: action + value: TogglePower + - name: deviceId + value: "{{var::handler.tagPath | split::[-2]}}" + - name: direction + dataType: Int4 + addIfNotExists: false + handler: + function: deviceAction + variables: + - name: action + value: ToggleDirection + - name: deviceId + value: "{{var::handler.tagPath | split::[-2]}}" + - name: speed + dataType: Int4 + addIfNotExists: false + handler: + function: deviceActionValue + variables: + - name: action + value: SetSpeed + - name: deviceId + value: "{{var::handler.tagPath | split::[-2]}}" + + deviceAction: + url: "http://{{var::ipAddress}}/v2/devices/{{var::handler.deviceId}}/actions/{{var::handler.action}}" + method: put + body: + type: json + value: {} + + deviceActionValue: + url: "http://{{var::ipAddress}}/v2/devices/{{var::handler.deviceId}}/actions/{{var::handler.action}}" + method: put + body: + type: json + value: | + { + "argument": {{var::handler.value}} + } \ No newline at end of file diff --git a/directv/README.md b/directv/README.md new file mode 100644 index 0000000..1373a74 --- /dev/null +++ b/directv/README.md @@ -0,0 +1 @@ +# DirecTV YAML \ No newline at end of file diff --git a/directv/config.yaml b/directv/config.yaml new file mode 100644 index 0000000..01bfd5a --- /dev/null +++ b/directv/config.yaml @@ -0,0 +1,59 @@ +version: 1 + +api: + name: DirecTV + description: Interfaces with DirecTV Genie + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/DirecTV + +variables: + ipAddress: + required: true + port: + default: 8080 + +headers: + - key: Content-Type + value: application/json + - key: Accept + value: "*/*" + +functions: + locations: + url: "http://{{var::ipAddress}}:{{var::port}}/info/getLocations" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + rename: + - items: "{{jsonPath::$.locations[*]}}" + name: "{{jsonPath::item::$.locationName}}" + - action: function + items: "{{jsonPath::$.locations[*]}}" + function: locationTuned + variables: + - name: clientAddr + value: "{{jsonPath::item::$.clientAddr}}" + - name: locationName + value: "{{jsonPath::item::$.locationName}}" + + locationTuned: + url: "http://{{var::ipAddress}}:{{var::port}}/tv/getTuned" + method: get + allowedErrorCodes: + - code: 500 + params: + - name: clientAddr + value: "{{var::handler.clientAddr}}" + actions: + - action: tag + path: "{{var::apiName}}/data/locations/{{var::handler.locationName}}" + type: jsonExpand \ No newline at end of file diff --git a/google_sdm/README.md b/google_sdm/README.md new file mode 100644 index 0000000..151adb2 --- /dev/null +++ b/google_sdm/README.md @@ -0,0 +1 @@ +# Google SDM YAML \ No newline at end of file diff --git a/google_sdm/config.yaml b/google_sdm/config.yaml new file mode 100644 index 0000000..c6addb3 --- /dev/null +++ b/google_sdm/config.yaml @@ -0,0 +1,237 @@ +version: 1 + +api: + name: Google SDM + description: Interfaces with Google Nest using the Smart Device Management API and Google's Pubsub + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/GoogleSDM + +variables: + projectId: + required: true + projectName: + required: true + baseUrl: + default: https://smartdevicemanagement.googleapis.com/v1/enterprises + hidden: true + webhookBaseUrl: + default: https://pubsub.googleapis.com/v1/projects + hidden: true + webhookSubName: + default: ignition-sdm-api + +authType: + type: oauth2 + authUrl: "https://nestservices.google.com/partnerconnections/{{var::projectId}}/auth" + accessTokenUrl: https://www.googleapis.com/oauth2/v4/token + scope: https://www.googleapis.com/auth/sdm.service https://www.googleapis.com/auth/pubsub + grantType: authorizationCode + +headers: + - key: Content-Type + value: application/json + +webhooks: + device: + key: "{{var::webhookSubName}}" + id: "{{var::webhookSubName}}" + ttl: 31 + checkOnStart: true + check: + url: "{{var::webhookBaseUrl}}/{{var::projectName}}/subscriptions/{{var::webhookSubName}}" + method: get + add: + url: "{{var::webhookBaseUrl}}/{{var::projectName}}/subscriptions/{{var::webhookSubName}}" + method: put + body: + type: json + value: | + { + "topic": "projects/sdm-prod/topics/enterprise-{{var::projectId}}", + "pushConfig": { + "pushEndpoint": "{{var::webhook.url}}" + }, + "messageRetentionDuration": "600s", + "retryPolicy": { + "minimumBackoff": "10s", + "maximumBackoff": "600s" + } + } + remove: + url: "{{var::webhookBaseUrl}}/{{var::projectName}}/subscriptions/{{var::webhookSubName}}" + method: delete + handle: + responseFormat: + type: b64Decode + value: "{{jsonPath::$.message.data}}" + actions: + - action: tag + path: "{{var::apiName}}/data/devices/{{jsonPath::$.resourceUpdate.name | split::[3]}}/traits" + filter: "{{jsonPath::$.resourceUpdate.traits}}" + type: jsonExpand + - action: tag + path: "{{var::apiName}}/data/devices/{{jsonPath::$.resourceUpdate.name | split::[3]}}/traits" + filter: "{{jsonPath::$.resourceUpdate.events}}" + type: jsonExpand + - action: function + items: "{{jsonPath::$.resourceUpdate.events[*]}}" + function: generateImage + variables: + - name: tagPath + value: "{{var::apiName}}/data/devices/{{jsonPath::$.resourceUpdate.name | split::[3]}}/traits" + - name: deviceId + value: "{{jsonPath::$.resourceUpdate.name | split::[3]}}" + - name: eventId + value: "{{jsonPath::item::$.eventId}}" + +functions: + devices: + url: "{{var::baseUrl}}/{{var::projectId}}/devices" + method: get + schedule: + type: timer + duration: 60 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + rename: + - items: "{{jsonPath::$.devices[*]}}" + name: "{{jsonPath::item::$.name | split::[3]}}" + tags: + - items: "{{jsonPath::$.devices[*]}}" + path: "{{item | tagPath}}/traits/sdm.devices.traits.ThermostatMode" + name: mode + dataType: String + addIfNotExists: false + handler: + function: thermostatMode + variables: + - name: deviceId + value: "{{var::handler.tagPath | split::[3]}}" + - items: "{{jsonPath::$.devices[*]}}" + path: "{{item | tagPath}}/traits/sdm.devices.traits.ThermostatEco" + name: mode + dataType: String + addIfNotExists: false + handler: + function: thermostatEcoMode + variables: + - name: deviceId + value: "{{var::handler.tagPath | split::[3]}}" + - items: "{{jsonPath::$.devices[*]}}" + path: "{{item | tagPath}}/traits/sdm.devices.traits.ThermostatTemperatureSetpoint" + name: heatCelsius + dataType: Float4 + addIfNotExists: false + handler: + function: temperatureHeat + variables: + - name: deviceId + value: "{{var::handler.tagPath | split::[3]}}" + - items: "{{jsonPath::$.devices[*]}}" + path: "{{item | tagPath}}/traits/sdm.devices.traits.ThermostatTemperatureSetpoint" + name: coolCelsius + dataType: Float4 + addIfNotExists: false + handler: + function: temperatureCool + variables: + - name: deviceId + value: "{{var::handler.tagPath | split::[3]}}" + + thermostatMode: + url: "{{var::baseUrl}}/{{var::projectId}}/devices/{{var::handler.deviceId}}:executeCommand" + method: post + body: + type: json + value: | + { + "command": "sdm.devices.commands.ThermostatMode.SetMode", + "params": { + "mode": "{{var::handler.value}}" + } + } + + thermostatEcoMode: + url: "{{var::baseUrl}}/{{var::projectId}}/devices/{{var::handler.deviceId}}:executeCommand" + method: post + body: + type: json + value: | + { + "command": "sdm.devices.commands.ThermostatEco.SetMode", + "params": { + "mode": "{{var::handler.value}}" + } + } + + temperatureHeat: + url: "{{var::baseUrl}}/{{var::projectId}}/devices/{{var::handler.deviceId}}:executeCommand" + method: post + body: + type: json + value: | + { + "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetHeat", + "params": { + "heatCelsius": "{{var::handler.value}}" + } + } + + temperatureCool: + url: "{{var::baseUrl}}/{{var::projectId}}/devices/{{var::handler.deviceId}}:executeCommand" + method: post + body: + type: json + value: | + { + "command": "sdm.devices.commands.ThermostatTemperatureSetpoint.SetCool", + "params": { + "coolCelsius": "{{var::handler.value}}" + } + } + + generateImage: + url: "{{var::baseUrl}}/{{var::projectId}}/devices/{{var::handler.deviceId}}:executeCommand" + method: post + body: + type: json + value: | + { + "command": "sdm.devices.commands.CameraEventImage.GenerateImage", + "params": { + "eventId": "{{var::handler.eventId}}" + } + } + actions: + - action: function + function: downloadImage + variables: + - name: tagPath + value: "{{var::handler.tagPath}}" + - name: deviceId + value: "{{var::handler.deviceId}}" + - name: token + value: "{{jsonPath::$.results.token}}" + - name: url + value: "{{jsonPath::$.results.url}}" + + downloadImage: + url: "{{var::handler.url}}" + method: get + headers: + - key: Authorization + value: "{{var::handler.token}}" + responseType: bytes + actions: + - action: storeFile + fileId: "{{var::handler.deviceId}}" + fileName: "{{var::handler.deviceId}}" + extension: jpeg + contentType: image/jpeg + path: "{{var::handler.tagPath}}" \ No newline at end of file diff --git a/iaqualink/README.md b/iaqualink/README.md new file mode 100644 index 0000000..bee373e --- /dev/null +++ b/iaqualink/README.md @@ -0,0 +1 @@ +# iAquaLink YAML \ No newline at end of file diff --git a/iaqualink/config.yaml b/iaqualink/config.yaml new file mode 100644 index 0000000..2fd6743 --- /dev/null +++ b/iaqualink/config.yaml @@ -0,0 +1,140 @@ +version: 1 + +api: + name: iAquaLink + description: Interfaces with iAquaLink pool system + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/iAquaLink + +variables: + apiKey: + default: EOOEMOW4YR6QNB07 + hidden: true + loginUrl: + default: https://prod.zodiac-io.com/users/v1/login + hidden: true + devicesUrl: + default: https://r-api.iaqualink.net/devices.json + hidden: true + sessionUrl: + default: https://p-api.iaqualink.net/v1/mobile/session.json + hidden: true + +authType: + type: token + url: "{{var::loginUrl}}" + usernameKey: email + passwordKey: password + params: + - name: api_key + value: "{{var::apiKey}}" + expiresIn: 3600 + tokens: + - name: id + - name: authentication_token + - name: session_id + +headers: + - key: Content-Type + value: application/json + +functions: + devices: + url: "{{var::devicesUrl}}" + method: get + params: + - name: api_key + value: "{{var::apiKey}}" + - name: authentication_token + value: "{{var::auth-authentication_token}}" + - name: user_id + value: "{{var::auth-id}}" + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/devices" + type: jsonExpand + rename: + - items: "{{jsonPath::$[*]}}" + name: "{{jsonPath::item::$.name}}" + - action: function + items: "{{jsonPath::$[*]}}" + function: deviceHome + variables: + - name: serial + value: "{{jsonPath::item::$.serial_number}}" + - name: deviceName + value: "{{jsonPath::item::$.name}}" + - action: function + items: "{{jsonPath::$[*]}}" + function: deviceDevices + variables: + - name: serial + value: "{{jsonPath::item::$.serial_number}}" + - name: deviceName + value: "{{jsonPath::item::$.name}}" + - action: function + items: "{{jsonPath::$[*]}}" + function: deviceOneTouch + variables: + - name: serial + value: "{{jsonPath::item::$.serial_number}}" + - name: deviceName + value: "{{jsonPath::item::$.name}}" + + deviceHome: + url: "{{var::sessionUrl}}" + method: get + params: + - name: sessionID + value: "{{var::auth-session_id}}" + - name: serial + value: "{{var::handler.serial}}" + - name: actionID + value: command + - name: command + value: get_home + actions: + - action: tag + path: "{{var::apiName}}/devices/{{var::handler.deviceName}}" + type: jsonExpand + + deviceDevices: + url: "{{var::sessionUrl}}" + method: get + params: + - name: sessionID + value: "{{var::auth-session_id}}" + - name: serial + value: "{{var::handler.serial}}" + - name: actionID + value: command + - name: command + value: get_devices + actions: + - action: tag + path: "{{var::apiName}}/devices/{{var::handler.deviceName}}" + type: jsonExpand + + deviceOneTouch: + url: "{{var::sessionUrl}}" + method: get + params: + - name: sessionID + value: "{{var::auth-session_id}}" + - name: serial + value: "{{var::handler.serial}}" + - name: actionID + value: command + - name: command + value: get_onetouch + actions: + - action: tag + path: "{{var::apiName}}/devices/{{var::handler.deviceName}}" + type: jsonExpand \ No newline at end of file diff --git a/myq/README.md b/myq/README.md new file mode 100644 index 0000000..99796f7 --- /dev/null +++ b/myq/README.md @@ -0,0 +1 @@ +# MyQ YAML \ No newline at end of file diff --git a/myq/config.yaml b/myq/config.yaml new file mode 100644 index 0000000..f77cf7a --- /dev/null +++ b/myq/config.yaml @@ -0,0 +1,83 @@ +version: 1 + +api: + name: MyQ + description: Interfaces with MyQ garage door + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/MyQ + +variables: + oauthUrl: + default: https://partner-identity.myq-cloud.com + hidden: true + baseUrl: + default: https://devices.myq-cloud.com/api/v5.2 + hidden: true + accountsUrl: + default: https://accounts.myq-cloud.com/api/v6.0/accounts + hidden: true + +authType: + type: oauth2 + grantType: authorizationCode + authUrl: "{{var::oauthUrl}}/connect/authorize" + accessTokenUrl: "{{var::oauthUrl}}/connect/token" + usernameInput: Email + passwordInput: Password + redirectUrl: com.myqops://ios + scope: MyQ_Residential offline_access + clientId: IOS_CGI_MYQ + clientSecret: VlVRMFJGaHVTM2xRVjNFeU5VSlRkdz09 + pkce: true + randomUserAgent: true + +functions: + userInfo: + url: "{{var::accountsUrl}}" + method: get + actions: + - action: variable + name: id + value: "{{jsonPath::$.accounts[0].id}}" + + devices: + depends: userInfo + url: "{{var::baseUrl}}/Accounts/{{var::userInfo.id}}/Devices" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + rename: + - items: "{{jsonPath::$.items[*]}}" + name: "{{jsonPath::item::$.serial_number}}" + tags: + - items: "{{jsonPath::$.items[*]}}" + path: "{{item | tagPath}}/state" + name: door_state + dataType: String + addIfNotExists: false + handler: + function: doorAction + variables: + - name: id + value: "{{var::userInfo.id}}" + - name: deviceId + tagPath: "{{var::handler.tagPath | split::[:-2]}}/serial_number" + + doorAction: + url: "{{var::baseUrl}}/Accounts/{{var::userInfo.id}}/Devices/{{var::handler.deviceId}}/actions" + method: put + body: + type: json + value: | + { + "action_type": "{{var::handler.value}}" + } \ No newline at end of file diff --git a/openweathermap/README.md b/openweathermap/README.md new file mode 100644 index 0000000..ca9f591 --- /dev/null +++ b/openweathermap/README.md @@ -0,0 +1 @@ +# Open Weather Map YAML \ No newline at end of file diff --git a/openweathermap/config.yaml b/openweathermap/config.yaml new file mode 100644 index 0000000..ec04e7f --- /dev/null +++ b/openweathermap/config.yaml @@ -0,0 +1,57 @@ +version: 1 + +api: + name: OpenWeatherMap + description: Interfaces with OpenWeatherMap for current and forecast data + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/OpenWeatherMap + +variables: + appId: + required: true + cityId: + required: true + baseUrl: + default: https://api.openweathermap.org/data/2.5 + hidden: true + +functions: + currentWeather: + url: "{{var::baseUrl}}/weather" + method: get + params: + - name: appid + value: "{{var::appId}}" + - name: id + value: "{{var::cityId}}" + - name: units + value: imperial + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/current" + type: jsonExpand + forecast: + url: "{{var::baseUrl}}/forecast" + method: get + params: + - name: appid + value: "{{var::appId}}" + - name: id + value: "{{var::cityId}}" + - name: units + value: imperial + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/forecast" + type: jsonExpand \ No newline at end of file diff --git a/rachio/README.md b/rachio/README.md new file mode 100644 index 0000000..a2af9c4 --- /dev/null +++ b/rachio/README.md @@ -0,0 +1 @@ +# Rachio YAML \ No newline at end of file diff --git a/rachio/config.yaml b/rachio/config.yaml new file mode 100644 index 0000000..4c0efec --- /dev/null +++ b/rachio/config.yaml @@ -0,0 +1,164 @@ +version: 1 + +api: + name: Rachio + description: Interfaces with Rachio irrigation system + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/Rachio + +variables: + baseUrl: + default: https://api.rach.io/1/public + hidden: true + +authType: + type: bearer + +headers: + - key: Content-Type + value: application/json + +webhooks: + device: + check: + url: "{{var::baseUrl}}/notification/webhook/{{var::handler.id}}" + method: get + add: + url: "{{var::baseUrl}}/notification/webhook" + method: post + body: + type: json + value: | + {"device": + {"id":"{{var::handler.deviceId}}"}, + "url":"{{var::handler.url}}", + "eventTypes":[{"id":"5"}, {"id":"10"}] + } + actions: + - action: variable + name: id + value: "{{jsonPath::$.id}}" + remove: + url: "{{var::baseUrl}}/notification/webhook/{{var::webhook.id}}" + method: delete + handle: + actions: + - action: tag + path: "{{var::apiName}}/data/person/devices/{{var::webhook.key}}" + type: switch + cases: + - conditionKey: "{{jsonPath::$.subType}}" + conditionOperator: in + conditionValue: "{{array::[OFFLINE, ONLINE]}}" + variables: + - name: path + value: status + - name: value + value: "{{jsonPath::$.subType}}" + - conditionKey: "{{jsonPath::$.subType}}" + conditionOperator: in + conditionValue: "{{array::[ZONE_STARTED, ZONE_COMPLETED]}}" + variables: + - name: path + value: "zones/{{jsonPath::$.zoneName}}/status" + - name: value + value: "{{jsonPath::$.subType}}" + +functions: + personInfo: + url: "{{var::baseUrl}}/person/info" + method: get + actions: + - action: variable + name: id + value: "{{jsonPath::$.id}}" + webhooks: + depends: personInfo + url: "{{var::baseUrl}}/person/{{var::personInfo.id}}" + method: get + schedule: + type: timer + duration: 0 + actions: + - action: webhook + items: "{{jsonPath::$.devices[*]}}" + name: device + key: "{{jsonPath::item::$.name}}" + variables: + - name: deviceId + value: "{{jsonPath::item::$.id}}" + person: + depends: personInfo + url: "{{var::baseUrl}}/person/{{var::personInfo.id}}" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/person" + type: jsonExpand + udts: + - id: zone + defPath: "{{var::apiName}}/zone" + items: "{{jsonPath::$.devices[*].zones[*]}}" + path: "{{item | tagPath}}" + name: "{{jsonPath::item::$.name}}" + tags: + - name: status + dataType: String + - path: start + name: runDuration + dataType: Int4 + defaultValue: 0 + handler: + write: true + - path: start + name: zoneStart + dataType: Boolean + defaultValue: false + handler: + function: zoneStart + reset: true + variables: + - name: id + tagPath: "{{var::handler.parentPath}}/id" + - name: duration + tagPath: "{{var::handler.parentPath}}/start/runDuration" + - id: device + defPath: "{{var::apiName}}/device" + items: "{{jsonPath::$.devices[*]}}" + path: "{{item | tagPath}}" + name: "{{jsonPath::item::$.name}}" + tags: + - name: stopWater + dataType: Boolean + defaultValue: false + handler: + function: stopWater + reset: true + variables: + - name: id + tagPath: "{{var::handler.parentPath}}/id" + stopWater: + url: "{{var::baseUrl}}/device/stop_water" + method: put + body: + type: json + params: + - name: id + value: "{{var::handler.id}}" + zoneStart: + url: "{{var::baseUrl}}/zone/start" + method: put + body: + type: json + params: + - name: id + value: "{{var::handler.id}}" + - name: duration + value: "{{var::handler.duration}}" \ No newline at end of file diff --git a/ring/README.md b/ring/README.md new file mode 100644 index 0000000..fbed336 --- /dev/null +++ b/ring/README.md @@ -0,0 +1 @@ +# Ring YAML \ No newline at end of file diff --git a/ring/config.yaml b/ring/config.yaml new file mode 100644 index 0000000..233e621 --- /dev/null +++ b/ring/config.yaml @@ -0,0 +1,157 @@ +version: 1 + +api: + name: Ring + description: Interfaces with Ring devices + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/Ring + +variables: + apiVersion: + default: 9 + hidden: true + userAgent: + default: Ignition/1.0 + hidden: true + hardwareId: + uuid: true + baseUrl: + default: https://api.ring.com + hidden: true + +authType: + type: oauth2 + accessTokenUrl: https://oauth.ring.com/oauth/token + headers: + - key: User-Agent + value: "{{var::userAgent}}" + - key: hardware_id + value: "{{var::hardwareId}}" + scope: client + grantType: password + 2fa: true + clientId: ring_official_android + +headers: + - key: User-Agent + value: "{{var::userAgent}}" + - key: Content-Type + value: application/json + +functions: + session: + url: "{{var::baseUrl}}/clients_api/session" + method: post + body: + type: json + value: | + { + "api_version": "{{var::apiVersion}}", + "device": { + "os": "android", + "app_brand": "ring", + "hardware_id": "{{var::hardwareId}}", + "metadata": { + "device_model": "KVM", + "device_name": "Python", + "resolution": "600x800", + "app_version": "1.3.806", + "app_instalation_date": "", + "manufacturer": "Qemu", + "device_type": "desktop", + "architecture": "desktop", + "language": "en" + } + } + } + + devices: + depends: session + url: "{{var::baseUrl}}/clients_api/ring_devices" + method: get + params: + - name: api_version + value: "{{var::apiVersion}}" + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + rename: + - items: "{{jsonPath::$.doorbots[*]}}" + name: "{{jsonPath::item::$.description}}" + - items: "{{jsonPath::$.stickup_cams[*]}}" + name: "{{jsonPath::item::$.description}}" + - items: "{{jsonPath::$.chimes[*]}}" + name: "{{jsonPath::item::$.description}}" + - action: function + items: "{{jsonPath::$.doorbots[*]}}" + function: last_recording_id + variables: + - name: deviceId + value: "{{jsonPath::item::$.id}}" + - name: deviceName + value: "{{jsonPath::item::$.description}}" + - name: deviceType + value: doorbots + - action: function + items: "{{jsonPath::$.stickup_cams[*]}}" + function: last_recording_id + variables: + - name: deviceId + value: "{{jsonPath::item::$.id}}" + - name: deviceName + value: "{{jsonPath::item::$.description}}" + - name: deviceType + value: stickup_cams + + last_recording_id: + url: "{{var::baseUrl}}/clients_api/doorbots/{{var::handler.deviceId}}/history" + method: get + params: + - name: api_version + value: "{{var::apiVersion}}" + - name: limit + value: 1 + actions: + - action: tag + path: "{{var::apiName}}/data/{{var::handler.deviceType}}/{{var::handler.deviceName}}/last_event" + type: jsonExpand + filter: "{{jsonPath::$[0]}}" + - action: function + function: last_recording_url + runIf: + type: storeFileIdNotExists + fileId: "{{jsonPath::$[0].id}}" + fileName: "{{var::handler.deviceId}}" + variables: + - name: deviceId + value: "{{var::handler.deviceId}}" + - name: deviceName + value: "{{var::handler.deviceName}}" + - name: deviceType + value: "{{var::handler.deviceType}}" + - name: historyId + value: "{{jsonPath::$[0].id}}" + + last_recording_url: + url: "{{var::baseUrl}}/clients_api/dings/{{var::handler.historyId}}/recording" + method: get + redirectNoHeaders: true + params: + - name: api_version + value: "{{var::apiVersion}}" + responseType: bytes + actions: + - action: storeFile + fileId: "{{var::handler.historyId}}" + fileName: "{{var::handler.deviceId}}" + extension: mp4 + contentType: video/mp4 + path: "{{var::apiName}}/data/{{var::handler.deviceType}}/{{var::handler.deviceName}}" \ No newline at end of file diff --git a/samsung_smartthings/README.md b/samsung_smartthings/README.md new file mode 100644 index 0000000..f0dd0cf --- /dev/null +++ b/samsung_smartthings/README.md @@ -0,0 +1 @@ +# Samsung SmartThings YAML \ No newline at end of file diff --git a/samsung_smartthings/config.yaml b/samsung_smartthings/config.yaml new file mode 100644 index 0000000..33aecbd --- /dev/null +++ b/samsung_smartthings/config.yaml @@ -0,0 +1,57 @@ +version: 1 + +api: + name: Samsung SmartThings + description: Interfaces with Samsung SmartThings + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/Samsung + +variables: + baseUrl: + default: https://api.smartthings.com/v1 + hidden: true + +authType: + type: bearer + +headers: + - key: Content-Type + value: application/json + - key: Accept + value: "*/*" + +functions: + devices: + url: "{{var::baseUrl}}/devices" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand + rename: + - items: "{{jsonPath::$.items[*]}}" + name: "{{jsonPath::item::$.label}}" + - action: function + items: "{{jsonPath::$.items[*]}}" + function: deviceStatus + variables: + - name: deviceId + value: "{{jsonPath::item::$.deviceId}}" + - name: deviceName + value: "{{jsonPath::item::$.label}}" + + deviceStatus: + url: "{{var::baseUrl}}/devices/{{var::handler.deviceId}}/status" + method: get + actions: + - action: tag + path: "{{var::apiName}}/data/items/{{var::handler.deviceName}}" + filter: "{{jsonPath::$.components}}" + type: jsonExpand \ No newline at end of file diff --git a/tesla_car/README.md b/tesla_car/README.md new file mode 100644 index 0000000..7bd0f00 --- /dev/null +++ b/tesla_car/README.md @@ -0,0 +1 @@ +# Tesla Car YAML \ No newline at end of file diff --git a/tesla_car/config.yaml b/tesla_car/config.yaml new file mode 100644 index 0000000..643c5db --- /dev/null +++ b/tesla_car/config.yaml @@ -0,0 +1,74 @@ +version: 1 + +api: + name: Tesla + description: Interfaces with Tesla vehicles + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/Tesla + +variables: + baseUrl: + default: https://owner-api.teslamotors.com/api/1 + hidden: true + +authType: + type: oauth2 + grantType: authorizationCode + authUrl: https://auth.tesla.com/oauth2/v3/authorize + accessTokenUrl: https://auth.tesla.com/oauth2/v3/token + redirectUrl: https://auth.tesla.com/void/callback + scope: openid email offline_access + clientId: ownerapi + pkce: true + authCode: true + +headers: + - key: Content-Type + value: application/json + +functions: + vehicles: + url: "{{var::baseUrl}}/vehicles" + method: get + schedule: + type: timer + duration: 15 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/vehicles" + type: jsonExpand + rename: + - items: "{{jsonPath::$.response[*]}}" + name: "{{jsonPath::item::$.id}}" + - action: function + type: condition + items: "{{jsonPath::$.response[*]}}" + conditionKey: "{{jsonPath::item::$.state}}" + conditionOperator: eq + conditionValue: online + falseFunction: wake + trueFunction: vehicleData + variables: + - name: vehicleId + value: "{{jsonPath::item::$.id}}" + retry: + duration: 30 + unit: seconds + max: 5 + + vehicleData: + url: "{{var::baseUrl}}/vehicles/{{var::handler.vehicleId}}/vehicle_data" + method: get + actions: + - action: tag + path: "{{var::apiName}}/data/vehicles/response/{{var::handler.vehicleId}}" + filter: "{{jsonPath::$.response}}" + type: jsonExpand + + wake: + url: "{{var::baseUrl}}/vehicles/{{var::handler.vehicleId}}/wake_up" + method: post diff --git a/unifi_network/README.md b/unifi_network/README.md new file mode 100644 index 0000000..7d611ec --- /dev/null +++ b/unifi_network/README.md @@ -0,0 +1 @@ +# Unifi Network YAML \ No newline at end of file diff --git a/unifi_network/config.yaml b/unifi_network/config.yaml new file mode 100644 index 0000000..c616f48 --- /dev/null +++ b/unifi_network/config.yaml @@ -0,0 +1,55 @@ +version: 1 + +api: + name: UniFi Network + description: Interfaces with UniFi Network by Ubiquiti Networks + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/UniFiNetwork + +httpsVerification: false + +variables: + baseUrl: + required: true + +authType: + type: session + url: "{{var::baseUrl}}/api/auth/login" + params: + - name: remember + value: true + +functions: + clients: + url: "{{var::baseUrl}}/proxy/network/api/s/default/stat/sta" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/clients" + filter: "{{jsonPath::$.data}}" + type: jsonExpand + rename: + - items: "{{jsonPath::$.[*]}}" + name: "{{jsonPath::item::$.name}}" + devices: + url: "{{var::baseUrl}}/proxy/network/api/s/default/stat/device" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data/devices" + filter: "{{jsonPath::$.data}}" + type: jsonExpand + rename: + - items: "{{jsonPath::$.[*]}}" + name: "{{jsonPath::item::$.name}}" \ No newline at end of file diff --git a/unifi_protect/README.md b/unifi_protect/README.md new file mode 100644 index 0000000..f732f9e --- /dev/null +++ b/unifi_protect/README.md @@ -0,0 +1 @@ +# Unifi Protect YAML \ No newline at end of file diff --git a/unifi_protect/config.yml b/unifi_protect/config.yml new file mode 100644 index 0000000..d4bd801 --- /dev/null +++ b/unifi_protect/config.yml @@ -0,0 +1,36 @@ +version: 1 + +api: + name: UniFi Protect + description: Interfaces with UniFi Protect by Ubiquiti Networks + version: 1.0.0 + author: + name: Travis Cox + email: travis@kyvislabs.com + url: https://github.com/Kyvis-Labs/API-YAML/UniFiProtect + +httpsVerification: false + +variables: + baseUrl: + required: true + +authType: + type: session + url: "{{var::baseUrl}}/api/auth/login" + params: + - name: remember + value: true + +functions: + cameras: + url: "{{var::baseUrl}}/proxy/protect/api/bootstrap" + method: get + schedule: + type: timer + duration: 5 + unit: minutes + actions: + - action: tag + path: "{{var::apiName}}/data" + type: jsonExpand \ No newline at end of file