Regarding battery drain, I would not care. A pack of rechargeable AAAs is about $10, and the inconvenience of swapping out the batteries is well worth it if it enables bigger and grander things. In my case, I am juggling a leaky mini split on its last legs, a neverending source of thermal load (boiler room below me), and a temperature-sensitive pet.
Thank you for your work again. The integration is coming along great and clean so far. Hopefully, this lazy API issue gets figured out
Oh, and one more thing. Another possibility is that there is no special request for actual data refresh, merely a “normal” request that’s appended and lets data come in for a few minutes. It might be something as blunt as reauthenticating or appending “yes send the data now please” to the status inquiry. This might be the case because I saw similar lagging in the app, too, after staying on the same device’s screen for too long - the graph seems stuck, and after a pulldown, the last few minutes load.
I’m sorry if I sound like a backseat developer. I am new to appliance reverse engineering, yet very excited about this specific project. Thank you again for all that you do.
yes it must be something like that, I’m sure we will figure it out. Mitmproxy is very helpful so far and all api-calls are visible. I just have to play around with it.
Don’t worry, It’s useful for me that we can discuss it and that you tell about your experiences.
I’ve committed and pushed the latest changes (basestation + some entities)
Also managed to install it as a custom component in my normal home assistant installation. I installed all files from the components/xsense directory to custom_components/xsense and added “version”: “0.0.1” to the manifest. After a restart of home assistant, xsense was available in the integrations page.
You don’t have to add anything to the configuration.yaml.
I have no idea how it will behave, so run it at your own risk.
I have tried to launch the “setup.py” with pip, but i have an error (cf. screen)
i have installed all requierments manually: request, boto3, botocore, pycognito
I’m running in a Docker container
You don’t need to touch python-xsense, but fetch the files from here:
Place those files in a folder called xsense in the custom_components directory. Then add a version-number in the manifest.json, because home assistant needs that for external components. Then restart home assistant. The component should now be available for testing.
The required python packages are installed automatically by home assistant. You don’t need to install them, but it won’t harm if you do.
Could you make your repository compatible with HACS?
You have to put “xsense directory” in a “custom_components” directory, change your manifest.json adding “version”: “1.0.0” and removing “async” for requirements.
I’m currently working in a branch of home-assistant-core and the goal is to have it included there. I don’t think that changes for hacs belong inside the home-assistant-core code, but correct me if I’m wrong.
I’ve spend some time tonight on the sync issue and I discovered an issue in my test-setup.
In my phone a proxy was configured, in order to intercept all traffic with mitm-proxy.
It turns out that xsense is ignoring the proxy-settings for websocket-connections.
I already noticed before that I no longer saw those requests and I now know why.
I added a few forwarding-rules (for a tranparent proxy) and I can see the websockets again. These contain mqtt messages, including updates to the temperature.
Figuring out how to connect to the websockets/mqtt will probably take some time.
My goal now is to finalize the other parts first:
add entities for all the things that I’m still ignoring
implement active info (if a device goes offline, show it in HA)
implement error-handling in the authentication, I’m currently ignoring things if authentication fails.
If you Need some help, i have the waterleak Sensors and 2 cams.
But One Thing, you have to explain how i can help, for example for sniffing the Communications, i don‘t know how it works.
Great Job man, One month ago, i googled a lot, But there was nothing to implement xsense in smart homes, and now, the fist Things in HA.
I was in contact with xsense, month ago and asked when they will implement mqtt or something like that, or a apicall. The answer was, „thats not in planning“
cool to hear and to see it running om someone elses installation.
Just spotted a stupid bug in refreshing the access-tokens. Because of that bug, the system will disconnect after 24 hours. I’ve fixed it already, but I have to build a new package.
About the sensors: I do have an waterleak sensor and will make sure that those entities show up. I don’t have a camera yet, so it would be very nice if you can help. I can make a script that dumps all information that is available and you can send me the relevant parts. What kind of information would be useful in home-assistant? Battery and online-status?
Including the video will probably much harder, and I guess I have to buy one myself to get that working.
Hopefully we can get the realtime alarms working if we have mqtt working.
That would be very nice, but you can also just share your camera via the app. If you don’t use it to guard your personal stuff and the stream is suitable for sharing, that would even be easier.
Can I find your review somewhere? I’m curious about the quality of the camera.
You cannot login more than once to the same account, but it is possible to make a second account and invite that account to view your devices. I did that for home assistant as well.
I had the same problem for connect 5 phones for check 7 temperature sensors, i got around the problem with send a share link through the base station on other mailbox.