bottleneck
Choose style:

Author Topic: Any feedback or questions related to Web Socket API  (Read 22036 times)

0 Members and 1 Guest are viewing this topic.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #15 on: January 07, 2016, 04:15:46 pm »
I should also mention that in order for the apps to work correctly, or rather, be updated correctly every time, you should send both the SWITCH BINARY ON command when you send the SWITCH MULTILEVEL dim command for an ON/Brightness>0.

The same for OFF using Dim 0%, SWITCH BINARY FALSE if you are going to send it a SWITCH MULTILEVEL 0 command.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline Zexon83

  • Chestnut
  • ***
  • Posts: 34
  • Thanks: 1
  • Registered : 13/01/2015
    YearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #16 on: January 07, 2016, 06:38:05 pm »
@SecureComp
Thank you I didn't notice that I had the wrong index. That's frustrating I fought with that for longer then I would like to admit...

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #17 on: January 07, 2016, 07:58:36 pm »
@SecureComp
Thank you I didn't notice that I had the wrong index. That's frustrating I fought with that for longer then I would like to admit...

No worries, we've all been there.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline Talard

  • Backer
  • *
  • Posts: 53
  • Thanks: 0
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #18 on: January 08, 2016, 03:23:27 am »
I'm really interested by Jeedom a Home automation software.

Is the Web Socket API (will) allow to use Almond + in it ?

Offline mparadis

  • Backer
  • *
  • Posts: 1765
  • Thanks: 3
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #19 on: January 08, 2016, 09:29:17 am »
I should also mention that in order for the apps to work correctly, or rather, be updated correctly every time, you should send both the SWITCH BINARY ON command when you send the SWITCH MULTILEVEL dim command for an ON/Brightness>0.

The same for OFF using Dim 0%, SWITCH BINARY FALSE if you are going to send it a SWITCH MULTILEVEL 0 command.

This is true when setting up scenes in the apps as well.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #20 on: January 08, 2016, 10:12:24 am »
I'm really interested by Jeedom a Home automation software.

Is the Web Socket API (will) allow to use Almond + in it ?

AFAIK nothing exists in Jeedom for Almond+ right now, but yes, you can use the WebSocket API to generate something that would allow it to work with Jeedom.  Someone would have to develop the module to be in the Jeedom Market.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline Hyper

  • Backer
  • *
  • Posts: 10
  • Thanks: 0
  • Registered : 16/09/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #21 on: January 13, 2016, 03:47:51 am »
Hi!

It seems like there is only POST supported, GET would be also great because my HA Server i like to connect only supports GET requests.

Bye
« Last Edit: January 13, 2016, 10:31:41 am by Hyper »

Offline Ashok

  • Securifi Staff
  • *
  • Posts: 2770
  • Thanks: 3
  • Registered : 25/07/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #22 on: January 13, 2016, 07:03:56 am »
@ Hyper,

Hi!

It seems like there is only POST supported, GET would be also great because my HA Server i like to connect only supports GET requests.


A bit more information on this would be helpful.

Offline Hyper

  • Backer
  • *
  • Posts: 10
  • Thanks: 0
  • Registered : 16/09/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #23 on: January 13, 2016, 10:31:01 am »
@ Hyper,

A bit more information on this would be helpful.

Sorry for my inadequate post.
My problem is, I need a communication to the almond per HTTP Get request. Therefore a simple webservice.
For changeing the almond mode or switching devices.
A websocket is in my usecase too much, because my HomeAutomation Server does not support WebSockets.

Offline czyzczyz

  • Backer
  • *
  • Posts: 49
  • Thanks: 0
  • Registered : 23/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #24 on: February 03, 2016, 02:07:56 pm »
Authentication isn't working, as far as I can tell. With both the Chrome 'Simple WebSocket Client' and with node-red, I'm unable to get the websocket to connect using the username (root) and password that I use to connect to the router's web interface. Here's the URL I'm using (I've changed the password here, but my real one does include a $ character):

ws://10.0.1.1:7681/root/aL$dcb3Uqjka7Jd

I've logged into the Almond+ via ssh and am watching the messages go by in the webServer.log file in realtime via the "tail -f /tmp/webServer.log" command. When I try to connect a websocket using that URL, here's the message that appears in the log:

