xtend / smart-relay-sdk
SDK For Generic Smart Relay Device
0.1
2022-10-13 08:24 UTC
Requires
- php: ^7.4 || ^8.1
- ext-sockets: *
Requires (Dev)
This package is auto-updated.
Last update: 2025-04-13 14:25:52 UTC
README
Xtend Smart Relay PHP SDK
This contain PHP SDK for Generic Smart Relay
Feature
- Connect to Xtend Smart Relay socket
- Push command for turning on/off selected Pin
- Read Pin status
- Read Switch
Usage
$host = '192.168.100.18'; $port = 50000; $smartRelay = new \Xtend\Device\SmartRelay($host, $port); try { $smartRelay->open(); // open connection to socket var_dump($smartRelay->isConnect()); // check device status var_dump($smartRelay->push(3, SmartRelay::PIN_ON)); // turn on 3rd pin var_dump($smartRelay->push(3, SmartRelay::PIN_OFF)); // turn off 3rd pin $smartRelay->close(); // close cocket connection } catch (\RuntimeException $e) { echo $e->getMessage(); }