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

Bad documentation #3

Open
Pixtxa opened this issue Dec 26, 2017 · 11 comments
Open

Bad documentation #3

Pixtxa opened this issue Dec 26, 2017 · 11 comments

Comments

@Pixtxa
Copy link

Pixtxa commented Dec 26, 2017

But I've got it to run with my EGLOpanel and the Remote with the RaspberryPi (but without the Awox-App, but that's ok). Thanks!!!

I've renamed init.py to awoxmeshlight.py, so "import awoxmeshlight" works. Also I changed Line 3 to "import packetutils as pckt", because "from . import ..." didn't work.

Reset the light (hold PowerOn + Fav. 1) and the remote (hold PowerOn + ColorCyicle) and connect the remote to the light again (hold PowerOn). Now hold PowerOn and the blue button for a few seconds, so the remote switches to Bluetooth-mode. Use BT-app (nRF-Connect or so) to get the mac and name (both will have the same name, its "R-" followed by the last 6 digits of the remotes mac-address). Password will be "1234".

For the remote:

import awoxmeshlight
myremote = awoxmeshlight.AwoxMeshLight ("A4:C1:38:75:24:93", "R-752593", "1234") #change to your remotes data
myremote.connect()
myremote.setMesh("PixtxaLightNet", "IeY3johvoosh","4556572782865925") #better change all of them
myremote.disconnect()

