Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue Setting alarm with code in configuration.yaml #118668

Closed
esk1 opened this issue Jun 3, 2024 · 54 comments · Fixed by #119212
Closed

Issue Setting alarm with code in configuration.yaml #118668

esk1 opened this issue Jun 3, 2024 · 54 comments · Fixed by #119212

Comments

@esk1
Copy link

esk1 commented Jun 3, 2024

The problem

Since the Most recent RC (confirmed to not be an issue on stable) update when I try to alarm my code using the envisalink configuration I get the following error:

Failed to call service alarm_control_panel/alarm_arm_home. Validation error: Arming requires a code but none was given for alarm_control_panel.home_alarm
However the code is in my configuration just like the example Envisalink - Home Assistant

If I take the code out of the configuration I get the alarm pad in the GUI which allows me to type in the code. Typing in the exact code as in the configuration item previously does properly set the alarm.

I think something got messed up when using a preconfigured alarm code in your configuration but not exactly sure.

Here is my configuration:

host: !secret envisalink_ip
panel_type: DSC
user_name: !secret envisalink_user
password: !secret envisalink_password
code: !secret alarm_code
port: 4025
evl_version: 4
keepalive_interval: 60
zonedump_interval: 30

I'm wonder if it stems from this and the components not being updated: 6b7ff2b

What version of Home Assistant Core has the issue?

2024.6

What was the last working version of Home Assistant Core?

core-2024.5.5

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Envisalink

Link to integration documentation on our website

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

Diagnostics information

https://community.home-assistant.io/t/issue-arming-alarm-since-most-recent-update-with-envisalink/735096

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Failed to call service alarm_control_panel/alarm_arm_home. Validation error: Arming requires a code but none was given for alarm_control_panel.home_alarm

Additional information

Possibly related to this? 6b7ff2b

@home-assistant
Copy link

home-assistant bot commented Jun 3, 2024

@dmkjr
Copy link

dmkjr commented Jun 3, 2024

Same problem. Using MQTT to control my Ring alarm. Same error.

@dmkjr
Copy link

dmkjr commented Jun 4, 2024

@esk1 I don't see anything in the latest beta that addresses this. Did confirm it's a broader issue with alarm's in general and not linked to a specific setup.

@Chewbucka
Copy link

Chewbucka commented Jun 4, 2024

There is a boolean that needs to be set in the integration called "code_arm_required". It would be nice if this was exposed in the configuration.yaml so we could change it as desired.

I would think that by defualt it should be set to false if there is a code configured in the configuration.yaml or true if there is no code. Currently, this defaults to true if it's not set in the integration which causes the issue.

https://developers.home-assistant.io/blog/2024/05/22/alarm_control_panel_validation/

I had to remove my code from the configuration to get this working again.

What would also be nice is if there was a code_disarm_required option. I don't mind arming the system without a code in the GUI, but when disarming, it should prompt for a code if desired. This is how my panel currently works.

Without a code in the configuration, I can get close to this behavior

@dkornahrens
Copy link

There is a boolean that needs to be set in the integration called "code_arm_required". It would be nice if this was exposed in the confiruation.yaml so we could change it as desired.

I would think that by defualt it should be set to false if there is a code configured in the configuration.yaml or true if there is no code. Currently, this defaults to true if it's not set in the integration which causes the issue.

https://developers.home-assistant.io/blog/2024/05/22/alarm_control_panel_validation/

I had to remove my code from the configuration to get this working again.

What would also be nice is if there was a code_disarm_required option. I don't mind arming the system without a code in the GUI, but when disarming, it should prompt for a code if desired. This is how my panel currently works.

Without a code in the configuration, I can get close to this behavior

This was great info! I put a code in and it worked. I tried to do the configuration.yaml with the custom integration piece and it appears to not have taken when doing it manually.

@Chewbucka
Copy link

This was great info! I put a code in and it worked. I tried to do the configuration.yaml with the custom integration piece and it appears to not have taken when doing it manually.

Currently, you can't put in "code_arm_required" in the configuration.yaml under the envisalink section. If you do, it breaks the integration after a restart. This will require a change in the integration to support the option.

