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 to Insteon HUB #370

Closed
elissonm opened this issue Feb 1, 2014 · 8 comments
Closed

Insteon: Add support to Insteon HUB #370

elissonm opened this issue Feb 1, 2014 · 8 comments

Comments

@elissonm
Copy link

elissonm commented Feb 1, 2014

Insteon HUB has an open port (9761) to act as a network attached PowerLinc Modem. This is the same port used by HouseLinc software and by iRule app to communicate with the Hub.

https://getsatisfaction.com/irule/topics/so_has_anyone_been_able_to_get_the_insteon_hub_set_up_as_a_gateway_in_irule

Also pyinsteon (https://github.com/zonyl/pyinsteon) has support for Smarthome 2412N, which is just about the same as Insteon Hub, which is being currently marketed as the main communication controller by Smarthome.

@krkeegan
Copy link
Collaborator

krkeegan commented Feb 3, 2014

Try the following branch, it is up-to-date with the master branch and contains a few additions that enable InsteonIP support based on @AndTH work:

https://github.com/krkeegan/misterhouse/tree/InsteonIP

To get everything working you need to add the following lines in your ini file

Insteon_PLM_use_TCP = 1
Insteon_PLM_TCP_host = 192.168.1.47 [USE APPROPRIATE IP ADDRESS]
Insteon_PLM_TCP_port = 9761

Then in your mht file you need to declare before any other insteon objects:

INSTEON_PLM,   PLM

That should get you going. This is only a beta test, you might have issues if you try and control any insteon objects using the hub rather than MH. I have tried to patch the issues that I can imagine, but I am sure I missed some. If you find any bugs let me know.

@elissonm
Copy link
Author

elissonm commented Feb 4, 2014

It worked! Thank you very much krkeegan!

BTW, I was using an old master branch of yours (insteon_thermo_i2), but I couldn't find it anymore. I'm having trouble with my insteon thermostat now with this InsteonIP branch. Is there a way to have it working with this branch too?

This is from my script file:
if ($Startup || $Reload) {
#Define the Children
$thermo_temp = new Insteon::Thermo_temp($thermostat);
$thermo_fan = new Insteon::Thermo_fan($thermostat);
$thermo_mode = new Insteon::Thermo_mode($thermostat);
$thermo_humidity = new Insteon::Thermo_humidity($thermostat);
$thermo_setpoint_h = new Insteon::Thermo_setpoint_h($thermostat);
$thermo_setpoint_c = new Insteon::Thermo_setpoint_c($thermostat);

    #Add the Children to the HVAC Group
    $HVAC->add($thermo_temp);
    $HVAC->add($thermo_fan);
    $HVAC->add($thermo_mode);
    $HVAC->add($thermo_humidity);
    $HVAC->add($thermo_setpoint_h);
    $HVAC->add($thermo_setpoint_c);

    $thermostat->poll_setpoint();

}

if ( new_minute(5) && $Hour != 2 ) { # Skip the ALDB scanning hour
$thermostat->poll_simple();
}

This is the error I'm getting:

Error found in user code file: /root/mh/data/mh_temp.user_code (error_count 1)

03/02/2014 21:50:00 : Can't locate object method "poll_simple" via package "Insteon::Thermo_i2CS" at (eval 453) line 3635.
at mh line 31
main::ANON('Can't locate object method "poll_simple" via package "Insteo...') called at (eval 453) line 3635
main::insteon_loopcode() called at (eval 453) line 4029
main::loop_code called at (eval 2889) line 1
Line 3630:
Line 3631: # Poll the temp.
Line 3632: if ( new_minute(5) && $Hour != 2 ) { # Skip the ALDB scanning hour
Line 3633: # $thermostat->poll_setpoint();
Line 3634: # $thermostat->poll_temp();
Line 3635: $thermostat->poll_simple();
Line 3636: }
Line 3637:
Line 3638: # Do stuff on temp_change
Line 3639: if ($thermostat->state_now) {
Line 3640: print_log("Got new thermostat state");
Display call with tk disabled (-tk 0). Text=Error found in user code file: /root/mh/data/mh_temp.user_code (error_count 1)

03/02/2014 21:50:00 : Can't locate object method "poll_simple" via package "Insteon::Thermo_i2CS" at (eval 453) line 3635.
at mh line 31
main::ANON('Can't locate object method "poll_simple" via package "Insteo...') called at (eval 453) line 3635
main::insteon_loopcode() called at (eval 453) line 4029
main::loop_code called at (eval 2889) line 1
Line 3630:
Line 3631: # Poll the temp.
Line 3632: if ( new_minute(5) && $Hour != 2 ) { # Skip the ALDB scanning hour
Line 3633: # $thermostat->poll_setpoint();
Line 3634: # $thermostat->poll_temp();
Line 3635: $thermostat->poll_simple();
Line 3636: }
Line 3637:
Line 3638: # Do stuff on temp_change
Line 3639: if ($thermostat->state_now) {
Line 3640: print_log("Got new thermostat state");

@krkeegan
Copy link
Collaborator

krkeegan commented Feb 4, 2014

Cool. Let me know if you see any bugs with the IP feature.

As for the thermostat. Support for calling poll_simple via user_code was
dropped. You can get the same results, plus additional data by calling
$thermostat->request_status().

If your thermostat is linked properly, you shouldn't need to call this
every 5 minutes, if ever. i2CS thermostats should automatically broadcast
temperature and state changes.

Kevin

On Mon, Feb 3, 2014 at 4:55 PM, elissonm [email protected] wrote:

It worked! Thank you very much krkeegan!

BTW, I was using an old master branch of yours (insteon_thermo_i2), but I
couldn't find it anymore. I'm having trouble with my insteon thermostat now
with this InsteonIP branch:

Error found in user code file: /root/mh/data/mh_temp.user_code
(error_count 1)

03/02/2014 21:50:00 : Can't locate object method "poll_simple" via package
"Insteon::Thermo_i2CS" at (eval 453) line 3635.
at mh line 31
main::ANON('Can't locate object method "poll_simple" via package
"Insteo...') called at (eval 453) line 3635
main::insteon_loopcode() called at (eval 453) line 4029
main::loop_code called at (eval 2889) line 1
Line 3630:
Line 3631: # Poll the temp.
Line 3632: if ( new_minute(5) && $Hour != 2 ) { # Skip the ALDB scanning
hour
Line 3633: # $thermostat->poll_setpoint();
Line 3634: # $thermostat->poll_temp();
Line 3635: $thermostat->poll_simple();
Line 3636: }
Line 3637:
Line 3638: # Do stuff on temp_change
Line 3639: if ($thermostat->state_now) {
Line 3640: print_log("Got new thermostat state");
Display call with tk disabled (-tk 0). Text=Error found in user code file:
/root/mh/data/mh_temp.user_code (error_count 1)

03/02/2014 21:50:00 : Can't locate object method "poll_simple" via package
"Insteon::Thermo_i2CS" at (eval 453) line 3635.
at mh line 31
main::ANON('Can't locate object method "poll_simple" via package
"Insteo...') called at (eval 453) line 3635
main::insteon_loopcode() called at (eval 453) line 4029
main::loop_code called at (eval 2889) line 1
Line 3630:
Line 3631: # Poll the temp.
Line 3632: if ( new_minute(5) && $Hour != 2 ) { # Skip the ALDB scanning
hour
Line 3633: # $thermostat->poll_setpoint();
Line 3634: # $thermostat->poll_temp();
Line 3635: $thermostat->poll_simple();
Line 3636: }
Line 3637:
Line 3638: # Do stuff on temp_change
Line 3639: if ($thermostat->state_now) {
Line 3640: print_log("Got new thermostat state");

Reply to this email directly or view it on GitHubhttps://github.com//issues/370#issuecomment-34019783
.

@elissonm
Copy link
Author

elissonm commented Feb 5, 2014

Sure. I will. But it's been working flawlessly for the last 24 hours, so I don't think I'm going to have any problems with it. Thank you once again for this branch. It could well be the official one.

@elissonm elissonm closed this as completed Feb 5, 2014
@AndTH
Copy link
Contributor

AndTH commented Feb 5, 2014

FYI, the InsteonIP code in my fork has been working on a 2412N since April 2011 till about two months ago when the 2412N device failed and the nice people at Smarthome replaced it with a Hub. The transition to the hub was flawless, I didn't even need to restart MH as the IP address stayed the same, the code just re-established the connection and kept working.

@elissonm
Copy link
Author

elissonm commented Feb 5, 2014

This is great! I can't think of any other software to automate my home.

I notice I'm having problem with 2-digit and 3-digit Insteon scenes though. I don't think this is a branch specific problem. When sending commands to 2-digit and 3-digit scenes I keep getting the following errors:

3-digit (100-255) error:

05/02/2014 00:40:26 [Insteon_PLM]: ERROR!! Command sent to PLM 02611011100 is of an incorrect length. Message not sent.

and this one with 2-digit scene (10-99):

05/02/2014 01:03:17 [Insteon_PLM] DEBUG2: Sending obj=$varandaoff; command=on; extra=00 incurred delay of 0.01 seconds; starting hop-count: 0
05/02/2014 01:03:17 [Insteon_PLM] DEBUG3: Sending PLM raw data: 0261101100
05/02/2014 01:03:17 [Insteon::BaseObject] $varandaoff::set(on, )
05/02/2014 01:03:18 [Insteon_PLM] DEBUG3: Received PLM raw data: 0261101100
05/02/2014 01:03:18 [Insteon_PLM] DEBUG3: Saving parsed data fragment: 0261101100
05/02/2014 01:03:18 [Insteon_PLM] DEBUG3: Prepending prior data fragment: 0261101100
05/02/2014 01:03:18 [Insteon_PLM] DEBUG3: Received PLM raw data: 026110110015
05/02/2014 01:03:18 [Insteon_PLM] WARN: PLM memory does not contain link for: obj=$varandaoff; command=on; extra=00

1-digit scenes (1-9) are working fine though:

05/02/2014 01:03:51 [Insteon_PLM] DEBUG2: Sending obj=$varandaon; command=on; extra=00 incurred delay of 0.00 seconds; starting hop-count: 0
05/02/2014 01:03:51 [Insteon_PLM] DEBUG3: Sending PLM raw data: 0261091100
05/02/2014 01:03:51 [Insteon::BaseObject] $varandaon::set(on, )
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Received PLM raw data: 0261091100
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Saving parsed data fragment: 0261091100
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Prepending prior data fragment: 0261091100
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Received PLM raw data: 026109110006
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Received PLM acknowledge: obj=$varandaon; command=on; extra=00
05/02/2014 01:03:52 [Insteon_PLM] DEBUG3: Received PLM raw data: 0250210b701e9fc9611109

My mht file for these specific scenes is like this:

INSTEON_ICONTROLLER, 09, varandaon, varandaon_group
INSTEON_ICONTROLLER, 10, varandaoff, varandaoff_group
INSTEON_ICONTROLLER, 101, varanda2aon, varanda2aon_group

Should I convert scene decimal numbers to hexadecimal in the mht file?

Edit:
Changing scene numbers to hexadecimal in mht file fixes it.

@krkeegan
Copy link
Collaborator

krkeegan commented Feb 5, 2014

@AndTH thanks for letting us know. Glad it has been working for you.

@elissonm, looks like you already figured it out, but yes hexadecimal is what you need. I am going to leave this issue open until we get this branch merged into master.

@krkeegan krkeegan reopened this Feb 5, 2014
AndTH referenced this issue in AndTH/misterhouse Feb 6, 2014
Added initial code to allow Insteon PLM to communicate with an ethernet
connected PLM as well as serial.
@AndTH
Copy link
Contributor

AndTH commented Feb 6, 2014

@krkeegan, regarding your changes "Messages are going to come in that MH will potentially see as acknowledging commands that it never sent.", I have seen some messages in the log to that effect, I will see if I can quantify what causes them and then I can test if you change will fix them.

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

3 participants