Lonhand客户端库

lonhand的Python项目详细描述


Lonhand客户端库

USR IOT实现USR-WP1智能插座(单通道继电器)的Lonhand协议。

Product link

用法:

from lonhand import device

# create switch
switch = WifiRelay('192.168.1.23')

# turn on
switch.turn_on()

# get state
state = switch.is_on()

# turn off
switch.turn_off()

协议

命令:

55 AA - distinguishes a command, unlike for example the password which
        should be sent as is (with suffix 0D 0A)
00 03 - represents the length in bytes of the command (real) that follows,
        including the byte 00 (see below)
00    - fixed, reserved and not usable. However, it contributes to forming 
        the length in bytes of the command, for example in case of a device
        renaming command (which will contain the new name assigned): the
        length byte (and the checksum) will be recalculated also according
        to the length of the new name
02    - the actual command (ON)
01    - command parameter; in this case we are giving the ON command (02)
        and as a parameter the channel number to be switched on (01).
06    - checksum, and represents the sum (in HEX) of the parts: 
        (0x00 + 0x03 + 0x00 + 0x02 + 0x01) = 0x06

响应:

AA 55 - marks the message as a response
00 04 - response length
00    - reserved
82 01 - is the confirmation response to the ON command
01    - channel/port that was affected
88    - checksum: (0x00 + 0x04 + 0x00 + 0x82 + 0x01 + 0x01) = 0x88

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java允许具有不同父类的类扩展类,而无需多重继承   java如何创建动态化的JScrollPane w/JPanel作为客户端?   java如何组织和命名包   在Java中读取属性文件   java无法解释的Android意图行为   在Java中动态执行多个BPEL文件的部署   ssl Java 6 SNI(服务器名称指示)?   java我们可以使用Robot框架自动化web和移动应用程序来执行并行执行   java for star pettern的循环   java为什么BinaryReader在线程中,从netty读取错误的数据包?   在java中将华氏度转换为摄氏度   使用Spark和java处理空值和引号编写CSV文件   Java中已排序日期到块的列表   visual studio代码VSCode Java不是linting或自动完成局部变量,而是自动完成Java快捷方式,如“sysout”