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

Cannot arm alarm with version 0.29 when no code is required for arming #142

Closed
raducotescu opened this issue Sep 22, 2022 · 9 comments
Closed

Comments

@raducotescu
Copy link
Contributor

raducotescu commented Sep 22, 2022

My alarm is configured in unsplit mode and doesn’t require a code for arming. When trying to arm it, I see the following in the logs:

2022-09-22 08:32:20.789 DEBUG (MainThread) [custom_components.jablotron80] Adding command Command name=key sequence *HIDDEN*
2022-09-22 08:32:34.873 DEBUG (MainThread) [custom_components.jablotron80] Message of type State received ed 40 00 00 01 00 00 1e 46 ff
2022-09-22 08:32:34.873 DEBUG (MainThread) [custom_components.jablotron80] JablotronLed function call active
2022-09-22 08:32:34.874 DEBUG (MainThread) [custom_components.jablotron80] JablotronLed function call active
2022-09-22 08:32:34.874 DEBUG (MainThread) [custom_components.jablotron80] JablotronLed function call active
2022-09-22 08:32:34.874 DEBUG (MainThread) [custom_components.jablotron80] JablotronLed function call active
2022-09-22 08:32:34.874 DEBUG (MainThread) [custom_components.jablotron80] JablotronLed function call active
2022-09-22 08:32:34.874 DEBUG (MainThread) [custom_components.jablotron80] JablotronAlert function call value
2022-09-22 08:32:34.875 DEBUG (MainThread) [custom_components.jablotron80] JablotronSensor function call value
2022-09-22 08:32:34.875 DEBUG (MainThread) [custom_components.jablotron80] JablotronSensor(1): value changed from 0.0 to 75.0
2022-09-22 08:32:34.877 DEBUG (MainThread) [custom_components.jablotron80] publishing updates
2022-09-22 08:32:34.877 DEBUG (MainThread) [custom_components.jablotron80] Zone A action disarm
2022-09-22 08:32:34.878 DEBUG (MainThread) [custom_components.jablotron80] Zone B action disarm
2022-09-22 08:32:34.878 DEBUG (MainThread) [custom_components.jablotron80] Zone C action disarm

What is wrong? I kept looking through the code and didn’t see anything obvious.

Moreover, I tried to reconfigure the control panel and the integration to require a code before arming. The result is the same.

@mattsaxon
Copy link
Collaborator

My system is setup same as yours and works as expected.

I suspect that what has happened for you is that there was a comms issue during initial setup and your system thinks it is in partial or split mode.

To check this, you'd need to edit the setup file, but I can't recall where this is at the moment and am away so cannot check. Perhaps someone else can point you in the right direction until I can verify?

@raducotescu
Copy link
Contributor Author

Matt, by system you mean the HA integration or the actual control panel? O-Link shows that the system is configured in unsplit mode.

@mattsaxon
Copy link
Collaborator

I'm referring to the HA integration

@raducotescu
Copy link
Contributor Author

Here's what I see in .storage/core.config_entries:

{
        "entry_id": "7fb1f51ccda4a2d3106b9ab85579ef5f",
        "version": 1,
        "domain": "jablotron80",
        "title": "Jablotron 80",
        "data": {
          "cable_model": "JA_82T",
          "serial_port": "/dev/hidraw0",
          "password": "<redacted>",
          "number_of_wired_devices": 4,
          "settings": {
            "device_require_code_to_arm": false,
            "device_system_mode": "Unsplit"
          }
}

@mattsaxon
Copy link
Collaborator

There's another file with setting derives during initial config. this is where all the sensors are stored. It has additional info in it.

@raducotescu raducotescu changed the title Cannot arm alarm with version 0.29 Cannot arm alarm with version 0.29 when no code is required for arming Sep 22, 2022
@raducotescu
Copy link
Contributor Author

Matt, I found the bug:

async def async_alarm_arm_away(self, code=None) -> None:
if not self._cu.is_code_required_for_arm():
code = ""
elif not self.code_arm_required :
code = self._cu._master_code
if code == None:
return
if self._cu.mode == JA80CentralUnit.SYSTEM_MODE_UNSPLIT:
# just one zone so input code without any "kinks"
self._cu.arm(code)
elif self._cu.mode in [JA80CentralUnit.SYSTEM_MODE_PARTIAL,JA80CentralUnit.SYSTEM_MODE_SPLIT]:
self._cu.arm(code,"C")

If no code is required, the code will be the empty string. In unsplit mode the arm function will then be called only with an empty string and the prefix you hardcoded:

def arm(self,code: str,zone:str=None) -> None:
if zone is None:
self.send_keypress_sequence(code, b'\xa1')
else:
self.send_keypress_sequence({"A":"*2","B":"*3","C":"*1"}[zone]+code, b'\xa1')

The correct solution, according to the Jablotron Control Panel manual as well is to:

  • Press key ABC, A or B
  • Enter a code (or present a card)
  • If the system is partially set (section A is set), and you wish to extend the proportion of the system which is set, press the B or ABC key.

I locally changed the code to send the "C" zone (which is the equivalent of the ABC button, that in my case is the only one that arms the system) when the system is configured in unsplit mode and the code is not required and it worked. Should I send the PR for the alarm_control_panel.py file?

@mattsaxon
Copy link
Collaborator

Yes please submit a PR so I can see what you intend.... but I'm not yet convinced there is a bug given mine and your systems seem to be configured the same.

There are 2 similar, but different setting regarding does the control panel need a code and do you want a code entered in HA.

..... it could well be me who is confused on this though ;-)

raducotescu added a commit to raducotescu/jablotron80 that referenced this issue Sep 22, 2022
…required for arming

* when the JA-82K control panel doesn't required a code for arming and
the panel is configured in unsplit mode the arming must be done by
simulating a keypad press on the ABC button; sending an empty code
has no effect
@raducotescu
Copy link
Contributor Author

raducotescu commented Sep 22, 2022

There are 2 similar, but different setting regarding does the control panel need a code and do you want a code entered in HA.

Those two are currently in sync when the component is set up and the code doesn't seem to adapt if the user changes the component's configuration. If the control panel doesn't require a code, the value configured in HA is overridden with the empty string. I haven't changed that behaviour in the PR, but I see that there's already an issue that could address this - #43.

@raducotescu
Copy link
Contributor Author

PR is at #143 (don't know why it didn't get linked here).

tahvane1 added a commit that referenced this issue Oct 6, 2022
fix #142: Cannot arm alarm with version 0.29 when no code is required for arming
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants