There is no API command to reset the LAN card. I use a relay connected to one of the INIM outputs, defined that output as relay and then switch that output through the API
Thanks, as I guessed
Hi read your message only now.
I have a SmarltanSi without web server so I can connect to it oly by android app through port 5004 .
I tried to run the command to this port, but I don-t know where is my fault I have no response from the alarm. Maybe a wrong way to post api request (never did it before)
Or maybe I am missing the access token and qindex?
I will try to sniff the packet through android and we’ll see
Anyway GREAT WORK and thank you to both you and Stewie3112
Thank you for your reply I forgot to check this thread and I come here after many months because now I have time for this project.
I installed android studio loaded alienmobile application and configured my local address for smartlan.si
The app works and I can connect to the central but is seems to me that the app doesn’t send requests with HTTP protocol because I can’t find any HTTP packet only TCP. Maybe is due to the missing web server. Any idea?
Maybe I 'll have to switch to smartlan G
Hi, the SI card does not have a local webserver. The port you use is for programming the system, could be TCP. Your installer should give you the installer code. Or ask him to create a second installer user with different installer code of your choice.
I am not familiar with the android App. I use iPhone, but never tried Wireshark on that. The local webserver access is unencrypted and much easier.
Thank you for answering me , my installer is available for giving me access to the central but maybe will be wiser change the smart lan module to the G version.
I think the 150 euro worthwhile the much simpler approach I’ll have following your steps.
hello, great guide!
I was able to enter the commands for activating the scenarios, I cannot read the status of the active scenario and the sensors.
could you give me some more tips?
thank you
The status of the active scenario can be obtained by setting “mod” to “sce” and “par” to “now”. The response you get is a json file with the following info:
{
"lb": "Alles uit ", "id": "2"
}
You can find out which scenario is set by matching the “lb” to your defined scenarios like "Alles uit. ". Please ensure you include all the trailing spaces, because these are needed for a proper match. Alternatively, if you know the scenario id’s you can match the “id” to your respective scenario numbers.
I have implemented this in NodeRed, but can be done with a Restful sensor straight from HA. My NodeRed code is included in the documentation. I used NodeRed because I find it easier to navigate to the proper data in the data calls.
This example is in the doc. Also the way to read the other sensors is in the doc.
could you post a configuration example using Restful sensor? it returns me error.
thank you very much
The docs say create a restful sensor as follows:
# Example configuration.yaml entry
sensor:
- platform: rest
resource: http://IP_ADDRESS/ENDPOINT
method: POST
for the resource you would take:
http://192.168.1.92:5050/cgi-bin/web.cgi?mod=sce&par=now&user=youruser&pass=yourpass&code=yourcode
Please try it in the “Postman” application. It is much easier to debug your statement than in HA.
The reply would be a json file with the following structure:
{
"lb": "Alles uit ",
"id": "2"
}
You would need to get the sensor data from this json file. I am not the right person to ask how to do this. I think it is cumbersome and much easier in NodeRed. But there are plenty of examples around how to get data from a json file, using templating.
great, works perfectly!
now I also try with zones and areas
thank you very much
Hello everyone! As some of you mentioned the SI card does not have a local webserver, and that’s my case unfortunately. I started integrating everything yesterday using http requests to the APIs of inimcloud.com. I noticed that once you set a valid session cookie it stays valid for a really long period. The only problem I’m having is to force the server to update the doors and windows sensors’ states. What happens is that if I open a window its state only update in the http responses when I connect with my smartphone using the app Inim Home. I guess there’s some way to force this update as the app does. If anyone wants to give it a try and help me you are welcome!
Really interested to know how you integrated it. Want to share how?
Sorry for the late reply. To get all the information about the contact sensors (doors and windows) I do HTTP GET requests to the api URLs, such as https://intrusion.inimcloud.com/api/devices/<id_of_alarm_system>/zones
The api responds with a JSON that contains a whole bunch of info about each sensor. (status, id, device_id, zone_id, type, terminal_id, areas, bypassed…).
I found out, using the browser inspector, that the useful api urls are:
api/devices/<id_of_alarm_system> GENERAL INFO ABOUT THE ALARM SYSTEM
api/devices/<id_of_alarm_system>/codeinfo RETURNS FEW INFO ABOUT CURRENT STATE
api/devices/<id_of_alarm_system>/areas RETURNS LIST OF AREAS OF THE SYSTEM
api/devices/<id_of_alarm_system>/zones RETURNS DEVICES AND THEIR ATTRIBUTES
api/devices/<id_of_alarm_system>/scenarios RETURNS AVAILABLE SCENARIOS
api/devices/<id_of_alarm_system>/authenticate USED TO AUTHENTICATE WITH CREDENTIALS
Using the URL https://intrusion.inimcloud.com/api/devices/<id_of_alarm_system>/zones/<id_of_device>
(where <id_of_device> is the id of the contact sensor retrieved through api/devices/<id_of_alarm_system>/zones
) I’m able to set if I want to bypass a sensor or not. With the same logic I can activate the alarm using https://intrusion.inimcloud.com/api/devices/<id_of_alarm_system>/scenarios/<id_of_scenario>
with the right ID for the scenario I want active <id_of_scenario>.
As I was mentioning in the last post, I noticed that the info about the sensors do not update automatically in the server, but using the smartphone app (just opening it and going to the tab where the sensors’ states are displayed) the values get updated. The only workaround I’ve found until now is setting the sensor to bypassed false, which forces the current state to get updated for that specific sensor.
Thanks a lot @pla10 ! Getting the JSON’s is working great in my own browser (after being logged in).
However, I don’t know how I can create a script to have it authenticated automatically.
What are the parameters to authenticate?
I’ve tried those:
https://intrusion.inimcloud.com/api/devices/<my_id>/authenticate?user=myusername&pass=mypass&code=mycode
https://intrusion.inimcloud.com/api/devices/<my_id>/authenticate?username=myusername&pass=mypass&code=mycode
https://intrusion.inimcloud.com/api/devices/<my_id>/authenticate?username=myusername&password=mypass&code=mycode
https://intrusion.inimcloud.com/api/devices/<my_id>/authenticate?user=myusername&password=mypass&code=mycode
I’ve changed the framework. I was able to intercept how the mobile app works by sniffing the HTTP requests.
Now everything updates perfectly. I waited to reply as I wanted to know if it would eventually need to authenticate again, but apparently, there’s no need.
Basically now I just use two requests:
https://api.inimcloud.com/?req={"Params":{"DeviceId":<id_of_alarm_system>,"Type":5},"Node":"","Name":"Inim Home","ClientIP":"","Method":"RequestPoll","Token":<token>,"ClientId":<clientID>,"Context":"intrusion"}
https://api.inimcloud.com/?req={"Params":{"Info":4223},"Node":"","Name":"Inim Home","ClientIP":"","Method":"GetDevicesExtended","Token":<token>,"ClientId":<clientID>,"Context":"intrusion"}
The first request is used to force an update of the current state of the system and the second request retrieves all the valuable information at once. I know that this method is not particularly user-friendly since you need to intercept the HTTP requests of the mobile app to know the values of the <token>
and <clientID>
, but it is very efficient.
Hi @pla10 thank you so much for sharing your discoveries!
Would you care to elaborate a little bit more on how to create a sensor in ha? An example would be much appreciated
I managed to get all the data using the 2 requests you posted above. But now I am stuck on how I can use this data in home assistant . can you point me in the right direction?
Something I would like to do is :
- insert a scenario by HA
- create a sensor for a specific scenario so I can make automation with it…
I edited this post a lot but I made some progress while I was waiting for an answer but now I am really stuck
I’ve just noticed that I’ve never mentioned how I integrate the HTTP requests in sensors inside home assistant. The requests are performed in NodeRED where I use the “Entity” node from node-red-contrib-home-assistant-websocket to update the state of the sensors.
Yesterday the requests stopped working and I started getting as a response that the session had expired. I had to intercept again a valid token using the computer as a proxy to sniff the iOS app communication. I will try to automate this step to avoid future stops, but I don’t know how to yet.