Interlogix Ultrasync

That’s really unfortunate; I have captures from a ComNav device going off and the latest changes appeared to work through all my testing. Reguardless, I pushed all of my latest changes to my GitHub Branch (Master), bumped the version (v0.9.2) and upgraded my HA Integration requirements (so the HA branch is updated too). Can you just try again using all of the latest code + latest integration? If it still doesn’t work, i may need you to do a --dump for me. I realize you don’t want your alarm to go off (audibly), the good news is the --debug-dump has been stripped of a lot of checks making it much much faster (might take 30s or so to run). You SHOULD be able to execute it and still disable your alarm panel right afterwards:

# only proceed if all of the latest code changes don't work
# make sure to restart HA too in order to be sure it all got
# loaded correctly
./ultrasync --debug-dump
./ultrasync --scene disarm

Now on a second topic; here is a the lovelace alarm panel i’m using and it works awesome in case anyone is interested; you’ll need to have the following lovelace resources added (whether manually or through HACS):

Here is the lovelace magic:

type: custom:layout-card
# Define a 4x2 grid
layout: grid
gridrows: auto auto
gridcols: auto auto auto auto
cards:
  - type: custom:button-card
    name: 'Home Alarm'
    show_state: true
    color_type: icon
    # | x | x | x |   |
    # | x | x | x |   |
    gridcol: 1 / span 3
    gridrow: 1 / span 2
    style: |
      ha-card {
        box-shadow: none;
      }

    entity: sensor.ultrasync_area1state
    tap_action:
      action: >
        [[[
          if (entity.state.startsWith("Armed") || entity.state.includes("Delay"))
              return "call-service";
          else
              return "none";
        ]]]

      service: ultrasync.disarm

    icon: >
      [[[
        if (entity.state.includes("Ready"))
            return "mdi:shield-home-outline";
        else if (entity.state.startsWith("Armed"))
            return "mdi:shield-lock";
        else if (entity.state.includes("Delay"))
            return "mdi:shield-home";
        else if (entity.state.includes("Fire"))
            return "mdi:fire-alert";
        else if (entity.state.includes("Medical"))
            return "mdi:ambulance";
        else if (entity.state.includes("Alarm"))
            return "mdi:shield-alert";
        else if (entity.state.includes("Low Battery"))
            return "mdi:battery-low";
        else if (entity.state.includes("Sensor"))
            return "mdi:alert-circle";
        else // Unknown
            return "mdi:lock-question";
      ]]]

    styles:
      state:
        - font-weight: bold
        - font-size: 1.2em

      icon:
        - color: >
            [[[
              if (entity.state == "Ready")
                  return "#00a30e"; // Green
              else if (entity.state.startsWith("Not Ready"))
                  return "#c7a600"; // Orange
              else if (entity.state.startsWith("Armed"))
                  return "#9e0000"; // Red
              else if (entity.state.includes("Delay"))
                  return "#c7a600"; // Orange
              else if (entity.state.includes("Alarm"))
                  return "#9e0000"; // Red
              else if (entity.state.includes("Sensor"))
                  return "#c7a600"; // Orange
              else
                  return "#005f9e"; // Blue
            ]]]

      card:
        - animation: >
            [[[
              if (entity.state.includes("Delay") || entity.state.includes("Alarm"))
                  return "blink 2s ease infinite";
              else
                  return undefined;
            ]]]

  - type: custom:button-card
    name: 'Stay'
    tooltip: 'Set Alarm in Stay/Night mode.'
    color_type: icon
    # |   |   |   | x |
    # |   |   |   |   |
    gridcol: 4
    gridrow: 1
    style: |
      ha-card {
        box-shadow: none;
        height: 100%;
      }

    entity: sensor.ultrasync_area1state
    tap_action:
      action: >
        [[[
          if (entity.state == "Ready")
              return "call-service";
          else
              return "none";
        ]]]

      service: ultrasync.stay
    icon: >
      [[[
        if (entity.state.includes("Armed Stay"))
            return "mdi:shield-check";
        else if (entity.state.includes("Delay"))
            return "mdi:shield-lock";
        else
            return "mdi:shield-half-full";
      ]]]

    styles:
      icon:
        - color: >
            [[[
              if (entity.state == "Ready")
                  return "#005f9e"; // Blue
              else
                  return undefined;
            ]]]

        - filter: >
            [[[
              if (entity.state != "Ready")
                  return "grayscale(100%)";
              else
                  return "grayscale(0)";
            ]]]

  - type: custom:button-card
    name: 'Away'
    tooltip: 'Set Alarm in Away mode.'
    color_type: icon
    # |   |   |   |   |
    # |   |   |   | x |
    gridcol: 4
    gridrow: 2
    style: |
      ha-card {
        box-shadow: none;
        height: 100%;
      }

    entity: sensor.ultrasync_area1state
    tap_action:
      action: >
        [[[
          if (entity.state == "Ready")
              return "call-service";
          else
              return "none";
        ]]]

      service: ultrasync.away
    icon: >
      [[[
        if (entity.state.includes("Armed Away"))
            return "mdi:shield-check";
        else if (entity.state.includes("Delay"))
            return "mdi:shield-lock";
        else
            return "mdi:shield";
      ]]]

    styles:
      icon:
        - color: >
            [[[
              if (entity.state == "Ready")
                  return "#005f9e"; // Blue
              else
                  return undefined;
            ]]]

        - filter: >
            [[[
              if (entity.state != "Ready")
                  return "grayscale(100%)";
              else
                  return "grayscale(0)";
            ]]]
