Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insteon: Add Support for TriggerLinc Device #245

Closed
JaredF opened this issue Aug 11, 2013 · 11 comments
Closed

Insteon: Add Support for TriggerLinc Device #245

JaredF opened this issue Aug 11, 2013 · 11 comments
Assignees

Comments

@JaredF
Copy link
Collaborator

JaredF commented Aug 11, 2013

The Insteon TriggerLinc will be coded similarly to the MotionLinc, but does not seem to support some of the more advanced features that the MotionLinc does, for example, reporting low batteries, ambient light level, et cetera via different Insteon group numbers. I have not tested for any of these features, but Internet searches and the instruction manual do not mention any support for this.

If undocumented, the features to check for would be to see if it would be possible to detect battery level, remotely change the NO/NC behavior, and adjust the time before the device returns to "deaf" mode.

@krkeegan
Copy link
Collaborator

I have no problem working on this. I don't own one, which adds some level of difficulty. But to further complicate things, I hacked a "fake triggerlinc" device into the HouseLinc software and I do not see any options for setting the NO/NC behavior. Nor do I have any command tables or documentation on the commands used by the triggerlinc.

As for the battery level and "deaf time," maybe try setting the device as a RemoteLinc.

If that works, it might be possible to set the NO/NC state with the set_operating_flag command.

@JaredF
Copy link
Collaborator Author

JaredF commented Aug 13, 2013

I'm guessing that no special commands are supported for this device if nothing like that shows in HouseLinc. As far as a battery-level indicator, as I stated above, it looks like this is also not supported:

http://www.power-home.com/forum/forum_posts.asp?TID=2272
http://www.perceptiveautomation.com/userforum/viewtopic.php?t=4705

You would think that since the TriggerLinc and MotionLinc have such similar functions, that they would support similar features as well, but perhaps these features were lost in the attempt to create a smaller device... I don't own a MotionLinc, but have heard that they are quite large as far as motion sensors go.

If necessary, I could always send you a TriggerLinc to test with, but so far it looks like this may be the simplest Insteon item that SmartHome sells (funny then that they charge so much for them; I got a deal on eBay, otherwise I probably wouldn't own any).

I would be glad to help code if necessary, but would probably need some hints as where to start since I've never edited any public code in MH.

Thanks for your help!

(P.S.--I couldn't find out how to label this "issue" as an 'enhancement.' Guessing that it's a permissions issue.)

@krkeegan
Copy link
Collaborator

I would be surprised if you could not change the NO/NC option using commands. I wouldn't read too much into HouseLinc, it is clearly designed by a different department and it often lacks many features. I will keep an eye on it, maybe they will update it soon.

As for the battery situation. There are three ways in which Insteon devices provide battery information. The oldest method is a group broadcast, usually group 3. The second is a direct request to the device asking for a battery level, if the device is awake, it will respond back with a battery level message. The third is a heartbeat, essentially the heartbeat is broadcast every X minutes, I believe that message contains the battery level, but additionally if you do not receive a heartbeat in X*2 minutes you know something is wrong.

The first method was used on older devices and seems to be less favored by Insteon now. The second method seems to be on nearly all devices, but is often overlooked by other software and as a result is not generally used. The third method is very new and I have not seen it on a device yet. The RemoteLinc's were supposed to have it, but they do not actually do it. I believe the Leak Sensor does use a heartbeat though.

Try the following:

  1. Define your device as a REMOTELINC.
  2. Restart MH
  3. Put your device into linking mode by holding down the set button.
  4. Run "Get Engine Version" voice command
  5. Run the command get_extended_info() on the device (sorry there is no voice command for this yet)
  6. Copy the response that you get
  7. Run set_awake_time(4) on the device (again there is no voice command for this)
  8. Copy the response.

Hopefully the device remains awake the whole time for all of this. I would expect all of these commands to work.

@krkeegan
Copy link
Collaborator

On closer inspection, I am not sure what you mean by NO/NC. I don't see any reference in the product manual that the device can be switched between these states.

I see that the device can be used in "mulit-scene" mode in which it will issue on commands on group 1 whenever the device is closed and on group 2 when it is open (I may have that backwards).

It looks like the multi-scene option may be a hardware only setting.

@JaredF
Copy link
Collaborator Author

JaredF commented Aug 13, 2013

Kevin,

You are correct; I was remembering the instructions incorrectly. I was thinking that the setting switched between sending an ON when open or an OFF when open; whereas like you said, it appears that the difference is that the setting activates a secondary group instead. Reviewing the manual, since the setting only appears adjustable via the jumper, it probably cannot be remotely set...

I will still run the tests for engine version, extended_info, and set_awake_time.

@JaredF
Copy link
Collaborator Author

JaredF commented Aug 14, 2013

INSTEON_REMOTELINC, 14.8A.8F:01, Test, All_Devices
(wasn't sure whether or not the :01 mattered)

08/13/2013 23:17:26 Running: Test get engine version
08/13/2013 23:17:26 [Insteon_PLM] DEBUG2: Sending obj=$Test; command=get_engine_version incurred delay of 0.00 seconds; starting hop-count: 3
08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Sending PLM raw data: 0262148a8f0f0d00
08/13/2013 23:17:26 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 0f
Message Type: (000) Direct Message
Message Length: (0) Standard Length
Hops Left: 3
Max Hops: 3
Insteon Message: 0d00
Cmd 1: (0d) Get INSTEON Engine Version
Cmd 2: 00

08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Received PLM raw data: 0262148a8f0f0d0006
08/13/2013 23:17:26 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 0f
Message Type: (000) Direct Message
Message Length: (0) Standard Length
Hops Left: 3
Max Hops: 3
Insteon Message: 0d00
Cmd 1: (0d) Get INSTEON Engine Version
Cmd 2: 00
PLM Response: (06) ACK

08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Received PLM acknowledge: obj=$Test; command=get_engine_version
08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Received PLM raw data: 0250148a8f
08/13/2013 23:17:26 [Insteon_PLM] DEBUG4:
PLM Command: (0250) insteon_received
Message length too short for PLM command. Not parsed

08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Saving parsed data fragment: 0250148a8f
08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Prepending prior data fragment: 0250148a8f
08/13/2013 23:17:26 [Insteon_PLM] DEBUG3: Received PLM raw data: 0250148a8f13ac7e270d01
08/13/2013 23:17:26 [Insteon_PLM] DEBUG4:
PLM Command: (0250) insteon_received
From Address: 14:8a:8f
To Address: 13:ac:7e
Message Flags: 27
Message Type: (001) ACK of Direct Message
Message Length: (0) Standard Length
Hops Left: 1
Max Hops: 3
Insteon Message: 0d01
Cmd 1: (0d) Get INSTEON Engine Version
Cmd 2: (01) i2

08/13/2013 23:17:26 [Insteon::BaseInterface] DEBUG3: Message received with 1 hops left, delaying next transmit by 150 milliseconds to avoid collisions.
08/13/2013 23:17:26 [Insteon::BaseInterface] DEBUG3: PLM command:insteon_received; Device command:get_engine_version; type:direct; group:
08/13/2013 23:17:26 [Insteon::BaseObject] received engine version for $Test of I2. hops left: 1

08/13/2013 23:19:31 Running: Set awake time.
08/13/2013 23:19:31 [Insteon_PLM] DEBUG2: Sending obj=$Test; command=extended_set_get; extra=000102040000000000000000000000 incurred delay of 0.00 seconds; starting hop-count: 3
08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Sending PLM raw data: 0262148a8f1f2e000102040000000000000000000000
08/13/2013 23:19:31 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e000102040000000000000000000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 0102040000000000000000000000

08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Received PLM raw data: 0262148a8f1f2e00010204000000
08/13/2013 23:19:31 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e00010204000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 010204000000

08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Saving parsed data fragment: 0262148a8f1f2e00010204000000
08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Prepending prior data fragment: 0262148a8f1f2e00010204000000
08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Received PLM raw data: 0262148a8f1f2e00010204000000000000000000000006
08/13/2013 23:19:31 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e000102040000000000000000000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 010204000000000000000000000006
PLM Response: (06) ACK

08/13/2013 23:19:31 [Insteon_PLM] DEBUG3: Received PLM acknowledge: obj=$Test; command=extended_set_get; extra=000102040000000000000000000000
08/13/2013 23:19:32 [Insteon_PLM] DEBUG3: Received PLM raw data: 0250148a8f13ac7e272e00
08/13/2013 23:19:32 [Insteon_PLM] DEBUG4:
PLM Command: (0250) insteon_received
From Address: 14:8a:8f
To Address: 13:ac:7e
Message Flags: 27
Message Type: (001) ACK of Direct Message
Message Length: (0) Standard Length
Hops Left: 1
Max Hops: 3
Insteon Message: 2e00
Cmd 1: (2e) Light ON at Ramp Rate
Cmd 2: (00) Level and Rate

08/13/2013 23:19:32 [Insteon::BaseInterface] DEBUG3: Message received with 1 hops left, delaying next transmit by 150 milliseconds to avoid collisions.
08/13/2013 23:19:32 [Insteon::BaseInterface] DEBUG3: PLM command:insteon_received; Device command:extended_set_get; type:direct; group:
08/13/2013 23:19:32 [Insteon::BaseObject] DEBUG3: Adding hop count of 2 to hop_array of $Test
08/13/2013 23:19:32 [Insteon::RemoteLinc] Extended Set/Get ACK Received for $Test
08/13/2013 23:19:32 [Insteon::RemoteLinc] Clearing active message

08/13/2013 23:20:09 Running: Get extended info.
08/13/2013 23:20:09 [Insteon_PLM] DEBUG2: Sending obj=$Test; command=extended_set_get; extra=000100000000000000000000000000 incurred delay of 0.00 seconds; starting hop-count: 3
08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Sending PLM raw data: 0262148a8f1f2e000100000000000000000000000000
08/13/2013 23:20:09 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e000100000000000000000000000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 0100000000000000000000000000

08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Received PLM raw data: 0262148a8f1f2e000100
08/13/2013 23:20:09 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e000100
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 0100

08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Saving parsed data fragment: 0262148a8f1f2e000100
08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Prepending prior data fragment: 0262148a8f1f2e000100
08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Received PLM raw data: 0262148a8f1f2e00010000000000000000000000000006
08/13/2013 23:20:09 [Insteon_PLM] DEBUG4:
PLM Command: (0262) insteon_send
To Address: 14:8a:8f
Message Flags: 1f
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 3
Max Hops: 3
Insteon Message: 2e000100000000000000000000000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 010000000000000000000000000006
PLM Response: (06) ACK

08/13/2013 23:20:09 [Insteon_PLM] DEBUG3: Received PLM acknowledge: obj=$Test; command=extended_set_get; extra=000100000000000000000000000000
08/13/2013 23:20:10 [Insteon_PLM] DEBUG3: Received PLM raw data: 0250148a8f13ac7e272e00
08/13/2013 23:20:10 [Insteon_PLM] DEBUG4:
PLM Command: (0250) insteon_received
From Address: 14:8a:8f
To Address: 13:ac:7e
Message Flags: 27
Message Type: (001) ACK of Direct Message
Message Length: (0) Standard Length
Hops Left: 1
Max Hops: 3
Insteon Message: 2e00
Cmd 1: (2e) Light ON at Ramp Rate
Cmd 2: (00) Level and Rate

08/13/2013 23:20:10 [Insteon::BaseInterface] DEBUG3: Message received with 1 hops left, delaying next transmit by 150 milliseconds to avoid collisions.
08/13/2013 23:20:10 [Insteon::BaseInterface] DEBUG3: PLM command:insteon_received; Device command:extended_set_get; type:direct; group:
08/13/2013 23:20:10 [Insteon::BaseObject] DEBUG3: Adding hop count of 2 to hop_array of $Test
08/13/2013 23:20:10 [Insteon::RemoteLinc] Extended Set/Get ACK Received for $Test
08/13/2013 23:20:10 [Insteon_PLM] DEBUG3: Received PLM raw data: 0251148a8f13ac7e172e000001040123000000000000000000
08/13/2013 23:20:10 [Insteon_PLM] DEBUG4:
PLM Command: (0251) insteon_ext_received
From Address: 14:8a:8f
To Address: 13:ac:7e
Message Flags: 17
Message Type: (000) Direct Message
Message Length: (1) Extended Length
Hops Left: 1
Max Hops: 3
Insteon Message: 2e000001040123000000000000000000
Cmd 1: (2e) Extended Set/Get
Cmd 2: (00) Command in D2
D1-D14: 0001040123000000000000000000

08/13/2013 23:20:10 [Insteon::BaseInterface] DEBUG3: Message received with 1 hops left, plus ACK will take 3 to deliver, delaying next transmit by 850 milliseconds to avoid collisions.
08/13/2013 23:20:10 [Insteon::BaseInterface] DEBUG: PLM command:insteon_ext_received; Device command:extended_set_get; type:direct; group:
08/13/2013 23:20:10 [Insteon::BaseInterface] Processing message for $Test
08/13/2013 23:20:10 [Insteon::BaseObject] DEBUG3: Adding hop count of 2 to hop_array of $Test
08/13/2013 23:20:10 [Insteon::RemoteLinc] The battery level for device $Test is: 0 of 3.70 volts.
Can't locate object method "_is_battery_low" via package "Insteon::RemoteLinc" at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon/Controller.pm line 267.
at /usr/local/bin/misterhouse/mh/bin/mh line 31
main::ANON('Can't locate object method "_is_battery_low" via package "In...') called at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon/Controller.pm line 267
Insteon::RemoteLinc::_process_message('Insteon::RemoteLinc=HASH(0x47da218)', 'Insteon_PLM=HASH(0x44d6ba0)', 'source', '148a8f', 'maxhops', 3, 'destination', '13ac7e', 'cmd_code', ...) called at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon/BaseInterface.pm line 712
Insteon::BaseInterface::on_extended_insteon_received('Insteon_PLM=HASH(0x44d6ba0)', '148a8f13ac7e172e000001040123000000000000000000') called at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon_PLM.pm line 718
Insteon_PLM::parse_data('Insteon_PLM=HASH(0x44d6ba0)', '0251148a8f13ac7e172e000001040123000000000000000000') called at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon_PLM.pm line 204
Insteon_PLM::check_for_data('Insteon_PLM=HASH(0x44d6ba0)') called at /usr/local/bin/misterhouse/mh/bin/../lib/Insteon/BaseInterface.pm line 33
Insteon::BaseInterface::check_for_data() called at /usr/local/bin/misterhouse/mh/bin/mh line 1386
main::run_hooks
('MainLoop_pre') called at (eval 532) line 5
main::MainLoop_pre_hooks() called at /usr/local/bin/misterhouse/mh/bin/mh line 1499
main::check_for_action called at /usr/local/bin/misterhouse/mh/bin/mh line 3280
main::monitor_commands called at /usr/local/bin/misterhouse/mh/bin/mh line 6697

Looks like it's an I2 device. I started with a new TriggerLinc that was previously unlinked to my PLM. Let me know if the results show that this is causing issues.

Not sure if the set_awake_time did anything. Should there be any other response than "Extended Set/Get ACK Received for $Test"?

Looks like the get_extended_info is causing a crash because it can't find the method "_is_battery_low" Before the crash, I do see a report of 0V, so it looks like no luck with this test at least... :(

@krkeegan
Copy link
Collaborator

Well done, thank you for that.

Yes, I apparently forgot to include a function in the RemoteLinc code, not sure how that happened, it should be an easy fix.

Even without that, we still get some data back from the TriggerLinc. The D1-14 response from the Get_Extended_Info command is as follows:

0001040123000000000000000000
D1D2D3D4D5D6D7D8D9D0D1D2D3D4

This looks promising. For the RemoteLinc D3 is the awake time. Here it looks to be set to 4 seconds, which matches the command you sent. So far so good.

The contents of D4 and D5 will have to be an educated guess. D4 may define the Jumper state inside of the device. 1 being a single scene and maybe 0 being multi-scene??

D5 could be the battery level. The decimal value of this data is 35. The TriggerLinc takes a AA with a nominal voltage between 1.2 and 1.5 volts depending on the type of battery used. I am guessing you used a brand new Alkaline battery, so it should be about 1.5 volts. On other devices, I have seen Insteon multiply the battery voltage by 2, 10 and 50. Based on the data returned here it looks like in this case it may be 25?? This would result in a voltage of 1.4. The only way to know is to keep watching it.

If you are still willing to be a guinea pig, you can test the following for me to confirm my assumptions:

  1. Change the jumper setting on the device.
  2. Pull the battery for 10 seconds (I think this is required for the device to see the change)
  3. Put your device into linking mode by holding down the set button.
  4. Run set_awake_time(5)
  5. Run get_extended_info (you will get an error again, but don't worry about it)
  6. And paste your results

Hopefully we will see the D3-D4 settings change appropriately. If we are lucky, we may even catch a new reading on D5 which would help identify the battery value.

@JaredF
Copy link
Collaborator Author

JaredF commented Aug 15, 2013

Some good news, but mostly disappointing news... Like you said, the awake time setting does indeed seem to be working--I tried setting it to 5 and then 10 and received the following responses respectively:

0001050123000000000000000000
00010a0123000000000000000000

Once, I held the button too long and I believe that it reset it to factory defaults, which produced this:
0001640123000000000000000000

The bad news is that nothing that I did changed the values of D4 or D5... I tried half a dozen old batteries that I had just changed out from dead TV remotes and the like. I was barely able to get the TriggerLinc to send even one response on most of them, but when it did, D5 still showed 23 each time... Is it possible that the internal firmware only "checks" the voltage every so often and I didn't leave the bad batteries in long enough?

The jumper did not seem to have any effect on D4--it always responded with 01 no matter what position it was in... I removed the battery for 10+ seconds between each change. The only other controllable variable is the reed switch, so I tried closing it with the magnet and running the test, but this also did not seem to have any effect. There are terminals on the board for connecting a custom Open/Close type sensor, but I would assume that this just patches directly into where the existing reed switch connects...

Let me know if you have any other ideas to test; otherwise, I think that as far as MH is concerned, the code will only need to support group 01, group 02 as well if the jumper is removed (I do not plan to use this feature), and possibly the 'stay awake' functionality once implemented.

@ghost ghost assigned krkeegan Oct 10, 2013
krkeegan added a commit to krkeegan/misterhouse that referenced this issue Oct 10, 2013
Basically just a copy of code for RemoteLincs, however, TriggerLincs support even fewer commands so much of the code was cut down.

I put the code in the Security.pm file as these are ostensible security devices, however as noted above, these are very similar to RemoteLincs.  Although, they are not that dissimilar from Motion sensors which are also in this file.

I don't own a TriggerLinc so this coding is all done blind.

Thanks to @JaredF for his testing work.

Closes hollie#245
@JaredF
Copy link
Collaborator Author

JaredF commented Oct 11, 2013

When I was running these tests as discussed above, I ran into a missing function in the RemoteLinc code: "Can't locate object method "isbattery_low" via package "Insteon::RemoteLinc""

Just checking: did this ever get fixed or entered as an open issue? If not, I can add it; it is definitely not a high priority, but I wanted to make sure that it doesn't get forgotten.

@krkeegan
Copy link
Collaborator

ok, the is_battery_low issue is solved and the solution has been merged with master

@JaredF
Copy link
Collaborator Author

JaredF commented Oct 12, 2013

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants