Home Assistant Examples

315 views
Skip to first unread message

Lindsey Chesnutt

unread,
Feb 19, 2020, 11:21:11 AM2/19/20
to Camect User Forum
I'm curious how others are using the Home Assistant integrations. I was hoping to use this thread to share some examples of automations that people are using.

I currently have Home Assistant listening for events and only sending notification to my Android Phone when my input_boolean switches are either in Sleep or Away mode. I'd like for the notification to show the animated GIF that the email sends and a URL link to the video but I've yet to get that working.

 
  - alias: 'Rule 3: Notify by app when camera is triggered'
     trigger
:
       platform
: event
       event_type
: camect_event
       event_data
:
         type
: alert
     action
:
       service
: notify.mobile_app_lm_x210_g
       data_template
:
         title
: '{{ trigger.event.data[''desc''] }}'
         message
: '{{ trigger.event.data[''desc''] }}'
         data
:
           attachment
:
             url
: '{{ trigger.event.data[''url''] }}'
             hide
-thumbnail: false
     condition
:
       condition
: or
       conditions
:
         
- condition: state
           entity_id
: input_boolean.input_sleep
           state
: 'on'
         
- condition: state
           entity_id
: input_boolean.input_away
           state
: 'on'




ZzyzxOh

unread,
Feb 20, 2020, 9:37:02 AM2/20/20
to Camect User Forum
I'm very impressed! I have Life360, Lutron RadioRa2 and Spotify working with Home Assistant on an RPi4 but haven't figured out where things go to get Camect integrated. How did you figure out where $here and $there go? Who what login and password belong to? I'm anxious to participate in this topic, but find the documents (readme) a bit sparse.

Lindsey Chesnutt

unread,
Feb 20, 2020, 10:42:08 AM2/20/20
to Camect User Forum
I had to do some exploring with the python sample code to figure some of this stuff out.

Here's an automation to change the Operation Mode. "HOME" is "At Home", "DEFAULT" is "Normal Operation".



   - alias: 'Rule 8: When Security Mode toggled to Home, run these actions'
     trigger
:
       platform
: state
       entity_id
: input_boolean.input_home
       to
: 'on'
     action
:
       
- service: notify.mobile_app_lm_x210_g
         data
:
           title
: 'Arriving Home'
           message
: 'Welcome!'
       
- service: camect.change_op_mode
         data
:
           mode
: "HOME"

P Mallone

unread,
Feb 20, 2020, 1:06:13 PM2/20/20
to Camect User Forum


On Wednesday, February 19, 2020 at 10:21:11 AM UTC-6, Lindsey Chesnutt wrote:
I'd like for the notification to show the animated GIF that the email sends and a URL link to the video but I've yet to get that working.

This has been my hopes too, but I haven't figured out if it's possible. I'm not sure that those GIFs are exposed in any way that I can retrieve them. For now, I'm just dealing with Camect's Telegram integration as the notification method.

My other wish list item would be for the cameras to be exposed the same way that other cameras are within HA, so I could stream the video to Chromecast/Google Displays. Camect uses WebRTC streams, but I don't think HomeAssistant has a way to process them yet.

Lindsey Chesnutt

unread,
Feb 21, 2020, 10:45:02 AM2/21/20
to Camect User Forum
If they would expose the link to the animated GIF in the event API, I think we could pick it up and use it in Home Assistant notifications.

Lindsey Chesnutt

unread,
Mar 12, 2020, 12:21:17 PM3/12/20
to Camect User Forum
I managed to get Home Assistant to send a notification with a URL for the Camect alerts on Android. I don't think the ttl and priority options actually do anything yet. If there was some way to get a link to a screenshot from the footage, it would be nice to include it in the alert as well. This is what I have.

  - alias: 'Rule 3: Notify by app when camera is triggered'
     trigger:
       platform: event
       event_type: camect_event
       event_data:
         type: alert
     action:
       service: notify.all_mobile_apps
       data_template:
         title: '{{ trigger.event.data[''desc''] }}'
         message: '{{ trigger.event.data[''desc''] }}'
         data:
           clickAction: '{{ trigger.event.data[''url''] }}'
           ttl: 0
           priority: high

P Mallone

unread,
Mar 13, 2020, 10:01:27 AM3/13/20
to Camect User Forum
FWIW, I submitted a pull request on the py-camect project to extract out the data from 'desc' so we could pull 'camera' and 'object' as distinct fields in the event.

