wildstray / meian-client

Shenzhen Meian Technology safety alarm systems TCP client
GNU General Public License v3.0
9 stars 4 forks source link

Usage examples #1

Open eogmau opened 4 years ago

eogmau commented 4 years ago

Hi @wildstray , great work on reverse engineering the meian protocol. I have as well an Meian alarm panel and would like to test your meian-client. At the moment I am using homeassistant which has an ialarm (meian) integration which is limited to arm and disarm. Can you provide some examples of the usage of your client?

zappasmart commented 4 years ago

I'm interested too, I'd love if eventually it could be used to implement a better Home Assistant integration. The current integration is developed by parsing the HTML from the panel web interface and lacks a lot of funtionalities.

maxill1 commented 4 years ago

I agree, more docs or a client example would be nice.

Il Mar 7 Apr 2020, 12:11 zappasmart notifications@github.com ha scritto:

I'm interested too, I'd love if eventually it could be used to implement a better Home Assistant integration. The current integration is developed by parsing the HTML from the panel web interface and lacks a lot of funtionalities.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wildstray/meian-client/issues/1#issuecomment-610300269, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACZTQTEAMOLR6R767XJYPDRLL36HANCNFSM4MAQ6TXA .

maxill1 commented 4 years ago

I'm not sure why but for some reason the first message received from my alarm (on connection) has an invalid XML with 2 root element (both Err and Root):

File "/opt/meian-client/meian.py", line 639, in _receive return xmltodict.parse(self._xor(data[16:-4]).decode(), xml_attribs=False, dict_constructor=dict, postprocessor=self._xmlread) File "/home/mce/.local/lib/python3.7/site-packages/xmltodict.py", line 327, in parse parser.Parse(xml_input, True) xml.parsers.expat.ExpatError: junk after document element: line 1, column 17

This is the decrypted message: <Err>ERR|00</Err><Root><Pair><Client><Err></Err></Client></Pair></Root>

As a temporary fix I edited line 639 and replaced the "ERR|00" part and now the client runs fine: from

self._xor(data[16:-4]).decode()

to

self._xor(data[16:-4]).decode().replace("<Err>ERR|00</Err>", "")

my alarm is branded as iAlarm (antifurto365)

lucaxxaa commented 3 years ago

Very interesting about this projec !.How can i use in my alarm? can you write a document for use it ?

yeahman45 commented 7 months ago

can you get sensor enrolled with the ialarm states with this python script?

wildstray commented 7 months ago

Hi, I want to reply you all, unluckly I have only one alarm bought in 2018. I didn't updated anymore this project cause I haven't newer alarms for more reverse engineering and I have no more free time...

About the usage of this library: look at the ending, the test code I leaved in place main() You have to instantiate a MeianClient() object with username, password and host and port (this can be the local alarm or the cloud server). This is a synchronous client. And you can have also a push (asynchronous, read only) client MeianPushClient() that call a function if an alarm is received. Sensors can be enrolled with SetSensor() and the sensor code.