sdk: new dev site

This commit is contained in:
Koushik Dutta
2024-10-26 11:51:20 -05:00
parent bb7c6ef8b9
commit 68ac42ca46
6 changed files with 1326 additions and 803 deletions

View File

@@ -1,24 +1,9 @@
# Table of Contents
* [Getting Started](#getting-started)
* [Typescript Sample Setup](#typescript-sample-setup)
* [Creating a Switch](#creating-a-switch)
* [Core Concepts](#core-concepts)
* [Interfaces](#interfaces)
* [Events](#events)
* [Creating Multiple Devices](#creating-multiple-devices)
* [Full Reference](/modules)
* [Sample Plugins](https://github.com/koush/scrypted/tree/main/plugins)
* [Camera Provider Sample](https://github.com/koush/scrypted-sample-cameraprovider)
# Scrypted Developer
<br/>
<br/>
# Getting Started
## Getting Started
The quickest way to get started is to check out the the [Typescript sample](https://github.com/koush/scrypted-vscode-typescript) and open it in Visual Studio Code. The setup instructions can be found in the readme for the [project](https://github.com/koush/scrypted-vscode-typescript).
<br/>
## Typescript Sample Setup
These instructions can be followed on your preferred development machine, and do not need to be run on the Scrypted Server itself. The Scrypted SDK can deploy and **debug** plugins running on a remote server. For example, the VS Code development environment can be running on a Mac, while the server is running on a Raspberry Pi.

1948
sdk/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@
"prepublishOnly": "npm run build && cd types && npm version patch && npm publish",
"prebuild": "cd types && npm run build",
"predocs": "npm run build",
"docs": "typedoc && cp developer.scrypted.app/CNAME developer.scrypted.app/docs",
"docs": "typedoc",
"build": "rimraf dist && tsc",
"webpack": "webpack-cli --config webpack.config.js",
"test": "echo \"Error: no test specified\" && exit 1"
@@ -30,10 +30,10 @@
"author": "",
"license": "ISC",
"dependencies": {
"@babel/preset-typescript": "^7.24.7",
"adm-zip": "^0.5.14",
"axios": "^1.7.3",
"babel-loader": "^9.1.3",
"@babel/preset-typescript": "^7.26.0",
"adm-zip": "^0.5.16",
"axios": "^1.7.7",
"babel-loader": "^9.2.1",
"babel-plugin-const-enum": "^1.2.0",
"ncp": "^2.0.0",
"raw-loader": "^4.0.2",
@@ -41,15 +41,17 @@
"tmp": "^0.2.3",
"ts-loader": "^9.5.1",
"typescript": "^5.5.4",
"webpack": "^5.93.0",
"webpack": "^5.95.0",
"webpack-bundle-analyzer": "^4.10.2"
},
"devDependencies": {
"@types/node": "^22.1.0",
"@types/node": "^22.8.1",
"@types/stringify-object": "^4.0.5",
"stringify-object": "^3.3.0",
"ts-node": "^10.9.2",
"typedoc": "^0.26.5"
"typedoc": "^0.26.10",
"typedoc-plugin-markdown": "^4.2.9",
"typedoc-vitepress-theme": "^1.0.2"
},
"types": "dist/src/index.d.ts"
}

View File

@@ -5,7 +5,7 @@
"sort": ["source-order"],
"name": "Scrypted Documentation",
"tsconfig": "./tsconfig.json",
"out": "./developer.scrypted.app/docs",
"out": "./developer.scrypted.app/gen",
"categorizeByGroup": false,
"defaultCategory": "Device Interfaces Reference",
"excludePrivate": true,
@@ -18,6 +18,6 @@
"Mixin Reference",
"WebRTC Reference"
],
"customCss": "./developer.scrypted.app/docs.css",
"plugin": ["typedoc-plugin-markdown", "typedoc-vitepress-theme"],
"readme": "./README.md"
}

View File

@@ -71,8 +71,8 @@ class PanTiltZoomMovement(str, Enum):
class ScryptedDeviceType(str, Enum):
API = "API"
AirPurifier = "AirPurifier"
API = "API"
Automation = "Automation"
Builtin = "Builtin"
Camera = "Camera"
@@ -117,9 +117,9 @@ class ScryptedInterface(str, Enum):
BinarySensor = "BinarySensor"
Brightness = "Brightness"
BufferConverter = "BufferConverter"
CO2Sensor = "CO2Sensor"
Camera = "Camera"
Charger = "Charger"
CO2Sensor = "CO2Sensor"
ColorSettingHsv = "ColorSettingHsv"
ColorSettingRgb = "ColorSettingRgb"
ColorSettingTemperature = "ColorSettingTemperature"
@@ -147,8 +147,8 @@ class ScryptedInterface(str, Enum):
Microphone = "Microphone"
MixinProvider = "MixinProvider"
MotionSensor = "MotionSensor"
NOXSensor = "NOXSensor"
Notifier = "Notifier"
NOXSensor = "NOXSensor"
OauthClient = "OauthClient"
ObjectDetection = "ObjectDetection"
ObjectDetectionGenerator = "ObjectDetectionGenerator"
@@ -156,22 +156,22 @@ class ScryptedInterface(str, Enum):
ObjectDetector = "ObjectDetector"
ObjectTracker = "ObjectTracker"
OccupancySensor = "OccupancySensor"
OnOff = "OnOff"
Online = "Online"
PM10Sensor = "PM10Sensor"
PM25Sensor = "PM25Sensor"
OnOff = "OnOff"
PanTiltZoom = "PanTiltZoom"
PasswordStore = "PasswordStore"
Pause = "Pause"
PM10Sensor = "PM10Sensor"
PM25Sensor = "PM25Sensor"
PositionSensor = "PositionSensor"
PowerSensor = "PowerSensor"
Program = "Program"
PushHandler = "PushHandler"
RTCSignalingChannel = "RTCSignalingChannel"
RTCSignalingClient = "RTCSignalingClient"
Readme = "Readme"
Reboot = "Reboot"
Refresh = "Refresh"
RTCSignalingChannel = "RTCSignalingChannel"
RTCSignalingClient = "RTCSignalingClient"
Scene = "Scene"
Scriptable = "Scriptable"
ScryptedDevice = "ScryptedDevice"
@@ -185,13 +185,12 @@ class ScryptedInterface(str, Enum):
Settings = "Settings"
StartStop = "StartStop"
StreamService = "StreamService"
TTY = "TTY"
TTYSettings = "TTYSettings"
TamperSensor = "TamperSensor"
TemperatureSetting = "TemperatureSetting"
Thermometer = "Thermometer"
TTY = "TTY"
TTYSettings = "TTYSettings"
UltravioletSensor = "UltravioletSensor"
VOCSensor = "VOCSensor"
VideoCamera = "VideoCamera"
VideoCameraConfiguration = "VideoCameraConfiguration"
VideoCameraMask = "VideoCameraMask"
@@ -199,6 +198,7 @@ class ScryptedInterface(str, Enum):
VideoFrameGenerator = "VideoFrameGenerator"
VideoRecorder = "VideoRecorder"
VideoRecorderManagement = "VideoRecorderManagement"
VOCSensor = "VOCSensor"
class ScryptedMimeTypes(str, Enum):
@@ -211,11 +211,11 @@ class ScryptedMimeTypes(str, Enum):
MediaStreamFeedback = "x-scrypted/x-media-stream-feedback"
MediaStreamUrl = "text/x-media-url"
PushEndpoint = "text/x-push-endpoint"
RequestMediaObject = "x-scrypted/x-scrypted-request-media-object"
RequestMediaStream = "x-scrypted/x-scrypted-request-stream"
RTCConnectionManagement = "x-scrypted/x-scrypted-rtc-connection-management"
RTCSignalingChannel = "x-scrypted/x-scrypted-rtc-signaling-channel"
RTCSignalingSession = "x-scrypted/x-scrypted-rtc-signaling-session"
RequestMediaObject = "x-scrypted/x-scrypted-request-media-object"
RequestMediaStream = "x-scrypted/x-scrypted-request-stream"
SchemePrefix = "x-scrypted/x-scrypted-scheme-"
ServerId = "text/x-server-id"
Url = "text/x-uri"
@@ -543,20 +543,6 @@ class EventListenerOptions(TypedDict):
mixinId: str # The EventListener will listen to events and property changes from a device or mixin that is suppressed by a mixin.
watch: bool # This EventListener will passively watch for events, and not initiate polling.
class FFmpegInput(TypedDict):
container: str
destinationVideoBitrate: float
env: Any # Environment variables to set when launching FFmpeg.
ffmpegPath: str # Path to a custom FFmpeg binary.
h264EncoderArguments: list[str]
h264FilterArguments: list[str]
inputArguments: list[str]
mediaStreamOptions: ResponseMediaStreamOptions
url: str # The media url for this FFmpegInput.
urls: list[str] # Alternate media urls for this FFmpegInput.
videoDecoderArguments: list[str]
class FanState(TypedDict):
counterClockwise: bool
@@ -574,6 +560,20 @@ class FanStatus(TypedDict):
speed: float # Rotations per minute, if available, otherwise 0 or 1.
swing: bool
class FFmpegInput(TypedDict):
container: str
destinationVideoBitrate: float
env: Any # Environment variables to set when launching FFmpeg.
ffmpegPath: str # Path to a custom FFmpeg binary.
h264EncoderArguments: list[str]
h264FilterArguments: list[str]
inputArguments: list[str]
mediaStreamOptions: ResponseMediaStreamOptions
url: str # The media url for this FFmpegInput.
urls: list[str] # Alternate media urls for this FFmpegInput.
videoDecoderArguments: list[str]
class HttpRequest(TypedDict):
aclId: str
@@ -982,10 +982,6 @@ class BufferConverter:
pass
class CO2Sensor:
co2ppm: float
class Camera:
"""Camera devices can take still photos."""
@@ -1001,6 +997,10 @@ class Charger:
chargeState: ChargeState
class CO2Sensor:
co2ppm: float
class ColorSettingHsv:
"""ColorSettingHsv sets the color of a colored light using the HSV representation."""
@@ -1218,10 +1218,6 @@ class MotionSensor:
motionDetected: bool
class NOXSensor:
noxDensity: float
class Notifier:
"""Notifier can be any endpoint that can receive messages, such as speakers, phone numbers, messaging clients, etc. The messages may optionally contain media."""
@@ -1229,6 +1225,10 @@ class Notifier:
pass
class NOXSensor:
noxDensity: float
class OauthClient:
"""The OauthClient can be implemented to perform the browser based Oauth process from within a plugin."""
@@ -1283,6 +1283,11 @@ class OccupancySensor:
occupied: bool
class Online:
"""Online denotes whether the device is online or unresponsive. It may be unresponsive due to being unplugged, network error, etc."""
online: bool
class OnOff:
"""OnOff is a basic binary switch."""
@@ -1294,19 +1299,6 @@ class OnOff:
pass
class Online:
"""Online denotes whether the device is online or unresponsive. It may be unresponsive due to being unplugged, network error, etc."""
online: bool
class PM10Sensor:
pm10Density: float
class PM25Sensor:
pm25Density: float
class PanTiltZoom:
ptzCapabilities: PanTiltZoomCapabilities
@@ -1337,6 +1329,14 @@ class Pause:
pass
class PM10Sensor:
pm10Density: float
class PM25Sensor:
pm25Density: float
class PositionSensor:
position: Position
@@ -1510,19 +1510,6 @@ class StreamService:
pass
class TTY:
"""TTY connection offered by a remote device that can be connected to by an interactive terminal interface. Implementors should also implement StreamService to handle the actual data transfer."""
pass
class TTYSettings:
"""TTYSettings allows TTY backends to query plugins for modifications to the (non-)interactive terminal environment."""
async def getTTYSettings(self) -> Any:
pass
class TamperSensor:
tampered: TamperState
@@ -1543,14 +1530,23 @@ class Thermometer:
pass
class TTY:
"""TTY connection offered by a remote device that can be connected to by an interactive terminal interface. Implementors should also implement StreamService to handle the actual data transfer."""
pass
class TTYSettings:
"""TTYSettings allows TTY backends to query plugins for modifications to the (non-)interactive terminal environment."""
async def getTTYSettings(self) -> Any:
pass
class UltravioletSensor:
ultraviolet: float
class VOCSensor:
vocDensity: float
class VideoCamera:
"""VideoCamera devices can capture video streams."""
@@ -1581,10 +1577,10 @@ class VideoClips:
async def getVideoClip(self, videoId: str) -> MediaObject:
pass
async def getVideoClipThumbnail(self, thumbnailId: str, options: VideoClipThumbnailOptions = None) -> MediaObject:
async def getVideoClips(self, options: VideoClipOptions = None) -> list[VideoClip]:
pass
async def getVideoClips(self, options: VideoClipOptions = None) -> list[VideoClip]:
async def getVideoClipThumbnail(self, thumbnailId: str, options: VideoClipThumbnailOptions = None) -> MediaObject:
pass
async def removeVideoClips(self, videoClipIds: list[str]) -> None:
@@ -1622,6 +1618,10 @@ class VideoRecorderManagement:
pass
class VOCSensor:
vocDensity: float
class Logger:
"""Logger is exposed via log.* to allow writing to the Scrypted log."""
@@ -1911,8 +1911,8 @@ class ScryptedInterfaceMethods(str, Enum):
ptzCommand = "ptzCommand"
getRecordedEvents = "getRecordedEvents"
getVideoClip = "getVideoClip"
getVideoClipThumbnail = "getVideoClipThumbnail"
getVideoClips = "getVideoClips"
getVideoClipThumbnail = "getVideoClipThumbnail"
removeVideoClips = "removeVideoClips"
setVideoStreamOptions = "setVideoStreamOptions"
startIntercom = "startIntercom"
@@ -2721,8 +2721,8 @@ ScryptedInterfaceDescriptors = {
"name": "VideoClips",
"methods": [
"getVideoClip",
"getVideoClipThumbnail",
"getVideoClips",
"getVideoClipThumbnail",
"removeVideoClips"
],
"properties": []