I think it should be a single integration (you only have to login once), but it is a completely seperate thing that works differently.
I think it is best to finish the first part before moving on to the camera’s.
I haven’t seen the actual stream yet. Saw a websocket connection, but didn’t look at the contents. I can share the file with you, but you still have to use mitmproxy to open it.
made some progress, I’ve added some simple error handling. When a session is no longer valid, the component tries to login again. If that fails, the reconfigure-flow is used to ask for new credentials.
If a device goes offline, it should now be visible. However, the detection in XSense seems to be very slow.
What I have at the moment:
SBS50 - basestation
XH02-M - Heat Alarm
XC01-M - Carbon Monoxide Alarm
XS01-M - Smoke Detector
SWS51 - Water leak detector
STH51 - Hygrometer-Thermometer
I spent a lot of time last week, but we are getting there with a functional first version. I’m slowly starting to understand how to build an integration.
The only major issue remaining is that we don’t yet have a way to trigger the system to update automatically. However, since someone has already set up the MQTT, it should be possible to add this feature later.
I’ll test and finalize it in the next few days and plan to push it early next week.
I had an epiphany yesterday. What if we use the system as intended? I’ll check if the base station reports anything if one of the devices is throwing an alarm.
EDIT: I think I’ve found a way to get a status update from a device.
I set a temperature alarm, put it up above an oven, and saw that it had thrown a warning in the app. I then closed the app and started a looped Python script to monitor the device’s temperature and its alarm status.
After four minutes, the device stopped updating its temperature, with the alarm still on. I gave it a couple more minutes to be sure. Then, I’ve put it in the fridge. Viola! Once the device cooled down back into the allowed temperature range, it had updated its temperature reading.
Pic shows current temp and if the alarm is triggered
What I am getting to is that if all you need from the device is to get a reading if it’s too cold/hot, and the most recent temp reading, then it’s okay to use the alarm functionality. The device overcomes its battery saving throttle/logout if it needs to throw an alarm.
UPDATE: I GOT IT WORKING AFTER THE UPDATE THROUGH HACS. I’M KEEPING THIS POST HERE IN CASE IT’S SOMEHOW HELPFUL(??)
I still can’t get this working.
So I deleted my install in custom_components and reinstalled manually by downloading the github files and adding the version to manifest.json.
The result was that it “failed setup, will retry” – it appears to keep retrying. I turned on logging, log says:
``` Logger: py.warnings Source: custom_components/xsense/coordinator.py:113 integration: X-Sense Home Security First occurred: 9:46:11 AM (1 occurrences) Last logged: 9:46:11 AM
/usr/local/lib/python3.12/site-packages/xsense/async_xsense.py:161: RuntimeWarning: coroutine ‘ClientResponse.text’ was never awaited raise APIFailure(f’Unable to retrieve station data: {self._lastres.status}/{self._lastres.text()}’ ```
its working, i did some changes with Thero. He did. the work and i does it in the repo. But i did a fork of Elwinmages repo, Its a Little Bit easier for me, and his repo is a Backup. Today now Its Version 1.0.0 out. I installed i many times with HACS it is working, also Elwinmages repo. Its only allowed to have supported devices, you Must have 2 acc for xsense, one Main for the mobile and one for Home Assistant.
First of all, i highly appreciate all your guys work here. I have the cpl. package of x-sense devices including the cam mentioned above. It would be perfect for me to have this integration.
Hi @Jarnsen ,
i followed the HACS integration and was succesfull to integrate my account (2nd acc…) but it cannot integrate any device. Failure is “as never awaited raise APIFailure(f’Unable to retrieve station data:404” The app recognizes my login with HA in the App (same time).
Any idea what i can do to fix it? Is there another prerequisite other than HACS ? With todays update i hoped to fix it, but no difference…
Thank you !