core icon indicating copy to clipboard operation
core copied to clipboard

Alarm panel not showing keypad with SimpliSafe integration

Open veedubb65 opened this issue 1 year ago • 7 comments

The problem

The alarm_control_panel card should show a keypad, and require the entry of the security code which was configured in the SimpliSafe integration. Until recent versions, it did so consistently unless you added the security code to the yaml for the card.

For last few versions (not sure how many) this has not functioned properly. The following yaml, which is the default when adding an alarm card for SimpliSafe, includes buttons for Home and Away when unarmed, and disarm when armed. No keypad is displayed, and all functions work without requiring the security PIN.

`states:

  • arm_home
  • arm_away type: alarm-panel entity: alarm_control_panel.[actual name of my alarm] name: SIMPLISAFE`

What version of Home Assistant Core has the issue?

core-2024.8.2

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

SimpliSafe

Link to integration documentation on our website

https://www.home-assistant.io/integrations/simplisafe

Diagnostics information

config_entry-simplisafe-7a2809cbbdd4509155d46bcd4d4fd650.json

Example YAML snippet

states:
  - arm_home
  - arm_away
type: alarm-panel
entity: alarm_control_panel.[actual name of my alarm]
name: SIMPLISAFE

Anything in the logs that might be useful for us?

No response

Additional information

No response

veedubb65 avatar Aug 18 '24 05:08 veedubb65

Hey there @bachya, mind taking a look at this issue as it has been labeled with an integration (simplisafe) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of simplisafe can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign simplisafe Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


simplisafe documentation simplisafe source (message by IssueLinks)

home-assistant[bot] avatar Aug 18 '24 05:08 home-assistant[bot]

It appears that the keypad is a symptom of the issue, but not the core issue.

When I create a button which calls alarm_control_panel.alarm_disarm, it will disarm the alarm with no code, just as the alarm card does. This should not function without adding the security code to the button's yaml.

You can also insert a correct or incorrect code, and it will still work. It looks like the integration is simply ignoring the code entirely.

I've been able to work around this by removing all alarm cards from my interface and building a completely custom alarm card that opens as a browser_mod popup and doesn't use the built-in alarm card or code. This has some minor advantages (like being able to specify different alarm codes for different users which match the alarm codes they use when interacting with SimpliSafe directly) but it shouldn't be necessary.

veedubb65 avatar Aug 21 '24 18:08 veedubb65

Facing this same issue, I used to have a static keypad on my dashboard, which I kinda prefer, then it turned into a pop up when trying to arm/disarm. Now, it just arms/disarms when I press the button, I have the code set under "config". Tried with core alarm and mushroom.

@veedubb65, care to share the code you have for your custom solution please?

tom0010 avatar Aug 27 '24 20:08 tom0010

@tom0010 I'd be happy to, but I'll need to clean it up a bit first. Mine is heavily customized for the HA-LCARS theme, and I need to redact some pieces also. Should be able to put it up this evening.

veedubb65 avatar Aug 27 '24 20:08 veedubb65

@tom0010 - Note - This is a workaround, not a solution. Use at your own risk. If you happen to like this, it should work with any alarm integration.

Functionality Creates a keypad card on your dashboard (or in a browser_mod popup) which uses an input_text helper and multiple scripts. The keypad includes a readout of the code you are entering which will clear if you tap the "CLEAR" button, or if you enter a correct code and tap the "DISARM" button.

If you follow the instructions, this will still work after the simplisafe integration is fixed should you decide you like it.

You could easily modify this to work for literally anything that you want a keypad for and the only thing you would need to change is the alarm_disarm_check script.

Pre-requisites

-Properly configured alarm integration -Card-Mod (HACS) -Custom Button Card (HACS)

You'll see a number of places where an entity named alarm_panel.alarm_panel is referenced. This must be changed to your alarm panel entity

  1. Set up an input_text helper named input_text.alarm_code. Be sure you set the minimum length to 0. The max length can be anything you want, but I recommend setting it to the same as the length of PIN you want to use.

  2. Set up the following script, and name it "append_number_to_code":

sequence:
  - data:
      entity_id: input_text.alarm_code
      value: "{{ states('input_text.alarm_code') | default('') ~ number }}"
    action: input_text.set_value
alias: append_number_to_code
description: ""
  1. Set up the following script, and name it "alarm_disarm_check". You will need to change the allowed codes to be whatever list of codes you want to work as PINs on your custom keypad. Also, this is almost certainly not secure. I'm fine with the risk because the venn diagram of people who could exploit this and people who would break into my house would be two non-overlapping circles. This is also the one real advantage of this method over the built-in alarm panel: you can have as many codes for people to use on the panel as you want. PLEASE NOTE: These are not the PINs you have set up with simplisafe, or the PIN you set in the integration. These are the PINs that will be entered on the keypad on your dashboard. If you use the same PIN for all three, that is your business. You will also need to replace "1111" a few lines further down with whatever code you set in your alarm integration. You won't ever use this code, but having it here will make sure this keeps working after they fix the broken integration.