When this option is supported in the configuration.yaml, the envisalink integration should set the "code_arm_required" to true (even if it's set to false) if there is no code entered. This will prevent a situation where no code is specified and no code is required in the UI which won't work correctly.

@kj4dxk
Copy link

kj4dxk commented Jun 6, 2024

I am having this issue with envisalink, caused by the latest ha update. I am not clear, what is the fix? My ui is just arm buttons, no keypad, how can I give a code? Does it go in the yaml? Where?

@kj4dxk
Copy link

kj4dxk commented Jun 6, 2024

There is a boolean that needs to be set in the integration called "code_arm_required". It would be nice if this was exposed in the confiruation.yaml so we could change it as desired.
I would think that by defualt it should be set to false if there is a code configured in the configuration.yaml or true if there is no code. Currently, this defaults to true if it's not set in the integration which causes the issue.
https://developers.home-assistant.io/blog/2024/05/22/alarm_control_panel_validation/
I had to remove my code from the configuration to get this working again.
What would also be nice is if there was a code_disarm_required option. I don't mind arming the system without a code in the GUI, but when disarming, it should prompt for a code if desired. This is how my panel currently works.
Without a code in the configuration, I can get close to this behavior

This was great info! I put a code in and it worked. I tried to do the configuration.yaml with the custom integration piece and it appears to not have taken when doing it manually.

Where did you give the code?

@Chewbucka
Copy link

Chewbucka commented Jun 6, 2024

Remove the entire code: line (or comment it out)
from your configuration.yaml under the envisalink section and restart home assistant. Now, when you click on any of the arm buttons, a keypad will popup.
Screenshot_20240605_195757_Home Assistant
Screenshot_20240605_195815_Home Assistant
Once armed and you press the disarm button, a keypad will pop up. Likewise, if the alarm is tripped, you press disarm and enter your code.

If you're arming or disarming the alarm as part of any action in an automation or script, there will be a code checkbox. Check the box and enter your code, otherwise, the actions/script will fail to run.
Screenshot_20240605_195617_Home Assistant
Once the "code_arm_required" option is added to the integration and is set to false, then you should be able to put the code back in the configuration and the functionality should return to what it was before.

@kj4dxk
Copy link

kj4dxk commented Jun 6, 2024

image

This worked, thank you. I get this view, though, not a pop up. It works. Enter code, press button, alarm sets or unsets.

@cheekoo
Copy link

cheekoo commented Jun 6, 2024

Just another data point, I had same issue after upgrading to core 2024.6.0. Fixed after rolling back core to 5.5.

@yzzaJ
Copy link

yzzaJ commented Jun 6, 2024

Similar experience here. Disarm was not requiring an alarm code, but arm does, so needed to remove the alarm code from config to get the keypad up, which then means needing to put the code in for disarm also. Personally I preferred the previous behaviour. Hopefully it can be changed such that we get the choice as to whether we need to put a alarm code in manually, or have the alarm code in the configuration and not need to enter it (previous behaviour). Bonus points if we could choose different behaviours for arm and disarm.

@MJWMJW2
Copy link

MJWMJW2 commented Jun 6, 2024

Stumbled across this thread as I have this issue but with a totally different alarm. Looks like an update

A default code can now be set in the entity settings for every alarm control panel entities. Nice work [@gjohansson-ST](https://github.com/gjohansson-ST)!

I don't have the option to set "code_arm_required"

Found how to solve this when no code is normally needed, go to your alarm control panel entity and enter any code, update and done. Mine at least now works again.

image

@yzzaJ
Copy link

yzzaJ commented Jun 6, 2024

I'm using the Envisalink integration, but that can't be added/configured via GUI (not that I can find), and so it is configured via configuration.yaml. Having the code in configuration.yaml used to work.

@leotantantan
Copy link

Stumbled across this thread as I have this issue but with a totally different alarm. Looks like an update

A default code can now be set in the entity settings for every alarm control panel entities. Nice work [@gjohansson-ST](https://github.com/gjohansson-ST)!

I don't have the option to set "code_arm_required"

Found how to solve this when no code is normally needed, go to your alarm control panel entity and enter any code, update and done. Mine at least now works again.

image

This works for me.

@andornaut
Copy link

Here's a temporary workaround.

  1. Specify an alarm code in your configuration.yaml as in the original post, eg.: code: !secret alarm_code
  2. Add _attr_code_arm_required = False on line 106 of alarm_control_panel.py#L106

eg.

class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
    """Representation of an Envisalink-based alarm panel."""
    _attr_code_arm_required = False

On the homeassistant Docker image, that Python module is located at /usr/src/homeassistant//homeassistant/components/envisalink/alarm_control_panel.py

Once a proper fix is released, you can go ahead and revert the above.

@nanitox
Copy link

nanitox commented Jun 7, 2024

Here's a temporary workaround.

  1. Specify an alarm code in your configuration.yaml as in the original post, eg.: code: !secret alarm_code
  2. Add _attr_code_arm_required = False on line 106 of alarm_control_panel.py#L106

eg.

class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
    """Representation of an Envisalink-based alarm panel."""
    _attr_code_arm_required = False

On the homeassistant Docker image, that Python module is located at /usr/src/homeassistant//homeassistant/components/envisalink/alarm_control_panel.py

Once a proper fix is released, you can go ahead and revert the above.

Thanks! Like a charm

@dobbsrx
Copy link

dobbsrx commented Jun 7, 2024

Just another data point, I had same issue after upgrading to core 2024.6.0. Fixed after rolling back core to 5.5.

Just wanted to add my confirmation that a roll back to 2024.5.5 fixed integration for me as well

@tsightler
Copy link

tsightler commented Jun 7, 2024

The simple issue is that the MQTT Alarm integration defaults to code_arm_required = true even if no code is set at all. This really makes no sense to me, especially since disarm still works without a code.

MQTT docs for alarm control panel say:

code string (optional)
code_arm_required boolean (optional, default: true)
code_disarm_required boolean (optional, default: true)

So while docs say these are all "optional" if you actually set none of these, arming will not work unless automation includes a code (the actual code does matter) and arming via UI flat doesn't work at all. For some reason though, disarming does still work, I'm guessing it might be explicitly set to false if no code is defined. I believe that code_arm_required/code_disarm_required should default to false of no code is provided, because this setup can never work.

Of course, it can be fixed on MQTT alarm provider side by explicitly including code_arm_required = false when there is no code, but the default behavior which has worked for 5 years as all of these options were optional, is now broken.

@ayo10
Copy link

ayo10 commented Jun 7, 2024

Just wanted to add that the issue exists also for integrations added via HomeKit. I control Abode using their HomeKit integration, which doesn’t require a code to arm/disarm. Forcibly setting code_arm_required to true without a global way of turning it off broke this in HomeAssistant. I had to revert to 2024.5 (2024.6 is apparently a full fledged release and not RC).

@hamsando
Copy link

hamsando commented Jun 7, 2024

Looks 2024.6.1 fixed it for a bunch of panels, but not envisalink.

@Chewbucka
Copy link

What I would like to happen for the envisalink integration is the following:

Expose the following in the yaml which default to true.

code_arm_required: true
code_disarm_required: true

If code is not present, then override the above two booleans to true even if they are set to false since that configuration wouldn't work.

If code is present, then allow either or both of the below to be set to false:

code_arm_required
code_disarm_required

For my use case and to simulate my actual DSC panel, I would set the following:

code: xxxxxx
code_arm_required: false
code_disarm_required: true

This way, I can arm the system without entering a code in the GUI, but always require a code to disarm. Any automations that arm the system wouldn't need a code entered, but to disarm would require a code entered.

@skywurz
Copy link

skywurz commented Jun 7, 2024

Checking in 2024.6.1

Same issues as everyone else. Can't arm control panel complains about code.
Tried adding
code: xxxxxx
code_arm_required: false
code_disarm_required: false
To my alarm control panel manual platform in my config.yaml per https://www.home-assistant.io/integrations/manual/#code_arm_required

Config just errors .

Reverting changes and back to 2024.5.5

@murphysprings
Copy link

@gjohansson-ST want to let you know that the Envisalink panel still has the bug. This was not fixed in 118961

nidble added a commit to nidble/minim_alarm that referenced this issue Jun 8, 2024
@foxsky
Copy link

foxsky commented Jun 8, 2024

Here's a temporary workaround.

  1. Specify an alarm code in your configuration.yaml as in the original post, eg.: code: !secret alarm_code
  2. Add _attr_code_arm_required = False on line 106 of alarm_control_panel.py#L106

eg.

class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
    """Representation of an Envisalink-based alarm panel."""
    _attr_code_arm_required = False

On the homeassistant Docker image, that Python module is located at /usr/src/homeassistant//homeassistant/components/envisalink/alarm_control_panel.py
Once a proper fix is released, you can go ahead and revert the above.

Thanks! Like a charm

Working here!

@jonpaterson
Copy link

Stumbled across this thread as I have this issue but with a totally different alarm. Looks like an update

A default code can now be set in the entity settings for every alarm control panel entities. Nice work [@gjohansson-ST](https://github.com/gjohansson-ST)!

I don't have the option to set "code_arm_required"

Found how to solve this when no code is normally needed, go to your alarm control panel entity and enter any code, update and done. Mine at least now works again.

image

@MJWMJW2 how were you able to edit the entity? for me I cannot edit the entity as the Envisalink integration does not generate unique IDs (I receive the error "this entity does not have a unique ID, therefore settings cannot be managed from the UI"). Thanks!

@BluThunder2k
Copy link

I'd prefer the older behavior. Only need to press arm to do so, but require the code to disarm.

@dsager
Copy link

dsager commented Jun 9, 2024

I have the same problem with the virtual alarm panel that comes with HA.
FYI @gjohansson-ST- I think this wasn't fixed by #118961 either...

@gjohansson-ST
Copy link
Member

I have no idea what you mean by virtual alarm panel. Which integration are you referring too?

@dsager
Copy link

dsager commented Jun 9, 2024

Sorry for not being clear. I use the manual platform to have a "virtual alarm" system in home assistant without any physical alarm device. I don't use a code and there is none specified in my configuration yml.

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

This stopped working after upgrading from 5.5 to 6.1.
Neither the Lovelace card works, nor existing automations - both say it's missing the code.

@Lost-Ones
Copy link

Sorry for not being clear. I use the manual platform to have a "virtual alarm" system in home assistant without any physical alarm device. I don't use a code and there is none specified in my configuration yml.

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

This stopped working after upgrading from 5.5 to 6.1. Neither the Lovelace card works, nor existing automations - both say it's missing the code.

Try to comment out"

#code: xxxxxx
#code_arm_required: false
#code_disarm_required: false

Then I would hope that the 'virtual' keypad would show and you can enter the code into the automation as well

@Chewbucka
Copy link

Does "Fix envisalink alarm #119212" expose the following in the configuration.yaml file?

code_arm_required:
code_disarm_required:

so we can set these to false or true, if desired?

@MrSiO
Copy link

MrSiO commented Jun 9, 2024

Here's a temporary workaround.

  1. Specify an alarm code in your configuration.yaml as in the original post, eg.: code: !secret alarm_code
  2. Add _attr_code_arm_required = False on line 106 of alarm_control_panel.py#L106

eg.

class EnvisalinkAlarm(EnvisalinkDevice, AlarmControlPanelEntity):
    """Representation of an Envisalink-based alarm panel."""
    _attr_code_arm_required = False

On the homeassistant Docker image, that Python module is located at /usr/src/homeassistant//homeassistant/components/envisalink/alarm_control_panel.py
Once a proper fix is released, you can go ahead and revert the above.

Thanks! Like a charm

Hi.
Fix worked but the added line disapeared on the last HA update unfortunately...

Any permanent fix yet?

@MrSiO
Copy link

MrSiO commented Jun 9, 2024

  1. alarm_control_panel.py#L106

Does anyone know how to get to this .py file when running HAOS on a NUC? /usr/src does not exist and I've yet to find anything else definitively that shows me how to get to the components folder to make this change.

My envisalink stopped working correctly after upgrading from 5.5 to 6.1, and it appears I've run into this same issue.

Easy way: Use PORTAINER.
On your container hit the : "Exec Console" option on your container.

Note: This fix does not seem to be permanent. At the latest HA update the added line was removed, thus back with the issue.

@dsager
Copy link

dsager commented Jun 10, 2024

https://www.home-assistant.io/integrations/manual
This stopped working after upgrading from 5.5 to 6.1. Neither the Lovelace card works, nor existing automations - both say it's missing the code.

Try to comment out"

#code: xxxxxx
#code_arm_required: false
#code_disarm_required: false

Then I would hope that the 'virtual' keypad would show and you can enter the code into the automation as well

Thank you, this works somewhat:

  • code_disarm_required isn't a supported option
  • setting a code and code_arm_required: false let's me arm and automations work again
  • but, i now need the code to disarm

While it's a work around and I can provide the code in my automations, I think it's still a regression as the previous behavior of not using any code no longer works.

Thanks again!

@IoTPlay
Copy link

IoTPlay commented Jun 10, 2024

Also waiting for a solution - not working - MG5050 / matt - also changes since latest update.

@madsci1016
Copy link

Can confirm. Still broken in 2024.6.1, this issue should be re-opened.

@rtorchia
Copy link

Seems that 2024.6.2 fixes the issue, but how do we get back the original functionality (arming/disarming code used from yaml config) without having to go and edit all my automations to enter an arm/disarm code?

@andornaut
Copy link

andornaut commented Jun 11, 2024

Seems that 2024.6.2 fixes the issue, but how do we get back the original functionality (arming/disarming code used from yaml config) without having to go and edit all my automations to enter an arm/disarm code?

@rtorchia can you please check to see if you actually need to enter the code? It works for me without specifying a code.


In 2024.6.2, I can arm and disarm without specifying a code via the keypad (it uses the code from configuration.yaml), but it still displays the keypad even though it's not needed.

(Also, note that the workaround I posted above no longer works - the keypad is still visible)

@Chewbucka
Copy link

Chewbucka commented Jun 11, 2024 via email

@madsci1016
Copy link

2024.6.2 has fixed my automations without editing, so my code in the config.yaml is read and used again.

However the Alarm panel Card on my dashboard is now showing the numeric keypad when it shouldn't; so that is technically still a bug.

@ziptbm
Copy link

ziptbm commented Jun 11, 2024

I unhashed the code line from my configuration.yaml and installed 2024.6.2, rebooted, but I'm still prompted for the code when arming the system from HA.

My Homekit connection appears to function now without having to enter a code, but if I open the alarm_control_panel.home_alarm entity within Home Assistant, I am forced to enter a code for arming the system now.

Also, my Alarm panel Card also now shows the numeric keypad and it didn't before when I had the code line in the configuration.yaml.

Is there something else I need to do to get this back to the pre-2024.6.0 behavior?

UPDATE - so I noticed different behavior for the keypad depending on where I arm the system.

  1. The Alarm Panel Card now shows the numeric keypad (didn't before), but no longer requires me to enter the code for arming Home or Away.
  2. However, the actual entity from the screenshot below DOES require the code to arm the system for Home or Away.
Screenshot 2024-06-11 at 15 47 35

@ndoggac
Copy link

ndoggac commented Jun 11, 2024

Post update:
"code_arm_required: false" is not recognized as a configuration item.

With no new options in my config, which still contains the "code: xxxx" config option, I can disable without a code, but need a code to arm the system. This seems like the exact opposite of desired behavior.

The best option would be to have both configurable options, to get back to the behavior (if desired) prior to the update:
#code_arm_required: false
#code_disarm_required: false

and maybe...
#display_keypad: false

@rfetech
Copy link

rfetech commented Jun 11, 2024

Envisalink Integration
Envisalink 4 Module
DSC-1864 Alarm Panel

After installing 2024.6.2, I can again ARM and DISARM my panel without manually entering the security code. The keypad, however, is still showing on the Alarm Panel Card with no options, that I can find, to disable it. The pre-2024.6.0 card that I have been using for several years is definitely my preferred way to control my system. My mobile device is an iPhone 12 Mini and the 3 keypads for my partitions take up a lot of real estate. Thanks!

@andornaut
Copy link

I opened a new ticket #119443 for the bug in 2024.6.2

@tivo65
Copy link

tivo65 commented Jun 12, 2024

I opened a new ticket #119443 for the bug in 2024.6.2

Thank you.

@rfetech
Copy link

rfetech commented Jun 12, 2024

@andornaut

Thank you for all you do!

@SpectrumTech

This comment was marked as off-topic.

@bruno-walter
Copy link

Arming without a code is broken if you don't put the code in YAML. I've never had the code in YAML and always armed without using a code, but now I need to enter a code to arm.

@github-actions github-actions bot locked and limited conversation to collaborators Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.