Inim Alarm

Hi, same question here…Smartlan/SI and big headacke :frowning:

I figured some things out reading previous posts, but I really can’t find my token and my clientID.
I tried downloading burp suite, but I don’t understand how to use it: I’m completely new to “sniff things”.
I’m on a Mac and using Inim Home App on IOS.

BTW, I’m only interested in activating scenarios (i.e. Home/Away).

Thanks

Inim has an Alexa skill available. I’m using Alexa integration in HA to send a simple custom command to my Echo to Arm My House and Disarm My House with two scripts, then these can be used in your HA automations. Very easy / straightforward.

Dear @Jan_Willem_Maas,
I acquired a smartlan G card, and I’m following your API doc (BTW, great work you did on this!!!) to do the integration in Home Assistant.
So far I can already control the scenarios, but still a long way to go.
I just did the part to get the alarm log, but used your “old” NodeRed Code, which I am having troubles to “Form the url with #lines” … Reviewing the thread, I noticed you did some changes on NodeRed. I’ve been trying to adapt mine, but not luck so far (new on this matter, trying to improve my skills a little).
Would you mind to share it?
Many thanks in advance!

Hi @Jan_Willem_Maas , seems to be a problem with the characters can you please post it using pastebin.com? Because I receive the following error importing your code

Hi @Jan_Willem_Maas,
Thanks a lot for sharing.
I am also having issues with the format, trying to overcome it, but there is a lot of issues pasting the code from here.
If you could share on a text file or something that will not change too much the formatting , that will be great.
Thanks once again!

I have edited the post using pastebin.com

I have edited the post as you suggested

Thank you so much! I will try it now with the full setup as the PDF explain =)

It gets created and updated by the NodeRed node “Get random filename to HA”.

The last part of the pdf is now significantly out of date. This is because one cannot use the NodeRed “http request” node anymore to simply query the INIM system, at least in the out of date firmware that runs on my system; it generates an error message. NodeRed has become more strict in evaluating the INIM system’s response and is more strict than Postman (which still works unchanged). Apparently one of the response headers is in the wrong position. New firmware may not have this issue.

I have created a first workaround by creating two command_line sensors in HA for “alarm_scenario_state” and for “alarm_state”. The values can be used in NodeRed with the “poll” node. These command_line sensors are limited to 255 bytes responses.

However, the responses for alarm_zone_states and alarm_partition_states are a lot larger than 255 bytes. A command line sensor cannot store the response. The second workaround I created was to create two “rest” sensors using the “rest” integration, one for “alarm_zone_states” and another for “alarm_partition_states” as follows in the file “rest.yaml”:

  - resource: http://192.168.1.92:5050/cgi-bin/web.cgi?mod=zone&user=yourusername&pass=yourpassword&code=yourcode
    method: POST
    scan_interval: 120
    sensor:
      - name: "alarm_zone_states"
        value_template: "OK"
        json_attributes:
          - "zone"
              
  - resource: http://192.168.1.92:5050/cgi-bin/web.cgi?mod=part&user=yourusername&pass=yourpassword&code=yourcode
    method: POST
    scan_interval: 60
    sensor:
      - name: "alarm_partition_states"
        value_template: "OK"
        json_attributes:
          - "part"

The rest sensors are also limited to 255 bytes, but they can hold much more information in their attributes. By creating the sensors in this way, all the information is stored in their attributes. NodeRed can use these sensor’s attribute values in further processing the states.

I have spent some time now to update my notes in the manual. A new version is found below.

many thanks! Do you think that you’ll post the entire code to have a similar thing like your screenshot? I want to do a similar thing but with also some automations (eg. alarm is off, but if the kitchen door is open I want to turn on a light (that it’s a shelly)).

Thaaanks! =)

Thanks a lot once again @Jan_Willem_Maas.
The import of the NodeRed is successful, however I think I still have something missing, it is working fine until when the random number is appended to the filename. And then the copy to the local folder is not OK.
How is your shell command “copy_inim_alarm_report” configured at the moment?
And what about the Vertical Stack Card Configuration? Did you also need to change it, or is it still as before?

