承接 rebox98/nrcphp 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rebox98/nrcphp

最新稳定版本:v1.0.2

Composer 安装命令:

composer require rebox98/nrcphp

包简介

PHP library for controlling NrcDevice

README 文档

README

nrcphp is a Python package for working with NRC devices. It provides a convenient interface to connect to an NRC device, send commands, and retrieve information from the device.

🔥 Installation

You can install nrcphp using pip:

composer require rebox98/nrcphp
composer dump-autoload

🪧 Usage

Here is an example of how to use nrcphp to connect to an NRC device and control the relays:

<?php
require 'vendor/autoload.php';

use NrcDevice\NrcDevice;

$ip = '192.168.1.200';
$port = 23;
$username = "admin";
$password = "admin";

$nrc = new NrcDevice([$ip, $port, $username, $password]);
// Open Connection
$nrc->connect();

// Login
if ($nrc->login()) {
    // Commands
    $nrc->relayContact(1, 500);
    $nrc->relayContact(2, 1000);
    $nrc->relayOff(1);
    $nrc->relayOn(2);
    echo "Relays Status (hex): " . $nrc->getRelaysValues() . "\n";
    echo "Relay 1 Status: " . $nrc->getRelayValue(1) . "\n";
    echo "Relay 2 Status: " . $nrc->getRelayValue(2) . "\n";

    try {
        echo "SW Inputs Status: " . $nrc->getSwInputsValues() . "\n";
        echo "SW 1 Status: " . $nrc->getSwInputValue(1) . "\n";
        echo "SW 2 Status: " . $nrc->getSwInputValue(2) . "\n";
        echo "SW 3 Status: " . $nrc->getSwInputValue(3) . "\n";
    } catch (Exception $e) {
        echo "SW Inputs Status: " . $e->getMessage() . "\n";
    }

    try {
        echo "HV Inputs Status: " . $nrc->getHvInputsValues() . "\n";
        echo "HV 1 Status: " . $nrc->getHvInputValue(1) . "\n";
        echo "HV 2 Status: " . $nrc->getHvInputValue(2) . "\n";
        echo "HV 3 Status: " . $nrc->getHvInputValue(3) . "\n";
    } catch (Exception $e) {
        echo "HV Inputs Status: " . $e->getMessage() . "\n";
    }
} else {
    echo "Error in login\n";
}

$nrc->disconnect();

?>

统计信息

  • 总下载量: 3
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-02