gazoscalvertos / Hass-Custom-Alarm

Yet another take on a home assistant custom alarm
221 stars 94 forks source link

088.1 Any code works to disarm #74

Closed djtommye closed 5 years ago

djtommye commented 5 years ago

In my installation, I can disarm the system with any code. It doesn't matter the number of digits, etc.

Steps to reproduce the behavior:

  1. Arm the alarm
  2. Allow it to arm completely
  3. Enter any code
  4. It will disarm

I'd expect it to give me an error if the code wasn't valid

djtommye commented 5 years ago

I just updated Hass-Custom-Alarm to the latest, rebooted, and I'm still having the issue.

djtommye commented 5 years ago

I'm also seeing these two warnings:

2019-02-26 21:37:36 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to alarm_control_panel.alarm_disarm to be instead: entity_id: all 2019-02-26 21:39:18 WARNING (SyncWorker_7) [homeassistant.loader] Integrations need to be in their own folder. Change alarm_control_panel/bwalarm.py to bwalarm/alarm_control_panel.py. This will stop working soon.

akasma74 commented 5 years ago

Regarding your warnings: the solutions are there and there

akasma74 commented 5 years ago

And I cannot reproduce the bug on 0.88.1 I'd suggest to change bwalarm's log level to debug and post the log when you are able to disarm with any code here.

RowdyDog12 commented 5 years ago

I can confirm that this bug does work in 0.88.1.

djtommye commented 5 years ago

How and where do I set it to debug?

