Integrate PIR motion sensor from existing central alarm with Raspberry and home assistant

Hi all,

I am very new with Home Assistant.
Here is my question:
I have an AMC alarm central system with its matching PIR (Infra Red) motion sensors.

Is there any way to get the motion sensor in Home Assistant?
I have very few knowledge about the AMC Alarm.

Yes.

Connect directly to GPIO of Raspberry pi and add as binary sensor. This may be easiest method.

Otherwise, does AMC have some Ethernet or serial connectivity?

I bought the AMC Ethernet module but didn’t install it yet. It has a simple application on ios that connects to their cloud. The alarm sends maybe alerts there.
Otherwise maybe it has a serial interface also or gpio also. I have seen some of it’s documentation.

I am not good with gpio and raspberry. Can I connect multiple sensors to the raspberry gpio ? What is the maximum number?

Thanks for your start of an answer

If the Ethernet module has a web interface then you could scrape its content using the Scrape Sensor. Not sure how responsive that will be though… Alternatively you could write your own Appdaemon script to collect the data from a web interface.

I think around 18 independent zones can be created.
You can place multiple in series or parallel to combine before connecting also.

It’s been a long time since I didn’t connect, and I was grabbing information about my project.
Apparently, a few people are asking about this on raspberrypi.org forum.
https://www.raspberrypi.org/forums/viewtopic.php?t=187074

Here is what I got as information:

Hi Akram,

Do you have any update on the above, I also bought the same AMC system and installed it already and I wanted to exploit the sensors around the house, I also wanted to have the information f whether my system is activated or not on my home assistant without going throw AMC Cloud services which is buggy most of the time.

I would appreciate it if you shared your findings.

Thanks in advance

It’s been a while but let try bring this topic back to life.
I have amc x824 alarm. I set up it myself. It has 12 pir sensors gsm and lan module installed and working. Alam can be controlled remotely over an app because it is connected to the amc cloud. Pir sensors are on all the time and I can see on the app when someone is in ie. Kitchen because sensor is sending info to the cloud.
Alarm is connected to the cloud over WiFi bridge because my router is too far away to connect it with lan cable. It has ip address and Web page.
I’m wondering is there a way to connect it with ha that I can use pir sensors for ie. Turning lights on, presence sensing and so on.

Hi @dadopq and @MedHoussem94 ,

that’s awesome, so we can kind of start a community now. I don’t have immediate physical access to my alarm now but soon, so we can then organise a kind of hackaton then.
But, now I have ssh access so, maybe we can experiment the advices given earlier by scraping the ui?
@dadopq I am not sure to understand all your findings. Do you already have some stuff working?

I bought alarm over year ago. As I have all wires conducted in the house I decided to buy an alarm and connect everything. I bought amc x824 central sensors siren gsm, lan and expansion module. I connected alarm, unika touch screen, sensors, siren, gms, lan and board expansion myself as no one in Croatia is installing this amc alarm model. I programmed alarm in amc program which you can download from amc web page. Amc cloud is working, alarm is working. I set up amc plus android app for alarm control over mob.
Now the interesting thing will be to get sensors status in home assistant as you can via pir sensors control ie lights presence sensing and so on. But I don’t know how to do it.

That’s the idea @dadopq . On my side, the alarm has been installed 2 years ago by a professionnal and I installed home assistant close by and I added the LAN module.
Both works well separetly, but now I want to integrate them to work together.

Right now I don’t have physical access to it and I was not that good in electronics to open it, but I will have more time soon.

If you think that you can run some commands on your installation we can try to reverse engineer the cloud protocol, but, I know that it is using TLS, so we probably have to spoof DNS and use a proxy to read the content in clear in our respective LANs .

Did you have a look at the 12V-3.3V optocoupler device that I was talking about 2 years ago?
I bought one, but it arrived too late for my tests. So, I have to wait for a while as well.

You have to take control over your alarm system. I don’t know how this guy installed your alarm but this is how I did.
I went to https://www.amcelettronica.com/ and create account. From the same site I downloaded manuals and amc program for programming alarm board over local wifi. To connect to the cloud you must have username and password from above site as well as UID CODE. This is alarm panel code. This code is accessible from alarm touch pad. Without it you can’t connect to the cloud. Maybe you should contact this guy who installed your alarm to give you installer access. Without you can’t do much about it.
This is cloud setting


I connected my lan module to router over wifi bridge. I bought VONETS VAP11G-300 and some Male Female Plug 12V Dc Power plugs. I set up wifi bridge on my comp and connected it to the lan module. For power I used this dc plugs and connected it to the main board power supply. The same one that is used for powering pir sensors.
Now I do have ip on my local network from my alarm and it is connected to the cloud. As I see on the app you have sensors status on the app as it send this status to the cloud.
I don’t know about this optocoupler device and I’m not sure that this is way to go.
I can run whatever command I want on my installation as I’m have full access on it.
From my alarm bridge ip I can access my local amc eletronica web server remote control. But it doesnt do as it say :smiley: There is no remote control over browser. But it does have debug page with a lot of debug info on connection.
Checking things out I found that my alarm is connected to the https://www.peeringdb.com/
It has in logs EEP UDPLOG IP and EEP UDPLOG PORT. Not sure is this of any help.

Would you mind sharing some output from the debug page to see how does it look like? Be aware to no share any personnal or sensitive data (tokens, uid, or passwords).
Can you read the status of the IR sensors? and how is it updated?
What about sending controls/commands to the alarm? what it is the format?
Do you have any example?

I can read status of the pir sensors but only over amc android app.Not sure can I do it over local net.
I can send commands to alarm over sms. This commands are alarm commands. But have to check manual for it.

This is debug output

   REFRESH(0 sec): http://xxxxxxx/tasks.html
Name         State  Priority  Stack   Num
---------------------------------------------
HTTP            R       2       760     10
TCPIP           R       1       926     0
EthIF           R       0       968     1
IDLE            R       0       108     11
Client          B       1       764     8
Leds            B       1       612     7
Reques          B       1       988     4
DHCP            B       0       574     3
Server          B       0       1222    9
UarSend         B       1       978     6
TmrSvc          B       0       214     12
UartRec         B       1       434     5
UartSvr         B       1       584     2
WSRead          S       0       954     15
---------------------------------------------
B:Blocked, R:Ready, D:Deleted, S:Suspended
---------------------------------------------
Task            Abs Time       % Time
---------------------------------------------
HTTP            586             1%
UartSvr         3847            7%
Client          1113            2%
Leds            196             <1%
TCPIP           2552            5%
IDLE            38836           79%
EthIF           10              <1%
DHCP            0               0%
Server          0               0%
UarSend         1213            2%
TmrSvc          0               0%
UartRec         242             <1%
Reques          315             <1%
WSRead          0               0%
---------------------------------------------
ExMem RTOS(452Kb) use: 37.96%
ExMem LWIP(60Kb) use: 4.22%
ExMem LWIP(60Kb) max: 13.64%
ExMem LWIP(60Kb) error: 0
IntMem DATA(112Kb) use:24.66%
Jun 19 2020 12:11:08
4.9.3 20141119 (release) [ARM/embedded-4_9-branch revision 218278]
STATE:CONNECTED

SYS UID: xxxxxxxxxxxxxxxxxxxxxxxxxx
EEP UID: xxxxxxxxxxxxxxxxxxxxxxxxxx
SYS Domain1: service.amc-cloud.com:443
EEP Domain1: service.amc-cloud.com:443
SYS Domain2: none
EEP Domain2: none
SYS URL1: ws/central?centralID=
EEP URL1: ws/central?centralID=
SYS URL2: wss://service.amc
EEP URL2: wss://service.amc
EEP UDPLOG IP: xxxxxx
EEP UDPLOG PORT: xxxxxxx