[After setMesh(...) the program didn't work, but the data was set, so i killed the task]

For the light:

import awoxmeshlight
mylight = awoxmeshlight.AwoxMeshLight ("A4:C1:38:78:62:74", "R-752593", "1234") #change to your lights data
mylight.connect()
mylight.setMesh("PixtxaLightNet", "IeY3johvoosh","4556572782865925") #same as on the remote
mylight.disconnect()

[After setMesh(...) the program didn't work, but the data was set, so i killed the task]

Now you can run a simple test script:

import awoxmeshlight
import time
mylight = awoxmeshlight.AwoxMeshLight ("A4:C1:38:78:62:74", "PixtxaLightNet", "IeY3johvoosh")
mylight.connect()
mylight.setColor(0x00, 0xFF, 0x00) #green
mylight.setColorBrightness(0x01) #dark
time.sleep(1)
mylight.setColorBrightness(0x64) #bright
time.sleep(1)
mylight.setPreset(0) #colorchange
mylight.setSequenceFadeDuration(500)
mylight.setSequenceColorDuration(500)
time.sleep(15)
mylight.setWhite(0x00, 0x7F) #coldwhite
time.sleep(1)
mylight.setWhite(0x73, 0x63) #warmwhite
time.sleep(1)
mylight.off()
time.sleep(1)
mylight.on()
mylight.disconnect()

Thanks for your work, Leiaz! It helped me a lot. AwoX- and EGLO-Support told me, it wouldn't be possible to do this.

@Leiaz
Copy link
Owner

Leiaz commented Jan 19, 2018

I've renamed init.py to awoxmeshlight.py, so "import awoxmeshlight" works. Also I changed Line 3 to "import packetutils as pckt", because "from . import ..." didn't work.

This could be a Python version problem. The from . import should work starting with Python 2.5. The __init__.py is because awoxmeshlight is supposed to be a Python package. I think it is correct but I'm far from being a Python expert. Did you install it with pip ? This too was missing from the documentation ... :)

So setMesh also works on the remote. Nice. Thanks for testing !

I've tried a workaround for setMesh hanging. It may be a bluepy issue, I'm not sure.

I've updated the README, thanks for your contribution !

@Pixtxa
Copy link
Author

Pixtxa commented Jan 25, 2018

Thanks for updating the README. I'm no Python expert, too. I'm something between beginner and advanced. I haven't tried pip, I've tried to run setup.py, but (as far I remember) it wasn't working. Well, I should have used pip, thanks for the hint.
Now the documentation is much better.

@Pixtxa
Copy link
Author

Pixtxa commented Mar 6, 2018

Well, to install firmware-updates and to control my lamp, I also wanted to use the app without resetting my mash-network anytime. But the app has no configuration for the password, so the app has to do the setup and my RaspberryPi needs the data.
I downloaded the app Packet Capture and installed the SSL-Sniffing-Certificate.
I reset the lamp and remote and set up the connections again, this time with the AwoX Smart Control app. I analized the collected network-data and there is an 1,6 KB sized File. On the bottom of it are lines like the following:

{
  "results": [
    {
      "objectId": "qU675qfuaG",
      "expires": 0,
      "client_id": "t4tGFffS",
      "service": "mesh",
      "access_token": "b4226b7d", 
      "owner": {
        "__type": "Pointer",
        "className": "_User",
        "objectId": "t4tGFffSt8"
      },
      "refresh_token": "ba5a2daf",
      "createdAt": "2017-12-19T14:32:48.684Z",
      "updatedAt": "2017-12-19T14:32:48.684Z",
      "ACL": {
        "t4tGFffSt8": {
          "read": true,
          "write": true
        }
      }
    }
  ]
}

"client_id": "t4tGFffS" is the network-name (I can also get it with a bluetooth-scan as device-name of all devices) and "access_token": "b4226b7d" is the password. Together with the lamps mac-address of an bluetooth-scan (nRF Connect) I have to use:
mylight = awoxmeshlight.AwoxMeshLight ("A4:C1:38:78:62:74", "t4tGFffS", "b4226b7d")

Now I can run my simple test script again:

import awoxmeshlight
import time
mylight = awoxmeshlight.AwoxMeshLight ("A4:C1:38:78:62:74", "t4tGFffS", "b4226b7d")
mylight.connect()
mylight.setColor(0x00, 0xFF, 0x00) #green
mylight.setColorBrightness(0x01) #dark
time.sleep(1)
mylight.setColorBrightness(0x64) #bright
time.sleep(1)
mylight.setPreset(0) #colorchange
mylight.setSequenceFadeDuration(500)
mylight.setSequenceColorDuration(500)
time.sleep(15)
mylight.setWhite(0x00, 0x7F) #coldwhite
time.sleep(1)
mylight.setWhite(0x73, 0x63) #warmwhite
time.sleep(1)
mylight.off()
time.sleep(1)
mylight.on()
mylight.disconnect()

And I can use the app.

It isn't possible to use the lamp with the App while the RaspberryPi is connected and
it also isn't possible to use the lamp with the RaspberryPi while the App is connected,
this is because the lamp can only have one active connection (to only one device) at a time.
But you can use the remote while the lamp is connected. So maybe it is possible to use app and RaspberryPi at the same time, if you have two lamps. So one lamp would be connected to the app, the other one would be connected to the RaspberryPi and both Lamps would be connected over the mesh-network.

Maybe it is also possible to set up the lamp on the RaspberryPi and manipulate the network traffic, so the Remote is getting the correct mesh-name and password it has to use. But I think the other way is more simple.

And thanks again to @Leiaz for this awesome piece of code, without I wouldn't be able to control my lamp over my RaspberryPi!

@pipacsba
Copy link

@Pixtxa : I also plan to control my awox bulb from raspberry, but keeping also the possibility to change the light from the Smart Control app. So I have installed greyshirts.sslcapture (1.4.7 from an apk store), and captured the app after a bulb reset. But I do not get anything readable in the app. I know this is not too much information, but if you could point in any direction, or add some more details on how you have found the necessary information to get the client_id and acces_token information, I would really appreciate it. Thank you in advance!

@pipacsba
Copy link

@pipacsba : update: the method to identify the "client_id" and "access_token" described by @Pixtxa works only with Smart Control 5.2.2, but gave no result with 6.0.2. Thank you all!

@Leiaz
Copy link
Owner

Leiaz commented Oct 24, 2018

The password should also be in the app data, readable if you have root access (with adb root for instance).

If one of you wants to improve the README, you can send a pull request. I think opening the wiki may be overkill.

I'm reopening this to make it more visible.

@ugge77
Copy link

ugge77 commented Jul 10, 2019

I downloaded the app Packet Capture and installed the SSL-Sniffing-Certificate.
I reset the lamp and remote and set up the connections again, this time with the AwoX Smart Control app. I analized the collected network-data and there is an 1,6 KB sized File. On the bottom of it are

I tried this approach but only got a 552 byte data packet when adding my light to the Awox app. This packet contains an empty json, only header information.

I also encounter the following request:
`GET /api/nupnp HTTP/1.1
User-Agent: AwoX
Date: Wed, 10 Jul 2019 09:12:06 GMT
Content-Length: 0
Host: www.meethue.com

`
Why in the world would it contact the Hue api?

When installing the SSL-Sniffing-Certificate I was given a choice between App/VPN and WIFI. Not knowing exactly what this meant I choose App/VPN and it seemed to work.

@guirem
Copy link

guirem commented Jan 28, 2020

As @Leiaz mentioned, it seems that everything needed is in the application data (root access needed) and all in one readable xml file
/data/data/com.awox.smart.control/shared_prefs/com.awox.core.model.Mesh.html

It looks like that for me

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
    <string name="mesh_name">XXXXXXX</string>
    <string name="long_term_key">YYYYYY</string>
    <string name="mesh_password">ZZZZZZ</string>
</map>

Theoratically this should work to connect:
mylight = awoxmeshlight.AwoxMeshLight ("A4:C1:38:78:62:74", "XXXXXXX", "ZZZZZZ")
and adding new device too:
mynewdevice.setMesh("XXXXXXX", "ZZZZZZ","YYYYYY")
I don't know if adding them via script will add them in the app though

It's not tested yet on my side as I don't have awox device right now with me.

@Pixtxa
Copy link
Author

Pixtxa commented Jan 28, 2020

Nice! And because awox syncs the data on all your mobile devices, it should be possible to use a root-vm to install the app, log in and get the data, without needing the own device to be rooted. And hopefully, this way doesn't offer personal data of other awox-customers.

@danxdz
Copy link

danxdz commented Apr 29, 2020

Yes it works, i manage to install android x86 on my atom laptop... install the awox app from play store.. at login it crashs but after trying to run the app, i just searched the file and nicelly got all infos like you said.. and now all worked :D nice job guys ;)

@rzr
Copy link
Contributor

rzr commented May 30, 2020

For those who managed to control from python and android please report your configurations using this script:

#17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants