akasma74 / Hass-Custom-Alarm

It is a fork of "Yet another take on a home assistant custom alarm" that will exist until its author is back to our Earth
80 stars 31 forks source link

Error arming via manual button after first arm #50

Closed necromn closed 4 years ago

necromn commented 4 years ago

Your components (from Alarm/Settings/About):

This integration: v1.10.2 Home Assistant: v0.98.1 Python: v(3,7,4,final,0) Running on HassIO and HACS

Platform & Browser: Happens in the iOS App Beta and web clients (chrome and safari) most recent versions

Describe the bug The first arm after restart seems to work ok. But after that neither the core arm button or the panel one work.

2019-08-31 14:21:55 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.140361486312528] Cannot be called from within the event loop Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1235, in async_call await asyncio.shield(self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1258, in _execute_service handler.func(service_call) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 423, in alarm_arm_away_from_panel alarm.alarm_arm_away_from_panel(service.data.get(ATTR_CODE)) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1186, in alarm_arm_away_from_panel return self.alarm_arm(Events.ArmAway, code, True) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1161, in alarm_arm self.process_event(event, arm_immediately) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1331, in process_event self._hass.services.call(self._config.get(CONF_WARNING).split('.')[0], 'turn_on', {'entity_id':self._config.get(CONF_WARNING)}) File "/usr/src/homeassistant/homeassistant/core.py", line 1173, in call self.hass.loop, File "/usr/src/homeassistant/homeassistant/util/async.py", line 151, in run_coroutine_threadsafe raise RuntimeError("Cannot be called from within the event loop") RuntimeError: Cannot be called from within the event loop

Seem to be able to arm via MQTT though

To Reproduce Steps to reproduce the behavior:

  1. Go to alarm sidebar
  2. Tap Arm Away

Expected behavior Alarm to arm

Screenshots N/A

Additional context Comes good again when I restart but then stops working again.

akasma74 commented 4 years ago

Sorry, I don't quite get it.

The To Reproduce section is too short, could you edit your post and describe the proper sequence (as your one describes a normal operation and it definitely works). Also, any information on when it broke? Have you ever had it working?

necromn commented 4 years ago

Yeah unfortunately that's about all I have right now. Literally it just doesnt work after the first time I arm it manually. I just did a quick screen cap) https://www.dropbox.com/s/58za39yvi8ihn9a/Alarmerror.mov?dl=0). This is just after a restart, I happened to have open sensors this time but usually, it would arm the first time and then fail with the same error. Once it fails it doesnt work until I restart.

I'll keep digging.

Possibly related, i have these littered throughout my HASS logs:

2019-09-17 16:53:02 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1213, in async_call processed_data = handler.schema(service_data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['name'] 2019-09-17 16:53:11 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/core.py", line 1213, in async_call processed_data = handler.schema(service_data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 272, in call return self._compiled([], data) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 594, in validate_dict return base_validate(path, iteritems(data), out) File "/usr/local/lib/python3.7/site-packages/voluptuous/schema_builder.py", line 432, in validate_mapping raise er.MultipleInvalid(errors) voluptuous.error.MultipleInvalid: extra keys not allowed @ data['name']

necromn commented 4 years ago

Just upgraded to 99.2 and have some better logs now:

2019-09-23 08:07:30 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection.139674873107792] Cannot be called from within the event loop Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 130, in handle_call_service connection.context(msg), File "/usr/src/homeassistant/homeassistant/core.py", line 1234, in async_call await asyncio.shield(self._execute_service(handler, service_call)) File "/usr/src/homeassistant/homeassistant/core.py", line 1257, in _execute_service handler.func(service_call) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 423, in alarm_arm_away_from_panel alarm.alarm_arm_away_from_panel(service.data.get(ATTR_CODE)) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1186, in alarm_arm_away_from_panel return self.alarm_arm(Events.ArmAway, code, True) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1161, in alarm_arm self.process_event(event, arm_immediately) File "/config/custom_components/bwalarm/alarm_control_panel.py", line 1331, in process_event self._hass.services.call(self._config.get(CONF_WARNING).split('.')[0], 'turn_on', {'entity_id':self._config.get(CONF_WARNING)}) File "/usr/src/homeassistant/homeassistant/core.py", line 1172, in call self.hass.loop, File "/usr/src/homeassistant/homeassistant/util/async.py", line 151, in run_coroutine_threadsafe raise RuntimeError("Cannot be called from within the event loop") RuntimeError: Cannot be called from within the event loop

necromn commented 4 years ago

This seems to have gone away with HASS 100+