1 Like

Upgrading to 0.9.2 makes it work!

No idea what caused the issues but it’s all working and I get a Buglar Alarm notification on my HA :wink:

As a second note,

I created a HACS integration that might make it easier for people testing here.

If you have HACS installed, you just need to click on it and then click on the 3 little vertical ellipse tool at the top right hand side and choose to add a custom repository.
You can specify an Integration and add the host: https://github.com/caronc/ha-ultrasync

From there you can install the UltraSync tool directly into your instance of Home Assistant without all of they hacky options identified above.

Another thing i personally tend to do is go into the UltraSync integration (after it’s been added) and i change the timer to be 1 second. This makes the refresh and status update of the alarm really slick (much more responsive) when sensors get tripped, etc.

Adding it as through HACS doesn’t work for me.

I uninstalled the ultrasync I had running. Installed the HACS and when I try to add the Integration it doesn’t pop up or show up.

I had to restart twice; i’m not sure why. It seems that after adding the repository, the Install action doesn’t work (even though it says it does). After i re-started though, i was able to try the Install again and the files got placed in /path/to/config/custom_components/ultrasync.

I restarted a second time so that it could find the new python files (since HA was already loaded).

Hi,

I have installed your plugin through HACS and it works great to arm/disarm the system! Thanks a lot for that.

Do you plan on adding the sensors status and/or the sensors as devices in HA so we could use them for automation like when a sensor is triggered, do something?

1 Like

I’d love to but i don’t know how at the moment :slight_smile:

I did ask on Discord and was pointed to this section of code which is still a bit over my head at the moment :exploding_head:. It’s implementation requires people to explicitly identify a white/black list for the entries while it scans over them all. I don’t think we’d need to go there yet. We should be able to use the ultrasync.zones dictionary variable that’s already being updated live with our live sensor data. If you follow the link though, it’s quite mind boggling…

If you or anyone knows what’s going on here, feel free to do a pull request. I’ll hopefully take another peek at it this weekend and see if i can figure it out. I too would love to use the variables. I imagine it would be something like sensor.ultrasync_zone10. They would be a sensor and not a binary_sensor just because they carry possible states like Bypass and Low Battery, etc too. I don’t think it would be good to use the sensor names (sensor.front_door); we can change the friendly name of them in Home Assistant anyway. Using zone numbers would eliminate any possible ambiguity caused by 2 (or more) sensors that could potentially have the same name (worst case). Thoughts?

