swissmanu / harmonyhubjs-client

A Node.JS library which allows you to interact with your Logitech Harmony Hub.
https://github.com/swissmanu/harmonyhubjs-client
MIT License
155 stars 42 forks source link

Implement a "keep-alive" #8

Open swissmanu opened 9 years ago

swissmanu commented 9 years ago

see https://github.com/swissmanu/harmonyhubjs-client/issues/6#issuecomment-132234178 #6

getActivity seems to work as token so far. maybe theres an "official" token we can reverse engineer via wireshart?

Pmant commented 9 years ago

I did not manage to capture readable packets between app and hub. I think they changed the way app and hub communicate in the new firmware and app version. This is what the hub logs when receiving a command from the app:

"Aug 19 08:04:06.492 pimentoblue user.notice luaworks[126]: cs.c.websocketconnection [1655]: received json data {hbus={cmd=vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction,id=873e910e5863b36a#razorg#nexus 7-406-7,params={status=press,timestamp=916401,action={\"comma\n",
"Aug 19 08:04:06.494 pimentoblue user.notice luaworks[126]: cs.c.engine [1655]: processMessage(req): [ transport: websocket ] [ id: 873e910e5863b36a#razorg#nexus 7-406-7 ] [ cmd: vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction ]\n",
"Aug 19 08:04:06.495 pimentoblue user.notice luaworks[126]: cs.c.engine [1655]: processMessage: Translated [ cmd: harmony.engine?holdaction ]\n",
"Aug 19 08:04:06.496 pimentoblue user.notice luaworks[126]: cs.c.engine [1655]: startWorkflow: [ session: 96108 ] [ initiate: tasks.harmonyengine.apihandler.activity.processHoldAction ]\n",
"Aug 19 08:04:06.499 pimentoblue user.notice luaworks[126]: cs.c.engine [1655]: processMessage(res): [ transport: websocket ] [ id: 873e910e5863b36a#razorg#nexus 7-406-7 ] [ cmd: vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction ] [ errorCode: No Reply ] [ errorStri\n",
"Aug 19 08:04:06.504 pimentoblue user.notice luaworks[126]: he.m.device [9]: device: [ id: 26944659 ] [ name: TV ] [ command: volumedown ] [ modifier: press ], [ transport: 1 ]\n",
"Aug 19 08:04:06.513 pimentoblue user.notice luaworks[126]: he.c.irsender [9]: Send IrPacket\n",

This is the same command from harmonyhubjs-client:

"Aug 19 08:15:56.535 pimentoblue user.notice luaworks[126]: cs.c.engine [1690]: processMessage(req): [ transport: xmpp ] [ id: 340611 ] [ cmd: vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction ]\n",
"Aug 19 08:15:56.536 pimentoblue user.notice luaworks[126]: cs.c.engine [1690]: processMessage: Translated [ cmd: harmony.engine?holdaction ]\n",
"Aug 19 08:15:56.537 pimentoblue user.notice luaworks[126]: cs.c.engine [1690]: startWorkflow: [ session: 48616 ] [ initiate: tasks.harmonyengine.apihandler.activity.processHoldAction ]\n",
"Aug 19 08:15:56.541 pimentoblue user.notice luaworks[126]: cs.c.engine [1690]: processMessage(res): [ transport: xmpp ] [ id: 340611 ] [ cmd: vnd.logitech.harmony/vnd.logitech.harmony.engine?holdAction ] [ errorCode: No Reply ] [ errorString: None ]\n",
"Aug 19 08:15:56.546 pimentoblue user.notice luaworks[126]: he.m.device [9]: device: [ id: 26944659 ] [ name: TV ] [ command: volumedown ] [ modifier: press ], [ transport: 1 ]\n",
"Aug 19 08:15:56.555 pimentoblue user.notice luaworks[126]: he.c.irsender [9]: Send IrPacket\n",
hufftheweevil commented 6 years ago

This should do it. #42