It is a bit much to upload the entire code, because some of it is in NodeRed and some of it is in HomeAssistant. I’ve tried to explain the logic of the various parts and the way they communicate with each other. I think for the rest you need to do some tinkering, because I will not be able to upload code that will work for you out of the box. I’d be happy to answer specific (short) questions, if I can.

I have also created some automations that execute when the alarm is on, switching off a the sensor in a specific room when the curtains close automatically. Once you have it integrared, you can tie it all together beautifully.

Here are the shell commands:

save_inim_alarm_report_to_disk_as_json: 'curl -k "http://192.168.1.92:5050/cgi-bin/web.cgi?mod=log&par={{states("input_number.inim_report_lines")}}&user=yourusername &pass=yourpassword&code=yourcode" -o "/share/inim/output_from_inim_as_json.txt" '

#################################################################################
# Move the alarm_report.html from /share where NodeRed puts it, to www where iframe can show it #
#################################################################################
copy_inim_alarm_report:
  'cp -u /share/inim/latest_alarm_report.html /config/www/alarm/html/{{ states("sensor.alarm_report_filename_random") }}'
delete_alarm_report_on_share:
  'rm /share/inim/alarm_report_*.html'
delete_alarm_report_on_local:
  'rm /config/www/alarm/html/alarm_report_*.html'

And don’t forget to add to the “configuration.yaml” file the authorization (for NodeRed) to write to the /config and /share directories:

homeassistant:
  allowlist_external_dirs:
    - /config
    - /share

You need to change the vertical stack card config, because the browser mod changed its specifications to version 2.0 and it is now defined as an integration. Here is my code:

type: vertical-stack
title: Alarm report
cards:
  - type: entities
    entities:
      - type: custom:slider-entity-row
        entity: input_number.inim_report_lines
        name: Aantal regels
        hide_state: false
        icon: none
      - entity: sensor.alarm_report_filename_random
        name: Filename
        icon: none
    show_header_toggle: false
  - show_name: true
    show_icon: true
    type: button
    entity: input_number.inim_report_lines
    icon: mdi:receipt
    icon_height: 50px
    name: Get latest
    tap_action:
      action: fire-dom-event
      browser_mod:
        service: browser_mod.popup
        data:
          title: Latest alarm report
          size: wide
          autoclose: false
          content:
            type: custom:config-template-card
            variables:
              FILE_NAME: states['sensor.alarm_report_filename_random'].state
            entities:
              - sensor.alarm_report_filename_random
            card:
              type: iframe
              url: ${'/local/alarm/html/'+ FILE_NAME}
        target:
          device_id:
            - yyyyyyyyyyyyy # get these from the browser_mod integration
            - xxxxxxxxxxxxx
      show_state: false
      show_name: true

Perfect @Jan_Willem_Maas, I missed to add the authorisation to write to the directories. Many thanks!

Regarding the virtual stack card config, it is sort of OK now, with a minor issue that I’ll try to sort tomorrow, instead of showing the alarm report in the popup, it is downloading the file. But almost there for this part. More to come.

I decided to change my write up to include the most recent issues. It can be found here Dropbox - HomeAssistant_INIM_API_notes_public-v5.pdf - Simplify your life

Many thanks for your great effort on this @Jan_Willem_Maas.
Just want to say that with you hints and updated “API_notes” it works like a charm. Very much appreciated!

Hi everyone!
I have a Smartliving alarm board with Smartlan/SI. My Smartliving board has an old firmware and it is not possible to connect to Inimcloud service. So my alarm is connected to Inim HOME P2P using a static IP address.
There is a way to connect my alarm to home assistant to activate or deactivate scenarios and to see the active scenario?

Hi All, I want to make a small contribute sharing with you the Official API Note from INIM (it’s in Italian but it’s very simple to translate it).