Following my previous question, I just found a way to enable scenes via an http POST using the smartlan/G. If anyone interested I can post a guide!
I just needed to enable two scenes, i didnât need to retrieve the status, for that I use a physical relay triggered from an alarm exit pin
Sure, youâll need:
- wireshark (to sniff packets)
- talend api tester (chrome plugin, not compulsory, but easy to test if everything works)
- patience
start with navigating to the smartlan/g local ip, you should find a login screen like this:
login
open Wireshark
filter per network connection (In my case ethernet), destination device (ip of smartlan) and request method (POST)
now navigate to the page of interest (in my case âSCENARIOSâ)
these are in my case the 3 statuses of the alarm: enabled everywhere, disabled, enabled only outside
start wireshark sniffing
click one of the alarm scenarios and look closely at Wireshark. You should notice 2 POST requests different from the others in the âhtml form url encodedâ section. skip the first one and go to the one like the screenshot above (with the form_item âmodâ=âdo_sceâ)
youâll find 4 keys:
1.tk ( I guess itâs the access token)
2.qindex (always zero in my case)
3.mod (do_sce is the one to activate the scene)
4.par (is the scene number itself, test with other scenes and itâll change)
now move to chrome extension and use the values just found:
click send and⌠voilà , if you receive a 200 reply the scene should have changed.
now just watch the cURL equivalent and use it in a command line switch or build a restful switch
Hope everything is clear
Regards
Stefano
Great guide! Thanks.
Do you know if individual sensors are exposed via the API as well?
Honestly I havenât tried, but it should be possible, you should just dig between the communications in wireshark.
The only thing I forgot to mention: the token is probably temporary. Right now itâs working since some days, but I expect it to expire sooner or later. Iâll then search a method to renew it and post here.
Ps: this is not an API, but a diy method
Thank you! Brilliant!!
Can you explain how to do a restful switch, with the curl?
Thank you so much
Hi, sry for the late reply⌠I honestly used the command line switch, converting it to a template switch (I use another sensor to retrieve the status of the system).
Anyway it shouldnât be too hard, you can start by copying the fields from the curl request
@flamegrilled, did you manage to connect yours to Konnected?
I just pulled the trigger because of their Black Friday Sale.
The only thing Iâm worried about is that the siren on my system gets a constant power and sounds when being disconnected. Wonder if Konnected can replicate this.
Hi I am trying to follow your steps.
I have a SmartLAN/SI but I am unable to reach it from the local network. Do you know if it needs some configuration for accepting lan connections? Do you know if it uses a specific port?
Edited: Never mind I found that the mine doesnât have a web server and I can contact it only trough the app of cloud site. do you know If I can use you sniffing technique anyway?
thank you
Andrea
Hi Andrea, unfortunately I donât know how your specific model behaves to requests, but if the app is working fine even with direct access (no cloud, just ddns with ports forwarded) you can try to emulate the app itself on a pc (via Xcode or android studio for example) or, if you have android, I think there are various packet sniffers available.
Anyone here got a solution already? Doubting to buy a Konnected Alarm Pro PanelâŚ
I have an older version of the SmartLan-G. The restful commands for the scenarios that I have discovered are:
alles_aan:
url: 'http://192.168.1.92:5050/cgi-bin/web.cgi?user=username&pass=passcode&code=codenumber'
method: post
content_type: 'application/x-www-form-urlencoded'
payload: '&mod=do_sce&par=1'
I have five scenarios and the par parameter ranges from 0-4. I have no session or access token. Just user, password and code.
I have created scripts to execute these restful commands. And in Lovelace I have five png pics that can be pressed:
type: picture-elements
title: INIM alarm
elements:
- image: /local/alarm/alarm_alles_uit.png
type: image
entity: script.alarm_alles_uit
style:
top: 10%
left: 50%
tap_action:
action: call-service
service: script.turn_on
service_data:
entity_id: script.alarm_alles_uit
state_image:
'on': /local/alarm/alarm_alles_uit_on.png
'off': /local/alarm/alarm_alles_uit.png
I spent some time figuring out how to make the state_image work. The key was to add the script as an entity to the image. Now if you call the script, the script entity is âonâ for the time the script runs. I added a brief delay of â00:00:00:100â = one hundred milliseconds to show the âonâ image.
I have the SmartLAN/SI programming manual that contains the exact steps to connect to the board with a windows laptop. Let me know if you want it.
@fmmsfz, @flamegrilled, @Sam_Van_Herzele, @asp, @iShortOne, @Denny_d, @lupick, @caimale, @Freggel
I have managed to get all the INIM commands and sensors working and showing in the frontend by using @Stewie3112 post above. See the manual with the full description in my post below.
Great to see that you managed to get it working without token, anyway after various months and reboots it never changed (the safety of this alarm web control is ridiculous).
I just have to manually force reboot the smartlan g every 40-50 days because it just stops answering to curl calls, rubbish hardwareâŚ
Yes I agree. I reset the SmartLAN-G every night by interrupting the LAN cardâs power supply for a few seconds. Since INIM is now fully integrated into my Home Assistant, the automation to achieve this is a breeze.
INIM API documented
@fmmsfz, @flamegrilled, @Sam_Van_Herzele, @asp, @iShortOne, @Denny_d, @lupick, @caimale, @Freggel
I have followed up on @Stewie3112 's work and have fully documented INIMâs API.
It includes setting arming scenarios, a sensor for the current scenario, switching and sensing outputs such as siren, blinking and flashing lights and other relay outputs, sensing individual partitions and zones and doing relevant switching commands on these. And lastly it includes downloading and showing an alarm history report in the frontend with a popup window with the number of lines set by slider.
I have described the way I have done the integration with Home Assistant. It is done through Home Assistant restful commands for the command part. I use NodeRed for the sensors which is great if a proper integration is not available.
But this is maybe only for the INIM diehards. Perhaps somebody with the right skills can make this into a proper integration?
I have documented my findings in the attached manual.
A snapshot of my alarm page follows below:
So far the functionality works like a charm. Much better than the INIM app. And I have taken advantage of the integration in HA by programming a few automations which are hard to do in the INIM system.
Drop me a line if you need any help.
thatâs an impressive amount of work XD
just one question, how do you reset that crap lan card daily? have you found an api command or you just disconnect power through a relay?