sequence:
  - choose:
      - conditions:
          - condition: template
            value_template: |
              {% set alarm_code = states('input_text.alarm_code') %}
              {% set allowed_codes = [
                "1234", 
                "2345",
                "3456"
              ] %}
              {{ alarm_code in allowed_codes }}
        sequence:
          - target:
              entity_id: alarm_control_panel.alarm_control_panel
            action: alarm_control_panel.alarm_disarm
            data:
              code: "1111"
          - data:
              entity_id: input_text.alarm_code
              value: ""
            action: input_text.set_value
alias: alarm_disarm_check
description: ""
  1. The last step is to add the card to your dashboard. There are still some probably unnecessary customizations, including button color, button text color, and fixed size for the buttons. The fixed size is based on where I'm using it. You can also easily paste this code in the "content:" of a browser_mod popup if you're so inclined. If you go that route, you'll want to add another action to the alarm_disarm_check script that closes the popup after sending the disarm command.
type: custom:mod-card
style: |
  ha-card {
    margin: auto;
    width: fit-content;
    max-width: 350px;
  }
card:
  type: vertical-stack
  cards:
    - type: vertical-stack
      cards:
        - type: entities
          entities:
            - entity: input_text.alarm_code
          card_mod:
            style: |
              ha-card {
                width: 320px;
              }
    - type: horizontal-stack
      cards:
        - type: custom:button-card
          name: '1'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '1'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '2'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '2'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '3'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '3'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
    - type: horizontal-stack
      cards:
        - type: custom:button-card
          name: '4'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '4'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '5'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '5'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '6'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '6'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
    - type: horizontal-stack
      cards:
        - type: custom:button-card
          name: '7'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '7'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '8'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '8'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '9'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '9'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
    - type: horizontal-stack
      cards:
        - type: custom:button-card
          name: CLEAR
          tap_action:
            action: call-service
            service: input_text.set_value
            service_data:
              entity_id: input_text.alarm_code
              value: ''
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: '0'
          tap_action:
            action: call-service
            service: script.append_number_to_code
            service_data:
              number: '0'
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px
        - type: custom:button-card
          name: DISARM
          tap_action:
            action: call-service
            service: script.alarm_disarm_check
          styles:
            card:
              - height: 40px
              - width: 100px
              - background-color: '#8B0000'
            name:
              - color: white
              - font-size: 32px

If you made it this far, you may have a couple of questions.

Why is this multiple scripts? Buttons in HA are really limited in how complex their actions can be. They can do just about anything, but really only one thing at a time. For sanity, it's just easier to have them call scripts.

Why aren't you using secrets.yaml? No idea. Wish I could. I tried everything under the sun to use pins stored in secrets.yaml instead of directly in the script, and couldn't get it to work even with ChatGPT helping. It would be more secure, but once again, I don't believe anybody who could compromise it is going to be targetting my home or my network so I consider it acceptable risk.

Couldn't you do this with regular buttons instead of using custom:button-card? Yes, but you would have less control over the size, shape, and color of the buttons. Also, the regular button cards are broken in browser_mod popups at the moment, and that's where I prefer to put this.

Okay, but how do I arm the alarm? Use a button. Add the security code if you don't want to be prompted for a PIN after the integration is fixed. Personally, I have an Arm button that arms home when tapped, arms away on a press and hold, and a Disarm button that calls a browser_mod popup with this card as the content. It looks really nice directly on the display, but screen real estate is at a premium using an 800x480 display, so a button that calls a popup works better for me.

veedubb65 avatar Aug 27 '24 22:08 veedubb65

It used to work (UI PIN), however mine isn't working either now.

I have a memory that this was noted as removed on a recent change log, but havent had the chance to research. It's still showing when I hit "configure" in the Simplisafe Integration.

...

Found it, this change happened in 2024.7, I don't fully understand why. It's noted on the update change log as a backwards incompatible change.

https://github.com/home-assistant/core/pull/118759

....

It would be great to know why it's not possible to have the same UI pin without all this extra work.

Edit - Seems to be a duplicate of - https://github.com/home-assistant/core/issues/121957

patienttruth avatar Aug 28 '24 13:08 patienttruth

...

Found it, this change happened in 2024.7, I don't fully understand why. It's noted on the update change log as a backwards incompatible change.

#118759

....

Huh... I missed that one. I guess I'll stick with my bespoke keypad interface. It's a little Rube-Goldburgian, but it gets the job done and gives more control anyway.

