-
Notifications
You must be signed in to change notification settings - Fork 1
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
[WIP] lares 4 proof of concept #4
base: development/4support
Are you sure you want to change the base?
Conversation
i've tested (to the best of my knowledge and with help from chatgpt) your second version. This is the test file i'm using: import pytest @pytest.mark.asyncio
@pytest.mark.asyncio
@pytest.mark.asyncio
@pytest.mark.asyncio
async def test_get_zones():
async def test_info():
I'm able to connect and get all the data!!! Anyway, these are the responses and the data I get from the API: LOGIN: SCENARIOS: Sent: {'SENDER': 'Massimo', 'RECEIVER': '', 'CMD': 'READ', 'ID': '2', 'PAYLOAD_TYPE': 'MULTI_TYPES', 'PAYLOAD': {'ID_LOGIN': '2', 'ID_READ': '1', 'TYPES': ['SCENARIOS']}, 'TIMESTAMP': '1736461258', 'CRC_16': '0xe8eb'} PARTITIONS: Sent: {'SENDER': 'Massimo', 'RECEIVER': '', 'CMD': 'READ', 'ID': '2', 'PAYLOAD_TYPE': 'MULTI_TYPES', 'PAYLOAD': {'ID_LOGIN': '2', 'ID_READ': '1', 'TYPES': ['PARTITIONS']}, 'TIMESTAMP': '1736461259', 'CRC_16': '0x5e8c'} ZONES: Sent: {'SENDER': 'Massimo', 'RECEIVER': '', 'CMD': 'READ', 'ID': '2', 'PAYLOAD_TYPE': 'MULTI_TYPES', 'PAYLOAD': {'ID_LOGIN': '1', 'ID_READ': '1', 'TYPES': ['ZONES']}, 'TIMESTAMP': '1736461464', 'CRC_16': '0x2666'} INFO Sent: {'SENDER': 'Massimo', 'RECEIVER': '', 'CMD': 'REALTIME', 'ID': '2', 'PAYLOAD_TYPE': 'REGISTER', 'PAYLOAD': {'ID_LOGIN': '1', 'TYPES': ['STATUS_SYSTEM']}, 'TIMESTAMP': '1736461876', 'CRC_16': '0xe2ab'} |
Hello @tosomax, have you tested it against a BTicino 4200? Your tests are OK. Well done. I think I am missing 2 functions to cover the As to the sender concerns...I have no official doc but being a websocket I imagine it is just a way to "mark" to whom the message is sent. Furthermore I would like to discuss the gaps between the types defined by @johnnybegood and the lares4 models. We should discuss how to solve this aspect. Other question is: are you gonna support only the alarm system or also domotic entities? In the first case I will need to put some filters here and there. PS: it should work with a normal pin...I would check permissions. |
Yes I'm using 4200C from BTicino. I will check if there Is some permission to change in the installation page to allow login with a normal PIN and let you know Thanks again for helping |
We can definitely expose more than the alarm. It can be something we add to the model, the |
I have tried to see in the installation menu if there is some way to allow permission to connect remotely for my user, but I can't find anything wrong. The PIN i'm trying to use is a "master" user, and with this the login fails. However, if I just use a plain wrong PIN I can see the error related to the failed login attempt in the history of my alarm app, if I use a correct PIN (the master user) I have a failed login, but no error message on the app. Anyway, I have confirmed that the login is possible and it can receive data. Maybe now is not the time to troubleshoot this kind of issues, so whenever you need some testing, please let me know. Again I want to thank both of you for your efforts |
Let's start with mapping the zones. So what we need to figure out is what each of these fields mean and what values they have for the cases:
Extracted part: {
"ID": "1",
"DES": "Porta Blindata",
"PRT": "4",
"CMD": "F",
"BYP_EN": "T",
"CAT": "GEN",
"AN": "F"
} Guess of chatgpt:
@tosomax @glsorre can you guys for 1 zone get exports when triggered (with alarm off) and when idle + maybe with bypass on and off? |
@glsorre can you point this PR to |
Hi @johnnybegood, I moved the PR to the other branch. BTW playing with the domotic part of the system I understood that there are 2 different types of payload commands:
If you send the second type of request on the WebSocket it will start to send messages everytime the zone is updated:
so I think we should map this as well. @tosomax I investigated a bit the PIN I use is not even Master I am using a Standard PIN from what I understand from JSONS. So there should be something different between ksenia lares4 and BTicino in terms of permissions. |
I've tried to open the window from the "Studio" and disabled the zone "Porta blindata" from the app. The I've run the script and got this: |
I was able to do install a man in the middle proxy and get some very useful data: Finally I have opened one sensor and got a message from the 4200C, and then closed the sensor and got the update. I have copied all the raw data, I will remove some info and post it here |
OK...I will update the PR. I will need to add a sort of auto discover feature as I have in
Let's concentrate on alarm system for now...then I will add OUTPUTS and other domotic entities. |
I was able to fix the login issue by changing this part (changed payload type from unknown to user)
|
Cool! I used a similar approach to yours using a proxy to read messages sent and received to/from the socket by the web interface and the mobile app. For ksenia lares the login payload is: {
"SENDER":"XXX",
"RECEIVER":"",
"CMD":"LOGIN",
"ID": "1",
"PAYLOAD_TYPE":"UNKNOWN",
"PAYLOAD":{"PIN":"XXX"},
"TIMESTAMP":"1736673121",
"CRC_16":"0xda5d"
} BTW is a small change we can manage it with some configuration injection. |
Hi I had a couple of hours and I worked on it:
small step forward :) |
not sure we need this anymore as I can ask directly for statuses in READ/MULTI_TYPES requests |
Found this, in case you find it useful |
Incomplete...but enough to start a discussion.