I haven’t program for HA yet so yes that is a little confusing for me too. I’m also not fluent with python so I haven’t went through your code for now to see what has been done.

My first thought would have been to go through the zones using the ultrasync.zones dictionary has you mentionned. Also use the generic name and not custom sensor name like you say would be a better idea.
I would need to do a lot more reading to help you more for now because I just came back to Home Assistant after a long time.

Looking at this integration blueprint repo, there is a really basic example to define sensors:

I guess you could add ALL the zones from ultrasync using async_add_devices and the ones not used could be disabled in the UI directly.

With respect to this comment here:

Newer Hills ComNav devices can have like 128 of them; older can only have 16 or so. I think my Informix model can have 24 (not sure). But the point is no one will want to see 128 fixed sensors. I think we’d want to just see the detected/activated ones. Again, I don’t know how to do this (not yet anyway).

Then with respect to this question:

My thoughts are… that would be ‘A LOT’ of empty unused sensors as we’d need to initialize 128 of them which might be overkill. But this is definitely a solution for sure.

In my opinion, the zone sensors need to be a bit more dynamic (just use the ultrasync.zones dictionary as discussed; it’s already filtered). The issue is: at the start of the async_setup_entry() function, we haven’t gotten the zone information available to us yet. (the ultrasync.zones dictionary is empty). We need to add the zones dynamically after the first poll to the UltraSync hub. This is where that strange chunk of code comes in I sourced earlier. Apparently within that shows how to add sensors dynamically after (once they are known). The code is confusing because it does a lot more then we need it to as well (sourcing black/white lists and dynamically adding and destroying sensors on the fly), where we just want to add the sensors we fetch (once) and keep them updated.

That makes a lot of sense. I did not catch all of that information!

Just to let you all know I’ve made some progress with having all zone and area sensors get dynamically generated on the fly here.

It’s really cool when it works.… but there is some strange timing issue that prevents it from working all the time… and that’s what I’m still trying to figure out.

  • It dynamically loads just the Area’s detected (for most of us, this is only 1 area), but it no longer generates the extras
  • It dynamically creates a zone for every detected zone found too. As discussed in an earlier thread, i did not use the assigned names from the panel though. I just used Zone1State, Zone15State, etc. It’s consistent with the Area entries.

Hopefully I’ll figure it out an will merge it for you all to test. If there are any devs in this thread who can see what I’m doing wrong, I’d absolutely love some help here. :slight_smile:

1 Like

Update all pushed to HACS :+1: :tada: :slightly_smiling_face:

Zones and Areas sensors are now dynamically generated in the latest HACS update.

I also recently got my other PR’s merged so I believe this UltraSync implementation is now part of the default HACS install; so no need to add the repository manually as identified in an earlier thread here.

This latest update includes all of the dynamic sensor generation as stated in my previous comment and I’ve also added attributes to the sensors too using the there details from the hub. I figured it might be easier for everyone to match up what zone sensor goes where. You can rename their friendly name if you need to from within HA.

I have not pushed these over to the core PR I’ve also already still got open. I’ll be interested in everyone’s feedback! :slightly_smiling_face:

2 Likes

Works like a charm :wink:
Also the HACS Repo is added in one try now.

Hi!
That is good progress!! It works very well on my side!
Now that there are sensors, do you have any ideas how to add them to HomeKit using HomeKit Bridge?
All my other devices are added correctly.

Can it be because you do not create a “Device” with all the entities linked to it? I think that if there is no device grouping them it can’t be added to HomeKit.

Do you think it would be easy to create such a device?

Thanks