The code owners can do whatever they would like, but I'm not personally going to close this one out, because I view it as a bug whether it was in the change log or not.

EDIT - I say that this is still a bug because it appears to me that it was a fix to allow arming without a code. This was already possible by simply adding the code to the button, automation, or script that armed the system. Also, the built-in alarm functionality within HA, as I understand it, already supports a setting to allow arming without a PIN, but this added functionality was never added to the SimpliSafe integration. The correct fix for this bug, IMO, would be to revert the change from https://github.com/home-assistant/core/pull/118759 and implement an option to allow/disallow arming without a PIN. This would resolve both concerns while being more consistent with the rest of HA.

veedubb65 avatar Aug 28 '24 15:08 veedubb65

Even if the previous code "worked" before and it didn't actually use the real pin for simplisafe, it was a good thing to have anyway. What I mean by that is, you most likely could have used a different PIN inside of home assistant to arm/disarm, and it would still change the status. So even though this isn't checking to see if the real PIN is correct, it was a good alternative to nothing at all.

I would strongly vote to have this code added back in, but no traction on this for a while, which is not a good sign.

Also, thanks for the code @veedubb65, I see how this could work, however I'm using an NSPanel and this does not use home assistant but it uses ESPHome, therefore you can't build dashboards like you have AFAIK, at least not with the blueprint. Having that lost piece of code back, would most likely fix that for me.

@bachya, any possibility the lost code could be added back with release notes stating that it does not authenticate against Simplisafe servers, and the PIN is purely local?

tom0010 avatar Sep 11 '24 07:09 tom0010

@bachya, any possibility the lost code could be added back with release notes stating that it does not authenticate against Simplisafe servers, and the PIN is purely local?

With the previous code in place, a recent HASS change required a PIN to be provided anytime SS was armed/disarmed (even via a service call), which isn't correct.

I'm unfortunately strapped for time by my day job, so I won't be able to investigate anytime soon. If someone else wants to submit a PR, I'd be happy to review.

bachya avatar Sep 11 '24 13:09 bachya

Are you saying you would be welcome a PR to push them changes back in? Or what else would be needed for a PR, I could take a look at it if you specified more.

tom0010 avatar Sep 11 '24 14:09 tom0010

Are you saying you would be welcome a PR to push them changes back in? Or what else would be needed for a PR, I could take a look at it if you specified more.

As I mentioned, replacing the original code is not sufficient because it forces a pin to be in place for all interactions with SS, not just those through the UI. I'd be happy to review a PR that reestablishes the UI support your speaking for without that side effect.

bachya avatar Sep 11 '24 14:09 bachya

Could we not keep _attr_code_arm_required = False which you just added, and then bring back your changes with that flag set?

Trying to understand how it all works, but from what I understand _attr_code_arm_required is set to True now which will require a code for each interaction, which you mentioned already, if we set it to False, we'd bypass that? Then we can return back to your code/functionality?

tom0010 avatar Sep 11 '24 15:09 tom0010

Could we not keep _attr_code_arm_required = False which you just added, and then bring back your changes with that flag set?

Trying to understand how it all works, but from what I understand _attr_code_arm_required is set to True now which will require a code for each interaction, which you mentioned already, if we set it to False, we'd bypass that? Then we can return back to your code/functionality?

As I mentioned, I unfortunately don't have time to investigate. Recommend you try these changes in a local environment and see if they achieve the outcome you're looking for.

bachya avatar Sep 11 '24 15:09 bachya

I got this working, however there is something missing, the code now works to a point, but if you use the mushroom alarm card, it will not arm, because home assistant is expecting a code every time. Disarm does work, and it will give you the code mushroom pop up to enter, which is nice.

Using the core card, it does work, as you pass the code each time, at least in the web browser. On my NSPanel, I can disarm, but cannot arm, as it's expecting a code and the code does not pop up when trying to arm, just like mushroom.

I need to look into it a bit more, but it's all so nested.

tom0010 avatar Sep 11 '24 21:09 tom0010

Got this working and tested, raised https://github.com/home-assistant/core/pull/125823.

@bachya please review.

tom0010 avatar Sep 12 '24 11:09 tom0010

Got this working and tested, raised https://github.com/home-assistant/core/pull/125823.

@bachya please review.

Tom, you're awesome and appreciated for making this happen, even if it doesn't make it into core.

To get this to work, is it as simple as copying the single file that was changed from your PR into my HA install to replace the Simplisafe file? I've been using bandaids to secure the security system since the loss of this functionality.

I imagine it would need to be re-done every core update, do you know?

patienttruth avatar Oct 19 '24 02:10 patienttruth

That’s correct, replace the file and then reboot HA. You would need to do this every time you upgrade HA. If using docker, I’d probably mount the file so it would overwrite it.