Code: [Select]
[2016-2-3 11:1:2.178937500] {INFO} passwd  twirp and received password root/aL$dcb3Uqjka7Jd
[2016-2-3 11:1:2.179264580] {INFO} LWS_CALLBACK_ESTABLISHED wrong login password so connection closed
[2016-2-3 11:1:2.221481000] {INFO} LWS_CALLBACK_CLOSED

Ah, "twirp" again. Wasn't that the old websocket interface? I am running firmware AP2-R083-L009-W016-ZW016-ZB005, so I'd have expected to be using the new websocket URL to connect.

In any case, ws://10.0.1.1:7681/twirp allows me to open and maintain a websocket connection to the router. But ws://10.0.1.1:7681/user/pass does not.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #25 on: February 03, 2016, 04:38:08 pm »
try a shorter password

also
ws://10.0.1.1:7681/password where password=your password



Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline czyzczyz

  • Backer
  • *
  • Posts: 49
  • Thanks: 0
  • Registered : 23/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #26 on: February 03, 2016, 06:06:02 pm »
Ah, I was worried that'd be the problem. I can make a less secure password, though it'd be good if the websocket accepts any password that can be used for the router's LuCI interface so people don't have to dumb-down their passwords to use the websocket.

Is the 'twirp' access going to go away in a future firmware update? It seems like a security risk. I haven't tried many commands yet, but it would seem that anyone with access to the local network may be able to take control of the router using 'twirp'.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #27 on: February 03, 2016, 09:21:35 pm »
Once someone is on your LAN, WiFi or Wired you have mega security risks period.

Post up if the password change solved the problem. I haven't tested mine to see what the max supported length or characters are.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline fort

  • Newbie
  • Posts: 1
  • Thanks: 0
  • Registered : 07/02/2016
    YearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #28 on: February 10, 2016, 03:29:00 pm »
First off, thanks for the websockets API. I've been developing an app against it, and it gets the job done (for the most part). That said, here's some unsorted feedback:

Security

I'll echo what has been mentioned a few times already in this thread: secure transport (wss://) is absolutely imperative. This is a worthwhile read: https://devcenter.heroku.com/articles/websocket-security. Also, including the username/pass in the URI is particularly bad since secure transport won't conceal this from passive network sniffing. It's the security equivalent of walking around with your most important password written on your forehead.

Consistency in naming conventions

Case inconsistencies:
  • Command names — "createrule" vs "ClientList"
  • Attributes in the return object — "CommandType" vs "commandtype", "DeviceID" vs "deviceid", "Name" vs. "name", etc.

Attribute name inconsistencies:
  • In the response — "devid" vs "deviceid"
  • In the request — "mii" vs "MobileInternalIndex" and "cmd" vs "CommandType"
    I've started including the 32-char random key as both both "mii" and "MobileInternalIndex" attributes, which the protocol seems just fine with. However, if you supply both "cmd" and "CommandType" (even if they're the same), it works for some commands ("devicelist" for instance), while other commands (such as "DynamicSceneList") will return this: { "mii":"<random key>", "commandtype":"unknown" }

Incomplete documentation

This is somewhat expected seeing as the API is all shiny and new. It's cropped up mostly when I'm looking for a list of acceptable values for a particular parameter. For instance, I was trying to activate a specific rule, so I sent the following:
Code: [Select]

 "mii":"<random key>",
 "cmd":"validaterule",
 "ruleid":"<ruleid>",
 "value":"true"
}

Well, this didn't work. Turns out, the value attribute was expecting either a "1" or a "0" — even though the response data shows "true" or "false" (ex: "data":{"value":"true","ruleid":"<ruleid>").

Structural weirdness (possibly typos?)

Here's the sample request for ActivateScene:
Code: [Select]

 "CommandType":"ActivateScene",
 "MobileInternalIndex":"324",
 "Scenes":{ 
   "ID":"11"
 }
}

Should the "Scenes" attribute be an array?


Thanks for reading! Oh, and who should I talk to about wiki edit rights for the documentation?


Offline Ashok

  • Securifi Staff
  • *
  • Posts: 2770
  • Thanks: 3
  • Registered : 25/07/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #29 on: February 10, 2016, 09:36:07 pm »
@ fort,

who should I talk to about wiki edit rights for the documentation?


Done. Could you please check and let me know, if you have any issues in editing the Wiki.

 

Page created in 0.065 seconds with 21 queries.