Http xHandle: 0x6000ce20
Server xHandle: 0x6000b9c0
Dhcp xHandle: 0x600048a0
Client xHandle: 0x60009a80
WSRead xHandle: 0x60020340
Recv xHandle: 0x60006760
Ping xHandle: 0x0
Cid xHandle: 0x0
UDP Log xHandle: 0x0

DhcpState: DHCP_OK
(DHCP IP SET)
IP: xxxxxxxx
NET: 255.255.255.0
GW: xxxxxxxxxx
DNS1: xxxxxxxxxxx
DNS2: xxxxxxxxxxx
DHCP LEASE:     |Day    |Hour   |Min    |Sec
                |0      |12     |0      |0|
DHCP LEASE TIME:|Day    |Hour   |Min    |Sec
                |0      |0      |8      |49|

Try to Connection: 3
sys->CloudRdy: ER_CLOUD_READY
sys->sys.EnConnCloud: CONNECTION_ON

sys->com.err_cloud: ER_CLOUD_CONNECTED
sys->com.error: OK
sys->com.proto: PROTOCOL 1

sys->ws.state: WS_CONNECT
sys->ws.opcode: PONG_OP

sys->cid.state: CID_NONE
sys->cid._104.cd: CMD_MONI
sys->cid.cid_server: xxxxxxxxxxxx```

That’s interesting. If you can read pir sensors statuses from the android app, and you can read that while being away from your house (using 3G/4G), it is very likely that theses sensors statuses are pushed to the cloud, and probably not readable using the alarm central webserver.

I remember that I reached the webserver landing page and it had very few informations in it. Do you have access to it?

Also, I didn’t have access to the Windows configuration tool that you are using from AMC; so, that’s good sign to see that the cloud server can be changed.
If this can be done, it probably means that the server identity is not hardcoded and that we could probably capture and the handshake procedure and emulate one to receive commands from the alarm.

Based on the android logs you are sending, it seems that the app is using websockets, that’s probably for the notification mechanism, which also means that we can emulate this.

Cloud server can’t be changed from the amc windows program but it can be changed from alarm keypad.But if you change cloud server alarm it wont be accessible from the app.
No this are not android log. This are alarm logs from alarm webserver and I have access to it.
This is as far as I came. I don’t know can we exploit this and how to do it to
get alarm connected to ha somehow.

Maybe this is a way to get sensors info

I can’t get cms on this alarm panel working. I’m obviously missing something. Does anyone have alarm system with cms setup to help me clarify this things up?
As I understand so far to get some info from the panel it has to listen to some port where it will send/recieve data over ip. So far panel is only listening to amc cloud on 443 port.
I tried with sia alarm system integration on home assistant but no luck. I believe it was made just for ayax alarm systems.

good catch @dadopq . According to the SIA alarm systems integration page (SIA Alarm Systems - Home Assistant) , this integration is not only supporting Ajax systems but all SIA compliant alarm systems.
Can you share with us how you set up the integration? and which configuration you set as IP/PORT in AMC configuration? your screenshot does not show any value.

I can’t set it up. Alarm has testing options. You can test ie. caller id, lan id sia id. Call id is working, lan id is working, but sia id isnt. I don’t know why. Probably you have to set up something on lan side. Sia integration on ha has username and password but i’m not sure how to properly set it up on ha and alarm side.
i tried this. Installed sia integration, set port ie. 3030 and some username i password. On alarm side I set ip from ha, as it runs on linux server, a port 3030. Port is open and listening but sia id test on alarm side failed. Also pir sensors are not available. Maybe its username/password problem but I’m not sure how to set this thing up on alarm side.
As your alarm system was installed by professional installer, can you ask that guy how cms on alarm side is working and how they set this up. Maybe you need some hardware, I’m not sure.