bottleneck
Choose style:

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

0 Members and 1 Guest are viewing this topic.

Offline Ashok

  • Securifi Staff
  • *
  • Posts: 2770
  • Thanks: 3
  • Registered : 25/07/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Any feedback or questions related to Web Socket API
« on: January 05, 2016, 10:11:32 am »
Please post any questions or feedback related to Web Socket API here.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #1 on: January 05, 2016, 12:08:16 pm »
Excellent, many thanks.  ;D

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

Offline cswilly

  • Backer
  • *
  • Posts: 65
  • Thanks: 1
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #2 on: January 05, 2016, 12:43:54 pm »
Small hint to play with it using Chrome.

Install Simple WebSocket extension. Works great.
https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo/related?hl=en


Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #3 on: January 05, 2016, 01:07:32 pm »
Small hint to play with it using Chrome.

Install Simple WebSocket extension. Works great.
https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo/related?hl=en

Yep, it does work nicely and it's simple for basic testing.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #4 on: January 05, 2016, 01:29:20 pm »
In Scenes section for Add/Remove/Update/Activate you have an mii of 324 and it is specified as a MobileInternalIndex instead of "mii".

Q: Should this also be a random key?
Q: Was this just a example that didn't have <random key> inserted?
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline mr23

  • Backer
  • *
  • Posts: 204
  • Thanks: 1
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #5 on: January 05, 2016, 07:42:52 pm »
Please post any questions or feedback related to Web Socket API here.

Thanks for releasing this.

FYI for connection/authentication, the 'user' (root) isn't necessary.
Both of these work:

<webinterfaceUrl>:<portid>/<Login>/<password>
<webinterfaceUrl>:<portid>/<password>

Offline mr23

  • Backer
  • *
  • Posts: 204
  • Thanks: 1
  • Registered : 02/08/2013
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #6 on: January 05, 2016, 11:45:28 pm »
In Scenes section for Add/Remove/Update/Activate you have an mii of 324 and it is specified as a MobileInternalIndex instead of "mii".

Q: Should this also be a random key?
Q: Was this just a example that didn't have <random key> inserted?

mii and MobileInternalIndex appear to be interchangeable, but I've only cross-tested a few.

Yes, the key is any random number as discussed elsewhere, and the response just echos the supplied value. In that instance you mention, they could edit it to be consistent.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #7 on: January 05, 2016, 11:55:28 pm »
mii and MobileInternalIndex appear to be interchangeable, but I've only cross-tested a few.

Yes, the key is any random number as discussed elsewhere, and the response just echos the supplied value. In that instance you mention, they could edit it to be consistent.

Yep, same thing I found. Figured that was all it was but it's worth making the edit to be clear.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #8 on: January 05, 2016, 11:55:39 pm »
We really need to be able to use wss.

Secure Websockets are a 'must' not a 'nice to have'.
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 #9 on: January 06, 2016, 08:17:22 pm »
Either I found a bug or I'm doing it wrong.

I have a GE link multilevel bulb and am turning it off by:

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"false"
}

I get the following output
{"mii":"781","commandtype":"setdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"false"}}
{"commandtype":"SensorUpdate","data":{"2":{"2":{"index":"2","name":"SWITCH BINARY","value":"false"}}}}
{"commandtype":"SensorUpdate","data":{"2":{"1":{"index":"1","name":"SWITCH MULTILEVEL","value":"0"}}}}

and the light turns off

Then I send:

 "mii":"782",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"true"
}

and get
{"mii":"782","commandtype":"setdeviceindex","success":"true","data":{"devid":"2","index":"1","value":"true"}}

and the light stays off.

I have to go into the app turn the dimmer up then the light will turn on but if I set dimmer up through the websocket nothing happens.

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #10 on: January 06, 2016, 09:21:44 pm »
Hello and welcome to multilevel switches...and dim levels

Let me actually try your code and some of my own...will need a few minutes.

This is the output of using the Almond Android App to control a GELink Bulb and turning it On/Off

Notice the use of Index 2 and the SWITCH BINARY function call, you are calling Index 1 which is SWITCH MULTILEVEL.
Code: [Select]
{"commandtype":"SensorUpdate","data":{"22":{"2":{"index":"2","name":"SWITCH BINARY","value":"true"}}}}
{"commandtype":"SensorUpdate","data":{"22":{"2":{"index":"2","name":"SWITCH BINARY","value":"false"}}}}
« Last Edit: January 06, 2016, 10:06:58 pm by SecureComp »
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #11 on: January 06, 2016, 09:36:42 pm »
@Zexon

throw the code brackets around your code, makes it easier to follow

That would be using the [ and ] around the word "code" to open and around "/code" to finish.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #12 on: January 06, 2016, 09:40:54 pm »
Your code is turning the Light off but it is setting the Dim Level to 0 to do so.
So even when it is turned back on, it will be at Dim Level 0, but you are not turning it on, you are resending Dim Level 0.


Change your value from "false" to "255" and watch what happens.
Your light should turn on and have a value of 100% Dim.

That's one of the things with multilevel switches, well light bulbs anyway, you can turn them on and off by setting Dim to 0 or on by setting Dim to something greater than 0.
« Last Edit: January 06, 2016, 09:46:56 pm by SecureComp »
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #13 on: January 06, 2016, 09:49:27 pm »
Turn ON/OFF using the MultiLevel Class (index 1)

OFF
Code: [Select]

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"false"
}

OR
Code: [Select]

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"0"
}

TURN ON and DIM 100% (which means 100% brightness or dimmed to 100% brightness, max brightness, 0% Dim/Brightness would be Off)

Code: [Select]

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"2",
 "index":"1",
 "value":"255"
}
« Last Edit: January 06, 2016, 10:09:33 pm by SecureComp »
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

Offline SecureComp

  • Backer
  • *
  • Posts: 541
  • Thanks: 1
  • Registered : 05/08/2014
    YearsYearsYearsYearsYearsYearsYearsYearsYearsYears
Re: Any feedback or questions related to Web Socket API
« Reply #14 on: January 06, 2016, 10:04:20 pm »
Now, if you want to use the SWITCH_BINARY controls of simply ON/OFF and leave the DIM Level unchanged, then you need to use the appropriate INDEX.

Take a look at the docs for more info
http://firmware.securifi.com/sdkdocs/index.html

ON
Code: [Select]

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"22",
 "index":"2",
 "value":"true"
}

OFF
Code: [Select]

 "mii":"781",
 "cmd":"setdeviceindex",
 "devid":"22",
 "index":"2",
 "value":"false"
}


So you were almost there, you were simply using the wrong index. You were calling MultiLevel Switch Functionality and changing the Dim Level instead of calling Binary Switch commands and using the On/Off function with values of True / False.
Kickstarter Backer
Securifi Wiki Editor and Beta Tester, Not a Securifi employee
Almond+, many sensors, IOS App, Android Apps and Widgets

 

Page created in 0.072 seconds with 21 queries.