I honestly do not know much about HomeKit at all. I’m not sure what is involved in creating a device. It looks exclusive to Apple (I don’t actually own anything Apple myself)? Based on a few Google searches, you may need to reverse engineer some of the Python code I wrote so that it works with the Apple framework? I don’t think i’ll be able to help you here :man_shrugging:

sorry :slightly_frowning_face:

I don’t think there is something special to do at all. It is all handled with the HomeKit Bridge integration but to be able to be detected as a device it needs to be added to Home Assistant as a device (which contains entities).
In other words, if you check your devices list in HA (config/devices/dashboard), Ultrasync should appear there.
Most of my other integrations have 1 device + X entities and this way it can be added as a HomeKit device. Ultrasync only as entities and no device.

EDIT: maybe I’m wrong and I’m understanding all of this wrong

The more I read, the less I think it is a problem with the “device”.

Here is a list of what is supported in HomeKit Bridge: https://www.home-assistant.io/integrations/homekit#supported-components

My guess is that we are using sensor for the zones but it would not work because it is not one of : TemperatureSensor, HumiditySensor, AirQualitySensor, CarbonMonoxideSensor, CarbonDioxideSensor or LightSensor.

I think it would be directly working if it was binary_sensor instead. But as you mentionned before, you can’t really use them as binary_sensors

Yeah, i’m not sure how easy it is to integrate there.

The alarm_control_panel might be possible, but it seems to be more geared towards systems that only have a digital screen interface (keypad). Where with the UltraSync this is all bypassed because you log in to the device itself through it’s web interface (there is no numeric/integration per say).

But i suppose it would be possible to have the numbers just not do anything, but have the Arm/Disarm buttons trigger what you can already do? This might be a bit of overkill for very little reward though, It also won’t solve your sensor issue :frowning:

Because of @l2g his comment I start reading and looking in the alarm_control_panel card.

The arming_time is 0 because my UltraSync system has an own timer.

In my configuartion file:

alarm_control_panel:
  - platform: manual
    name: "Alarm 66B"
    code:  yourowncode
    arming_time: 0

in my automation file:

- alias: alarmdisarm
  description: ""
  trigger: 
    - platform: state
      entity_id: alarm_control_panel.alarm_66b
      to: 'disarmed'
  action:
    - service: ultrasync.disarm

- alias: alarmarmstay
  description: ""
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm_66b
      to: 'armed_home'
  action:
    - service: ultrasync.stay

- alias: alarmarmaway
  description: ""
  trigger:
    - platform: state
      entity_id: alarm_control_panel.alarm_66b
      to: 'armed_away'
  action:
    - service: ultrasync.away

- alias: readalarmstay
  description: ""
  trigger:
    - platform: state
      entity_id: sensor.ultrasync_area1state
      to: 'Armed Stay'
  action:
    service: alarm_control_panel.alarm_arm_home
    data:
      code: yourowncode
    entity_id: alarm_control_panel.alarm_66b

- alias: readalarmdisarm
  description: ""
  trigger:
    - platform: state
      entity_id: sensor.ultrasync_area1state
      to: 'Ready'
  action:
    service: alarm_control_panel.alarm_disarm
    data:
      code: yourowncode
    entity_id: alarm_control_panel.alarm_66b

- alias: readalarmaway
  description: ""
  trigger:
    - platform: state
      entity_id: sensor.ultrasync_area1state
      to: 'Armed Away'
  action:
    service: alarm_control_panel.alarm_arm_away
    data:
      code: yourowncode
    entity_id: alarm_control_panel.alarm_66b

You can make it probally shorter, but I couldn’t care :wink:

This is my Alarm Panel Card:

type: alarm-panel
states:
  - arm_home
  - arm_away
entity: alarm_control_panel.alarm_66b
style: |
  #keypad {
    display: none !important;
  }

You need this HACS plugin for the style and no keypad thing: https://github.com/thomasloven/lovelace-card-mod

1 Like