From: akasma74 notifications@github.com Sent: Wednesday, February 27, 2019 10:08 AM To: gazoscalvertos/Hass-Custom-Alarm Hass-Custom-Alarm@noreply.github.com Cc: djtommye tommy@tommyandcindy.com; Author author@noreply.github.com Subject: Re: [gazoscalvertos/Hass-Custom-Alarm] 088.1 Any code works to disarm (#74)

And I cannot reproduce the bug on 0.88.1 I'd suggest to change bwalarm's log level to debug and post the log when you are able to disarm with any code here.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gazoscalvertos/Hass-Custom-Alarm/issues/74#issuecomment-467922747 , or mute the thread https://github.com/notifications/unsubscribe-auth/AXvBQUYKxgnZ4sb7KKHDLSrNuDvv4d2Tks5vRq1JgaJpZM4bTgCA . https://github.com/notifications/beacon/AXvBQVO1nPjX8g3e8WTQ8de8m6z4XIo4ks5vRq1JgaJpZM4bTgCA.gif

djtommye commented 5 years ago

Okay - I figured out setting the debug. Here's what I'm getting. BTW - I did change both references in alarm.html from entityId to entity_id, and seem to still be getting a warning (attached). Here's the log contents. The ERROR occurs when disarming. (I armed / disarmed twice).


2019-02-27 23:11:27 WARNING (MainThread) [homeassistant.loader] You are using a custom component for bwalarm.alarm_control_panel which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.
2019-02-27 23:15:58 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to alarm_control_panel.alarm_arm_home to be instead: entity_id: all
2019-02-27 23:16:44 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to alarm_control_panel.alarm_disarm to be instead: entity_id: all
2019-02-27 23:16:45 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 289, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/konnected/switch.py", line 84, in turn_off
    resp = self.client.put_device(
AttributeError: 'NoneType' object has no attribute 'put_device'
2019-02-27 23:17:05 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to alarm_control_panel.alarm_arm_home to be instead: entity_id: all
2019-02-27 23:17:39 WARNING (MainThread) [homeassistant.helpers.service] Not passing an entity ID to a service to target all entities is deprecated. Update your call to alarm_control_panel.alarm_disarm to be instead: entity_id: all
2019-02-27 23:17:39 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 289, in _handle_service_platform_call
    await getattr(entity, func)(**data)
[alarm.zip](https://github.com/gazoscalvertos/Hass-Custom-Alarm/files/2913488/alarm.zip)

  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/konnected/switch.py", line 84, in turn_off
    resp = self.client.put_device(
AttributeError: 'NoneType' object has no attribute 'put_device'
djtommye commented 5 years ago

Hmm. didn't seem to attach the file. alarm.zip

akasma74 commented 5 years ago

Do you mean that you have ERROR "Error doing job: Task exception was never retrieved" when you arm and disarm the alarm? And you can disarm with any code?

The "Not passing an entity ID" issue is still there most likely because on some of your devices you still have uncleared cache. Check all of them, clear and reload (or use just one and switch off the rest).

Your alarm.html has no wrong calls

Speaking about bwalarm's debug messages, I can't see any if enabled so we need to find another option.

djtommye commented 5 years ago

Yes- error - sorry. I'll clear the cache and see about that issue. Not really too concerned. The disarm thing is kind of the biggie right now.

RowdyDog12 commented 5 years ago

Is anyone still experiencing this issue with 0.88.2?

djtommye commented 5 years ago

I am but I’m out of state until next weekend, so I can’t help troubleshoot until then.

Tommy Evans 817-994-2559 Sent from my iPhone

On Mar 3, 2019, at 10:05 AM, Evan Morse notifications@github.com wrote:

Is anyone still experiencing this issue with 0.88.2?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

akasma74 commented 5 years ago

Mate, can we separate these 2 issues? You opened an issue and named it "Any code works ro disarm" but keep going on about a missing keypad, that's bad, I already asked you to focus on the issue here. Please re-read the comments and act appropriately. Speaking about keypad - I'm not afraid of using search, it's already here

djtommye commented 5 years ago

Still, when I go to the Alarm panel I can enter any code to disarm the alarm. That's the issue I'm trying to resolve. Let me know how I can help resolve this issue.

akasma74 commented 5 years ago

Please set debug level for bwalarm commponent in configuration.yaml:

logger:
 default: warning
 logs:
   custom_components.alarm_control_panel.bwalarm: debug

then disarm your alarm and post the output of /config/home-assistant.log here

djtommye commented 5 years ago

Curiously, nothing shows up at all. I've added the following to the end of configuration.yaml, as it looks like my component has a different name:

logger:
 default: warning
 logs:
   custom_components.alarm_control_panel.bwalarm: debug
   custom_components.alarm_control_panel.house: debug

image

djtommye commented 5 years ago

Okay - I upgraded HASSOS from 1.13 to 2.10, restarted, and tested the alarm again. Nothing shows up in the log file when I arm. When I disarm, I get this:```

2019-03-10 20:06:26 ERROR (MainThread) [homeassistant.components.automation] Error while executing automation automation.alarm_disarmed. Unknown error for call_service at pos 1: 
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/automation/__init__.py", line 375, in action
    await script_obj.async_run(variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 131, in async_run
    await self._handle_action(action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 210, in _handle_action
    action, variables, context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/script.py", line 299, in _async_call_service
    context=context
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 85, in async_call_from_config
    domain, service_name, service_data, blocking=blocking, context=context)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1133, in async_call
    self._execute_service(handler, service_call))
  File "/usr/local/lib/python3.7/site-packages/homeassistant/core.py", line 1155, in _execute_service
    await handler.func(service_call)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
    self._platforms.values(), func, call, service_name
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 278, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/local/lib/python3.7/site-packages/homeassistant/helpers/service.py", line 292, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/homeassistant/components/konnected/switch.py", line 84, in turn_off
    resp = self.client.put_device(
AttributeError: 'NoneType' object has no attribute 'put_device'
akasma74 commented 5 years ago

alarm_control_panel.house is entity_id (I have the same), not custom component in general.

Regarding your error log - can't you see it's complaining about your connected component that has NOTHING to do with the alarm you opened the issue about. That's at least the second time you do things like that. I politely ask you to keep on topic for the very last time, otherwise I'll leave you with the author alone :\

djtommye commented 5 years ago

@akasma74 yes - I do see that. My point in posting is that there was nothing in the log that referenced the home alarm component. At all. Neither when arming, nor when disarming. I'd presume that under a debug logging condition, something would have appeared? That's what made me question the name of the entity_id (and why I added both in). Thank you for your assistance; I promise I'm not trying to be a nuisance!

akasma74 commented 5 years ago

Now I know the reason of no debug info.

Try to add this to your logger config section: custom_components.bwalarm.alarm_control_panel: debug

I hope it will print something and we can see what's wrong. Otherwise I don't know what we can do apart from adding debug printouts in the code. Are you able to do that?

djtommye commented 5 years ago

Well, I got some log entries that time - but nothing that seems to help:


2019-03-12 09:38:17 DEBUG (SyncWorker_17) [custom_components.bwalarm.alarm_control_panel] [ALARM] Pending user leaving house
2019-03-12 09:39:18 DEBUG (SyncWorker_3) [custom_components.bwalarm.alarm_control_panel] [ALARM] Alarm changing from pending to armed_home
2019-03-12 09:39:18 DEBUG (SyncWorker_3) [custom_components.bwalarm.alarm_control_panel] [ALARM] Turning off warning
2019-03-12 09:39:35 DEBUG (SyncWorker_9) [custom_components.bwalarm.alarm_control_panel] [ALARM] Alarm changing from armed_home to disarmed

I'm quite comfortable with code, as I'm a developer myself - just not that familiar with this platform or python. Thanks again for the help!

akasma74 commented 5 years ago

Basically you need to add debug prints to process_event function in .py code

There should be [ALARM] Alarm changing from XXX to XXX first, where is it?

p.s I'm not that familiar with this platform or python, too. But wanted to sort out some things as it's easier than wait sometimes.

djtommye commented 5 years ago

Well, I feel really stupid right now. I added some debug lines to the code to figure out what's going on. I presumed that I could have a master code AND/OR user defined codes. I didn't have a master, so it never looked any further. (Though I did have user defined ones). Man, I'm so sorry to have wasted your time like this! But I do appreciate the assistance.

akasma74 commented 5 years ago

Man, I'm glad that you found the culprit. That's why this place exists after all, and I'm happy that I was able to help in a way ;) I believe it's a positive experience for you as you found a root of your issue and got more familiar with the component so might be able to solve further issues more easily, result! It's good for me as I will know better the component that is responsible for my security. And it's beneficial for anyone else using that as well.

Just explain me in more details what exactly you think was the cause of "any code works to disarm", what are your findings?

djtommye commented 5 years ago

Sure thing, @akasma74:

I had created users with codes, but didn't set a Master Code. I presumed that I could do that, but that's not supported. You must have a Master Code configured in order for user codes to work. After some debugging, I discovered this was the issue. I then set a Master Code and everything is working fine.

Thanks again!