It's horribly hacky...but appears to accomplish the goal.

My theory was that the next step would be to change the way the events are exposed, more closely resembling the method that home-assistant uses for other integrations.

Lindsey Chesnutt

unread,
Mar 24, 2020, 5:29:38 PM3/24/20
to Camect User Forum
I've managed to get my camera notifications announced via Alexa through Home Assistant. I made an "Annunciator" button that when toggled to "On", sets the Camect detection status to "DEFAULT" and then I made another automation that uses a conditional statement to send notifications to all of my Alexa devices when the detected object is a car, truck or person. I hope this is helpful for someone. If you improve upon it, please post back to the thread.

    - alias: 'When annunciator toggled to On, do the following.'
      trigger:
        platform: state
        entity_id: input_boolean.annunciator
        to: 'on'
      action:
        - service: notify.all_mobile_apps
          data:
            title: 'Annunciator turned on.'
            message: 'Enabling audible notifications for people, cars and trucks.'
        - service: camect.change_op_mode
          data:
            mode: "DEFAULT"

automation:
   - alias: 'Annunciator'
     trigger:
       platform: event
       event_type: camect_event
       event_data:
         type: alert
     action:
       - service: notify.alexa_media
         data_template:
           data:
             type: tts
           message: '{{ trigger.event.data[''desc''] }}'
           target:
             - media_player.an_echo_dot
             - media_player.an_ecobee_smartthermostat_with_voice_control
             - media_player.another_echo_dot
     condition:
       condition: and
       conditions:
         - condition: state
           entity_id: input_boolean.annunciator
           state: 'on'
         - condition: or
           conditions:
             - condition: template
               value_template: "{{ 'person' in trigger.event.data['desc'] }}"
             - condition: template
               value_template: "{{ 'car' in trigger.event.data['desc'] }}"
             - condition: template
               value_template: "{{ 'truck' in trigger.event.data['desc'] }}"



Lindsey Chesnutt

unread,
Mar 24, 2020, 5:39:34 PM3/24/20
to Camect User Forum
Thanks. That would be very useful.

I'm curious what you mean by" changing the way the events are exposed."

P Mallone

unread,
Mar 25, 2020, 1:51:23 PM3/25/20
to Camect User Forum
Rather than exposing the events via their event bus, expose the the events as senors, binary sensors, etc.

During my research I found one of the Home Assistant devs mention this to the Camect devs in the Home Assistant Git HERE

I *think* the standard way would be to create the following:

switch.camect_homeX = basically what the camect.change_op_mode is
sensor.camect_cameraX = hold the state of events (ie. person, car, etc)
and hopefully camera.camect_driveway = provide a stream/snapshot etc.
etc..

Tom Ring

unread,
Apr 14, 2020, 9:30:17 AM4/14/20
to Camect User Forum
I would really like to get this working.  I'm by no means a programmer, I know a small amount to get by, but I'm trying to utilise the camect notifications to trigger automations - has anybody worked out a way to do this yet?  I can see that the events are exposed on a bus but I'm not clever enough to work out how to use that information as a trigger.  I was playing around with motion settings on my Reolink cameras earlier and created a binary switch based on motion, so I'm thinking the same could be done with Camect?

Can anyone cleverer than me make this work?!

Otherwise I'm relying on the Reolink motion detection which is a little more sensitive!!

Fred Taylor-Young

unread,
Apr 14, 2020, 1:51:48 PM4/14/20
to Camect User Forum
I got it to work - I wrote a Python script to listen for events and forward them to InfluxDB. It wouldn't take a lot of effort to do something else with the data though.
I've been meaning to finish tidying up my script and will then put it somewhere useful like Github. I'll try and find some time this week to do that.

Rob Taft

unread,
Apr 14, 2020, 5:30:10 PM4/14/20
to Camect User Forum
Is InfluxDB a free service?

Fred Taylor-Young

unread,
Apr 14, 2020, 5:35:26 PM4/14/20
to Camect User Forum
It's an open source time series database: https://www.influxdata.com/
I'm using it to make pretty graphs in Grafana (open source analytics and monitoring): https://grafana.com/

MJ

unread,
Jan 27, 2021, 3:28:51 PM1/27/21
to Camect User Forum, fr...@fr3d.org
Hi Fred,

Did you manage to publish the python code for listen to events? If so is there a way i can find it on Github.

Thanks,

Mark

Reply all
Reply to author
Forward
0 new messages