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

Fire HASS events on SimpliSafe events #31811

Merged
merged 7 commits into from Feb 14, 2020
Merged

Fire HASS events on SimpliSafe events #31811

merged 7 commits into from Feb 14, 2020

Conversation

@bachya
Copy link
Contributor

bachya commented Feb 13, 2020

Proposed change

Now that HASS can listen (and respond) to events from the SimpliSafe websocket, this PR fires a corresponding HASS event when a SimpliSafe event is received. Tactically, this means users can trigger automations by listening to various SIMPLISAFE_EVENT events – for example, to create a persistent notification from any event:

automation:
  - alias: "Notify on SimpliSafe events"
    trigger:
      platform: event
      event_type: SIMPLISAFE_EVENT
    action:
      service: persistent_notification.create
      data_template:
        title: New SimpliSafe Event
        message: "{{ trigger.event.data }}"

Each event provides a payload that looks like this:

{
    "changed_by": "",
    "event_type": "armed_home",
    "info": "System Armed (Home) by Remote Management",
    "sensor_name": "",
    "sensor_serial": "",
    "sensor_type": "remote",
    "system_id": 323864,
    "timestamp": datetime.datetime(2020, 2, 13, 23, 1, 13, tzinfo=<UTC>),
}

...and event_type can be one of:

  • camera_motion_detected
  • doorbell_detected
  • entry_detected
  • motion_detected
  • sensor_not_responding
  • sensor_restored

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml
simplisafe:
  accounts:
    - username: !secret simplisafe_username
      password: !secret simplisafe_password

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum
bachya added 3 commits Feb 13, 2020
@bachya bachya self-assigned this Feb 13, 2020
@project-bot project-bot bot added this to Needs review in Dev Feb 13, 2020
@project-bot project-bot bot moved this from Needs review to By Code Owner in Dev Feb 13, 2020
bachya added 2 commits Feb 13, 2020
This reverts commit 5581889.
@bachya bachya mentioned this pull request Feb 13, 2020
3 of 7 tasks complete
@bachya bachya removed the docs-missing label Feb 13, 2020
@codecov

This comment has been minimized.

Copy link

codecov bot commented Feb 14, 2020

Codecov Report

Merging #31811 into dev will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev   #31811      +/-   ##
==========================================
- Coverage   94.68%   94.66%   -0.02%     
==========================================
  Files         763      763              
  Lines       55148    55160      +12     
==========================================
+ Hits        52215    52216       +1     
- Misses       2933     2944      +11
Impacted Files Coverage Δ
...meassistant/components/homematicip_cloud/switch.py 93.4% <0%> (-6.6%) ⬇️
...eassistant/components/homematicip_cloud/climate.py 98.29% <0%> (-1.71%) ⬇️
...omponents/homematicip_cloud/alarm_control_panel.py 98.52% <0%> (-1.48%) ⬇️
...omeassistant/components/homematicip_cloud/cover.py 97.36% <0%> (-1.32%) ⬇️
homeassistant/components/ipma/config_flow.py 100% <0%> (ø) ⬆️
homeassistant/components/ipma/weather.py 85.43% <0%> (+1.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3018e8f...3bdb6da. Read the comment docs.

Dev automation moved this from By Code Owner to Reviewer approved Feb 14, 2020
@bachya bachya merged commit d6f0c26 into home-assistant:dev Feb 14, 2020
10 checks passed
10 checks passed
CI Build #20200214.49 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected when comparing 3018e8f...3bdb6da
Details
codecov/project Absolute coverage decreased by -0.02, only covered lines were removed
Details
Dev automation moved this from Reviewer approved to Done Feb 14, 2020
@bachya bachya deleted the bachya:ss-events branch Feb 14, 2020
@lock lock bot locked and limited conversation to collaborators Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.