In case everyone is not aware, it doesn’t look like the PR is going to be accepted, due to it not using native functionality from SimpliSafe. I tend to disagree, because as much as this is not securing the system totally unless you know where to look. It gives any user with access to your alarm panel a passcode that they have to enter, ergo, making it more secure that the current functionality.

tom0010 avatar Oct 19 '24 08:10 tom0010

That’s correct, replace the file and then reboot HA. You would need to do this every time you upgrade HA. If using docker, I’d probably mount the file so it would overwrite it.

In case everyone is not aware, it doesn’t look like the PR is going to be accepted, due to it not using native functionality from SimpliSafe. I tend to disagree, because as much as this is not securing the system totally unless you know where to look. It gives any user with access to your alarm panel a passcode that they have to enter, ergo, making it more secure that the current functionality.

which file needs to be replaced exactly? I do not see anything under my custom_components folder related to simplisafe, been banging my head trying to understand why i can't find anything related to simplisafe for well over an hour

i have root access and looking via home assistant terminal, if it's part of core can you provide any assistant?

tried removing and readding the integration as well

I just want to have it so a keypad is shown when trying to disarm via home assistant so I can at this to my wall based tablet... very frustrating :( no matter what I have tried it just always disarms without asking for a code no matter what which makes having access to it via a tablet next to my door a terrible idea security wise, thanks

jonhaber82 avatar Nov 05 '24 08:11 jonhaber82

which file needs to be replaced exactly? I do not see anything under my custom_components folder related to simplisafe, been banging my head trying to understand why i can't find anything related to simplisafe for well over an hour

i have root access and looking via home assistant terminal, if it's part of core can you provide any assistant?

tried removing and readding the integration as well

I just want to have it so a keypad is shown when trying to disarm via home assistant so I can at this to my wall based tablet... very frustrating :( no matter what I have tried it just always disarms without asking for a code no matter what which makes having access to it via a tablet next to my door a terrible idea security wise, thanks

You'll need to have docker access from within homeassistant, then you need to exec into the docker container of homeassistant:

docker exec -ti homeassistant bash

You can then find the files under: /usr/src/homeassistant/homeassistant/components/simplisafe

And I totally agree with you, this is certainly suboptimal, it would be good if you could express your concerns on the PR maybe?

tom0010 avatar Nov 05 '24 09:11 tom0010

which file needs to be replaced exactly? I do not see anything under my custom_components folder related to simplisafe, been banging my head trying to understand why i can't find anything related to simplisafe for well over an hour i have root access and looking via home assistant terminal, if it's part of core can you provide any assistant? tried removing and readding the integration as well I just want to have it so a keypad is shown when trying to disarm via home assistant so I can at this to my wall based tablet... very frustrating :( no matter what I have tried it just always disarms without asking for a code no matter what which makes having access to it via a tablet next to my door a terrible idea security wise, thanks

You'll need to have docker access from within homeassistant, then you need to exec into the docker container of homeassistant:

docker exec -ti homeassistant bash

You can then find the files under: /usr/src/homeassistant/homeassistant/components/simplisafe

And I totally agree with you, this is certainly suboptimal, it would be good if you could express your concerns on the PR maybe?

thanks for the help, I was finally was able to copy over the file 'alarm_control_panel.py' but getting the following issue (seems to kill the integration currently) ...

home-assistant_simplisafe_2024-11-05T19-05-55.650Z.log

attaching log file, thanks

jonhaber82 avatar Nov 06 '24 01:11 jonhaber82

That’s correct, replace the file and then reboot HA. You would need to do this every time you upgrade HA. If using docker, I’d probably mount the file so it would overwrite it.

Are you still able to use your changes with recent updates? I just went through updating alarm_control_panel.py and it the integration doesn't work. I'm thinking maybe something changed.

patienttruth avatar Nov 10 '24 06:11 patienttruth

@veedubb65

Thanks for the work around.

Do you know how the code you provided could be updated so that if a user taps the text field that nothing happens? i.e. on a tablet it will not launch the keyboard if tapped

and

How the text box can be initialized as blank until used and if cleared it goes back to blank or something like "Enter code"

thanks!!

Screenshot 2024-11-20 at 9 47 10 PM

jonhaber82 avatar Nov 21 '24 05:11 jonhaber82

That’s correct, replace the file and then reboot HA. You would need to do this every time you upgrade HA. If using docker, I’d probably mount the file so it would overwrite it.

Are you still able to use your changes with recent updates? I just went through updating alarm_control_panel.py and it the integration doesn't work. I'm thinking maybe something changed.

I've updated my changes to reflect the latest code from HA. Seems there were some changes upstream.

tom0010 avatar Nov 22 '24 10:11 tom0010

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.