Skip to main content

LonHand client library

Project description

LonHand client library

LonHand protocol implementation for USR-WP1 smart socket (one-channel relay) by USR IOT.

Product link

Usage:

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()

Protocol

Command:

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

Response:

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lonhand-0.3.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

lonhand-0.3-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page