Git Product home page Git Product logo

insteon's Introduction

Go Insteon

Go Report Card Build Status GoDoc Coverage Status

This package provides a Go interface to Insteon networks and the ability to control Insteon devices. This package is being actively developed and the API is subject to change. Consider this library to be in an alpha stage of development

CLI Utility

The package provides the "ic" command line tool to perform various administrative tasks related to the Insteon network and its devices.

Insteon Network Daemon

TODO: A REST interface to the Insteon network. Will include abstractions for common tasks such as creating virtual N-Way light switches as well as scenes

Insteon Network Client

TODO: A client application to the Insteon Network Daemon

API

The package can be used directly from other go programs by means of the github.com/abates/insteon package. See the godocs for more information.

Documentation/Notes

insteon's People

Contributors

abates avatar rspier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

insteon's Issues

Alternative implementation of Insteon libraries

Have you looked at: https://github.com/TD22057/insteon-mqtt
That's an Insteon implementation similar to yours but written in Python.

Instead of having an API everything is done using MQTT. There is a Insteon server that talks to the PLM and to the MQTT broker. The CLI commands send MQTT to the broker which request the server to do various actions. This results in the CLI being completely decoupled from the sever code. The decoupling also allows the CLI and server to be on different machines.

MQTT works really well as a transport because various other people have written MQTT servers for their hardware. By using a common protocol for the MQTT commands you can control devices from multiple vendors using a common platform.
https://www.home-assistant.io/docs/mqtt/discovery/

Of course I prefer Go since it is far smaller and faster than Python.

FR: easier linking for KeyPadLinc devices

KeyPadLinc devices require setting the link group (and possibly the D3 data) when linking. It would be cool if there was a cleaner way of doing it than ic device edit and hoping not to totally mess things up.

I think there are some standards, where d1 is target brightness, d2 is ramp rate, and for keypads d3 is which button.

can't fetch link database from two devices

There's a high probability that I'm missing something obvious.... but I can't seem to fetch the link database from two devices while using the same *plm.PLM twice.

I think this used to work (many many months ago while we were debugging the timeout issues in #2), and it's not obvious to me what changed. Or maybe my PLM is just wonky.

Simple reproduction: main.go

Output:

$ go run . --logtostderr --port /dev/ttyUSB1
modem opened as PLM (34.78.d9)
I1126 19:58:21.011128   14421 main.go:41] fetch(33.ad.00)
2019/11/26 19:58:21 DEBUG Retrieving Device link database
found 6 links on 33.ad.00
I1126 19:58:34.687887   14421 main.go:41] fetch(33.14.1d)
E1126 19:58:37.688169   14421 main.go:74] error connecting to 33.14.1d: Ack Timeout
I1126 19:58:47.688381   14421 main.go:41] fetch(2c.7d.24)
E1126 19:58:50.688690   14421 main.go:74] error connecting to 2c.7d.24: Ack Timeout

The order of the addresses doesn't matter. (i.e. it's not a problem with a specific device, or specific type of device.) Adding time.Sleep() calls doesn't help.

Dimmer Status: Read Timeout

I receive a Read Timeout error when attempting to query the status (onlevel) of my switchlink dimmer. I'm not terribly familiar with the insteon protocol yet, but I know that 0x19 is the status command, which means the switch should respond with 0x19 and the onlevel.

My switch seems to respond with the proper onlevel in the last ACK I see in my trace (0x4f in this case). Am I perhaps just reading the trace wrong?

