natekspencer / hacs-vivint

Home Assistant integration for a Vivint home security system.
MIT License
64 stars 3 forks source link

Support for Triggering Alarm from HA #132

Closed fxfitz closed 1 week ago

fxfitz commented 2 months ago

The request

I don't THINK this exists, so please correct me if I'm dumb and just missed it, but would it be possible to trigger the Vivint alarm from HA?

The use case being that I have several non-Vivint motion sensors and door sensors that are directly tied to HA, and it would be great if I could use those to trigger the HA alarm.

TIA!

Screenshots

No response

Additional information

No response

Bobbyiv commented 2 months ago

Have you tried the Alarm Control Panel Trigger service (alarm_control_panel.alarm_trigger)?

fxfitz commented 2 months ago

... Nope, I sure didn't try it, and it totally works! I was looking for a Vivint-specific service 🤦‍♂️

While the alarm did go off, I did get an error though. I can open another ticket for it, but doesn't seem like there's much to go on from the logs (because the alarm did trigger):

2024-04-18 08:52:28.800 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [546705362112] Error handling message: Unknown error (unknown_error) Fran from 192.168.3.145 (Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36 Edg/123.0.0.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 794, in handle_execute_script
    script_result = await script_obj.async_run(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1713, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 457, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 509, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 539, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 507, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 736, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 699, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2543, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2580, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 971, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1043, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/config/custom_components/vivint/alarm_control_panel.py", line 110, in async_alarm_trigger
    await self.device.trigger_alarm()
  File "/usr/local/lib/python3.12/site-packages/vivintpy/devices/alarm_panel.py", line 137, in trigger_alarm
    await self.api.trigger_alarm(self.id, self.partition_id)
  File "/usr/local/lib/python3.12/site-packages/vivintpy/vivintskyapi.py", line 180, in trigger_alarm
    raise VivintSkyApiError("Failed to trigger alarm")
vivintpy.exceptions.VivintSkyApiError: Failed to trigger alarm
natekspencer commented 2 months ago

If you enable debug logging first and then trigger the alarm again, we can see more about this other error going on to see if it's something I can resolve. It's been a long time since I've triggered an alarm manually (probably since I first built the integration), so appreciate the help in identifying that it was still there haha.

fxfitz commented 2 months ago

Got it.

Will do this weekend and post the results!

On Thu, Apr 18, 2024, 9:15 AM Nathan Spencer @.***> wrote:

If you enable debug logging first and then trigger the alarm again, we can see more about this other error going on to see if it's something I can resolve. It's been a long time since I've triggered an alarm manually (probably since I first built the integration), so appreciate the help in identifying that it was still there haha.

— Reply to this email directly, view it on GitHub https://github.com/natekspencer/hacs-vivint/issues/132#issuecomment-2063977361, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQPW4UKEKQCVILWYU7RODDY57IQRAVCNFSM6AAAAABGMJBXZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRTHE3TOMZWGE . You are receiving this because you authored the thread.Message ID: @.***>

github-actions[bot] commented 1 month ago

This issue has now been marked as stale and will be closed if no further activity occurs.

fxfitz commented 1 month ago

Whelp. Totally forgot to do the test. I'll see if I can do it tonight!

On Sun, May 19, 2024, 2:35 PM github-actions[bot] @.***> wrote:

This issue has now been marked as stale and will be closed if no further activity occurs.

— Reply to this email directly, view it on GitHub https://github.com/natekspencer/hacs-vivint/issues/132#issuecomment-2119338229, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQPW4QNPDRLLDFT4M2UE4LZDD5J3AVCNFSM6AAAAABGMJBXZKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMJZGMZTQMRSHE . You are receiving this because you authored the thread.Message ID: @.***>

fxfitz commented 1 month ago

So I set the default logging level to debug:

logger:
  default: debug

And I'm not seeing anything more in the logs. Is there something specific I should be searching for? Or is there a way to only make the vivint integration log at debug?

natekspencer commented 1 month ago

Or is there a way to only make the vivint integration log at debug?

If you go to an integration, you can enable debug logging specifically for that domain: Screenshot 2024-05-20 at 09 29 37

github-actions[bot] commented 2 weeks ago

This issue has now been marked as stale and will be closed if no further activity occurs.