telnet command feedback

81 views
Skip to first unread message

Patrick Meslin

unread,
Oct 21, 2016, 10:50:06 AM10/21/16
to OpenRemote
Complete java noob here so I'm more than likely missing the obvious, but what would be the best approach to using the feedback of a telnet command in a rule or an in-memory virtual command?

Here's what I have for now;

command: Power.On
protocol: telnet
IP address: localhost
port: 3000
command: null|!1PWR01
               (feedback is !1PWRxx with xx being a hex value between 00 and 64)
Read Regex Filter: ^.{5}([[:xdigit:]]+)
               (filter has been tested to return only the xx value)
Read Regex Group: 1
Default Response: 00


command: V.Power.Status
protocol: In-Memory Virtual Command
command: status
address: OnkyoVpower

command: V.Power.On
protocol: In-Memory Virtual Command
command: on
address: OnkyoVpower

command: V.Power.Off
protocol: In-Memory Virtual Command
command: off
address: OnkyoVpower


sensor: VPower
type: switch
command: V.Power.Status


switch: VPower.S
sensor: VPower
command(on): V.Power.On
command(off): V.Power.Off


and in rules;

rule "OnkyoOn"
when
   Event(source=="VPower", value=="on")
then
   execute.command("Power.On");
   System.out.println("test");
end


it prints out "test" properly on screen and I can see the correct telnet data in and out from a sniffer, but for debugging purpose I would want to print the output from execute.command("Power.On")

Patrick Meslin

unread,
Oct 21, 2016, 10:53:00 AM10/21/16
to OpenRemote
I should specify, I'm on OpenRemote Controller 2.5.0

Peter Truman

unread,
Oct 22, 2016, 7:39:44 AM10/22/16
to OpenRemote
If your Onkyo is an N series (network enabled) ,make a sensor and use the Onkyo/Integra ISCP commands...


You need to send the string:
ISCP !1PWRQSTN

You should put that in ASCII, hit convert, then get:

49 53 43 50 10 09 01 21 31 50 57 52 51 53 54 4e

You need to add 0D 0A to the end to provide the return character (to send the command), and a prefix of 0x - and strip all spaces.
So you think you should send...

0x4953435010090121315057525153544e0d0a

However - ascii to hex doesn't deal with the null space you need....

0x4953435000000010000000090100000021315057525153544e0d0a

To port 60128 on your Onkyo - assuming you've enabled Telnet access

You need to use TCP/IP, not telnet - I didn't find telnet very successful with Onkyo.

You should then get back...

ISCP
!1PWR00

if the power is off...or

ISCP
!1PWR01

if the power is on...

Patrick Meslin

unread,
Oct 22, 2016, 8:23:43 AM10/22/16
to OpenRemote
It's actually an older non-N series, a TX-SR606. Doesn't normally come with a serial port but actually has the internal header for it, so all it needed was a level shifter and a connector.

I'm talking to it through the serial port but have to map said serial port through telnet with ser2net since Designer 2.5 doesn't offer serial protocol anymore.


Using sensors works fine as is, I just thought it was somewhat inelegant since we're already getting the reply from the 'set' commands themselves.


Now if I could figure out how to make a sensor just poll 'on request' instead of automatically it'd be perfect.

Peter Truman

unread,
Oct 22, 2016, 10:46:51 AM10/22/16
to OpenRemote
I think it's been discussed and remains outstanding (i.e. command updates a sensor)


I have a home heating system which updates it's own values every 30 secs, which is an age if you press the button.  I was using IMVs and that was fine until someone used the actual controller, not OpenRemote, then it went out of Sync.  I think a combination of event rules and IMV would allow you to both set an IMV (on/off) and a periodic sensor (large second value) to provide a "reality check" maybe...

Patrick Meslin

unread,
Oct 22, 2016, 2:01:35 PM10/22/16
to OpenRemote
That's what I'll be doing for now, a workaround until (if) the issue is looked at.

There was also a 'connection manager' that was put in place in a fork, to remove the issue of near-simultaneous calls blocking each other when trying to open ports. Hopefully that neat feature will be added in the 3.0 branch.
Reply all
Reply to author
Forward
0 new messages