./device -log trace -timeout 10s -port /dev/tty.usbserial-A906XKUI dimmer status 29.d8.8f
2019/01/04 17:47:25 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 29.d8.8f SD     2:2 Engine Version []} to network
2019/01/04 17:47:25 DEBUG Sending packet to port
2019/01/04 17:47:25 plm.(*Port).send:101 TRACE TX 02 62 29 d8 8f 0a 0d 00
2019/01/04 17:47:25 plm.(*Port).readPacket:128 TRACE Attempting to read 7 more bytes
2019/01/04 17:47:25 plm.(*Port).readPacket:130 TRACE Completed read: 02 62 29 d8 8f 0a 0d 00 06
2019/01/04 17:47:25 plm.(*Port).readLoop:56 TRACE RX 02 62 29 d8 8f 0a 0d 00 06
2019/01/04 17:47:25 plm.(*PLM).receive:193 TRACE RX Send INSTEON Msg 00 00 00 29 d8 8f 0a 0d 00 ACK
2019/01/04 17:47:26 plm.(*Port).readPacket:128 TRACE Attempting to read 9 more bytes
2019/01/04 17:47:26 plm.(*Port).readPacket:130 TRACE Completed read: 02 50 29 d8 8f 49 f8 88 2a 0d 02
2019/01/04 17:47:26 plm.(*Port).readLoop:56 TRACE RX 02 50 29 d8 8f 49 f8 88 2a 0d 02
2019/01/04 17:47:26 plm.(*PLM).receive:193 TRACE RX Std Msg Received 29 d8 8f 49 f8 88 2a 0d 02
2019/01/04 17:47:26 insteon.(*Network).receive:100 TRACE Received Insteon Message &{29.d8.8f 49.f8.88 SD Ack 2:2 Command(0x02, 0x0d, 0x02) []}
2019/01/04 17:47:26 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 29.d8.8f SD     2:2 ID Request []} to network
2019/01/04 17:47:26 DEBUG Sending packet to port
2019/01/04 17:47:26 plm.(*Port).send:101 TRACE TX 02 62 29 d8 8f 0a 10 00
2019/01/04 17:47:26 plm.(*Port).readPacket:128 TRACE Attempting to read 7 more bytes
2019/01/04 17:47:26 plm.(*Port).readPacket:130 TRACE Completed read: 02 62 29 d8 8f 0a 10 00 06
2019/01/04 17:47:26 plm.(*Port).readLoop:56 TRACE RX 02 62 29 d8 8f 0a 10 00 06
2019/01/04 17:47:26 plm.(*PLM).receive:193 TRACE RX Send INSTEON Msg 00 00 00 29 d8 8f 0a 10 00 ACK
2019/01/04 17:47:26 plm.(*Port).readPacket:128 TRACE Attempting to read 9 more bytes
2019/01/04 17:47:26 plm.(*Port).readPacket:130 TRACE Completed read: 02 50 29 d8 8f 49 f8 88 2a 10 00
2019/01/04 17:47:26 plm.(*Port).readLoop:56 TRACE RX 02 50 29 d8 8f 49 f8 88 2a 10 00
2019/01/04 17:47:26 plm.(*PLM).receive:193 TRACE RX Std Msg Received 29 d8 8f 49 f8 88 2a 10 00
2019/01/04 17:47:26 insteon.(*Network).receive:100 TRACE Received Insteon Message &{29.d8.8f 49.f8.88 SD Ack 2:2 Command(0x02, 0x10, 0x00) []}
2019/01/04 17:47:26 plm.(*Port).readPacket:128 TRACE Attempting to read 9 more bytes
2019/01/04 17:47:26 plm.(*Port).readPacket:130 TRACE Completed read: 02 50 29 d8 8f 01 20 41 8f 01 74
2019/01/04 17:47:26 plm.(*Port).readLoop:56 TRACE RX 02 50 29 d8 8f 01 20 41 8f 01 74
2019/01/04 17:47:26 plm.(*PLM).receive:193 TRACE RX Std Msg Received 29 d8 8f 01 20 41 8f 01 74
2019/01/04 17:47:26 insteon.(*Network).receive:100 TRACE Received Insteon Message &{29.d8.8f 01.20.41 SB     3:3 Set-button Pressed (responder)(116) []}
2019/01/04 17:47:26 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 29.d8.8f SD     2:2 Status Request []} to network
2019/01/04 17:47:26 DEBUG Sending packet to port
2019/01/04 17:47:26 plm.(*Port).send:101 TRACE TX 02 62 29 d8 8f 0a 19 00
2019/01/04 17:47:26 plm.(*Port).readPacket:128 TRACE Attempting to read 7 more bytes
2019/01/04 17:47:26 plm.(*Port).readPacket:130 TRACE Completed read: 02 62 29 d8 8f 0a 19 00 06
2019/01/04 17:47:26 plm.(*Port).readLoop:56 TRACE RX 02 62 29 d8 8f 0a 19 00 06
2019/01/04 17:47:26 plm.(*PLM).receive:193 TRACE RX Send INSTEON Msg 00 00 00 29 d8 8f 0a 19 00 ACK
2019/01/04 17:47:27 plm.(*Port).readPacket:128 TRACE Attempting to read 9 more bytes
2019/01/04 17:47:27 plm.(*Port).readPacket:130 TRACE Completed read: 02 50 29 d8 8f 49 f8 88 2a 09 4f
2019/01/04 17:47:27 plm.(*Port).readLoop:56 TRACE RX 02 50 29 d8 8f 49 f8 88 2a 09 4f
2019/01/04 17:47:27 plm.(*PLM).receive:193 TRACE RX Std Msg Received 29 d8 8f 49 f8 88 2a 09 4f
2019/01/04 17:47:27 insteon.(*Network).receive:100 TRACE Received Insteon Message &{29.d8.8f 49.f8.88 SD Ack 2:2 Command(0x02, 0x09, 0x4f) []}
Read Timeout

can't retrieve link database for devices that aren't the PLM

(forked from #1 (comment))

This is using a modified version of message.go that sets TTL and Max TLL to 3.

$ cmd/ic/ic -timeout 60s -log trace device info 33.A9.41
2018/12/30 16:49:52 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 33.a9.41 SD     3:3 Engine Version []} to network
2018/12/30 16:49:52 DEBUG Sending packet to port
2018/12/30 16:49:53 plm.(*Port).send:94 TRACE TX 02 62 33 a9 41 0f 0d 00
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Send INSTEON Msg 00 00 00 33 a9 41 0f 0d 00 ACK
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Std Msg Received 33 a9 41 34 78 d9 2f 0d 02
2018/12/30 16:49:53 insteon.(*Network).receive:100 TRACE Received Insteon Message &{33.a9.41 34.78.d9 SD Ack 3:3 Command(0x02, 0x0d, 0x02) []}
2018/12/30 16:49:53 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 33.a9.41 SD     3:3 ID Request []} to network
2018/12/30 16:49:53 DEBUG Sending packet to port
2018/12/30 16:49:53 plm.(*Port).send:94 TRACE TX 02 62 33 a9 41 0f 10 00
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Send INSTEON Msg 00 00 00 33 a9 41 0f 10 00 ACK
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Std Msg Received 33 a9 41 34 78 d9 2f 10 00
2018/12/30 16:49:53 insteon.(*Network).receive:100 TRACE Received Insteon Message &{33.a9.41 34.78.d9 SD Ack 3:3 Command(0x02, 0x10, 0x00) []}
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Std Msg Received 33 a9 41 01 20 44 8f 01 76
2018/12/30 16:49:53 plm.(*PLM).receive:158 TRACE RX Std Msg Received 33 a9 41 01 20 44 8f 01 76
2018/12/30 16:49:53 insteon.(*Network).receive:100 TRACE Received Insteon Message &{33.a9.41 01.20.44 SB     3:3 Set-button Pressed (responder)(118) []}
2018/12/30 16:49:53 insteon.(*Network).receive:100 TRACE Received Insteon Message &{33.a9.41 01.20.44 SB     3:3 Set-button Pressed (responder)(118) []}
       Device: Dimmable Light (33.a9.41)
     Category: 01.20
     Firmware: 0x44
2018/12/30 16:49:53 DEBUG Retrieving Device link database
2018/12/30 16:49:53 insteon.(*Network).sendMessage:134 TRACE Sending &{00.00.00 33.a9.41 ED     3:3 Read/Write ALDB [0 0 0 0 0 0 0 0 0 0 0 0 0 0]} to network
2018/12/30 16:49:53 DEBUG Sending packet to port
2018/12/30 16:49:54 plm.(*Port).send:94 TRACE TX 02 62 33 a9 41 1f 2f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 d1

<hang>

It seems to work ok, if slowly using a nodeJS library. (home-controller)

$ time ./insteon-link /dev/ttyUSB0 33a941
Connecting to /dev/ttyUSB0
Polling device: 33a941
Device found: 33a941 - Dimmable Lighting Control
Getting links for device: 33a941
Found 6 link(s):

real 0m42.134s
user 0m0.400s
sys 0m0.016s

I'll try and compare the requests between the two libraries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.