Home Assistant : Q&A, Tips & Tricks, Your Configs

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
40,312
How do you debug Zigbee devices? I have a Sonoff Zigbee bridge flashed with Tasmota - which has 5 TH sensors connected to it which work fine.

I then have a Basic ZBR3 which is about 20m away - that randomly drops off for ages.

And on my office I have another TH sensor that I suspect routes through the ZBR3 (its about 5m away) - but when the ZBR3 comes back online the TH sensor stays offline most of the time.
 

TedLasso

Expert Member
Joined
Feb 23, 2016
Messages
3,760
Btw, there is one more thing that is super useful. I have an alarm view, where I have the following cards:

View attachment 1208110

So if the alarm was triggered when we are not at home, the "Recent activity" page will show you if there are still or were other movement. If I only see an outside beam trigger but nothing else, I don't worry too much. But if you saw other stuff, I am for damn sure going to be on my armed response company's case.

custom:auto-entities ftw.

Code:
card:
  show_header_toggle: false
  title: Recent activity (last 60 min)
  type: entities
filter:
  exclude:
    - entity_id: input*
    - entity_id: light*
    - name: '*Battery*'
    - name: '*Mode*'
    - name: '*Connectivity*'
    - entity_id: binary_sensor.back_garage_door
    - entity_id: binary_sensor.front_garage_door_window
    - name: '*Notify*'
  include:
    - entity_id: '*beam*'
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: '*pir*'
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: cover*
      last_changed: < 60
      options:
        secondary_info: last-changed
    - name: '*Door'
      last_changed: < 60
      options:
        secondary_info: last-changed
    - name: '*Window'
      last_changed: < 60
      options:
        secondary_info: last-changed
    - name: '*Pet Door*'
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: sensor.jessie
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: sensor.ziva
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: sensor.vuur
      last_changed: < 60
      options:
        secondary_info: last-changed
    - entity_id: sensor.vlam
      last_changed: < 60
      options:
        secondary_info: last-changed
show_empty: false
sort:
  method: last_changed
  reverse: true
type: custom:auto-entities

@Tinuva: You are the man!

I'm still not there with the automation giving me the exact name of zone, but endeavouring to get there by working it out (understanding is the main game here).

That auto-entity card is pretty sweet. I made small changes to your filter, but it's even catching my Shelly iOT DW2 sensors that I have on some cupboard doors (where all the good stuff is kept).Lovely.

I never even thought of adding the Shelly sensors to the armed_away/home groups (but now a new group armed_always) but will do that now. I am/do get direct messages via Shelly app if those specific doors are opened.

Also learnt out that two of my Paradox PIR's that show activity on the PIR itself (that is LED lighting to show activity detected) - are actually not reporting anything back to the Alarm Panel - so need to go figure that out too.

1639142981370.png
 

Neuk_

Executive Member
Joined
Jan 23, 2018
Messages
7,995
@Tinuva: You are the man!

I'm still not there with the automation giving me the exact name of zone, but endeavouring to get there by working it out (understanding is the main game here).

That auto-entity card is pretty sweet. I made small changes to your filter, but it's even catching my Shelly iOT DW2 sensors that I have on some cupboard doors (where all the good stuff is kept).Lovely.

I never even thought of adding the Shelly sensors to the armed_away/home groups (but now a new group armed_always) but will do that now. I am/do get direct messages via Shelly app if those specific doors are opened.

Also learnt out that two of my Paradox PIR's that show activity on the PIR itself (that is LED lighting to show activity detected) - are actually not reporting anything back to the Alarm Panel - so need to go figure that out too.

View attachment 1210580

This looks great, I have so much to do to get to this :unsure:
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
40,312
@Tinuva: You are the man!

I'm still not there with the automation giving me the exact name of zone, but endeavouring to get there by working it out (understanding is the main game here).

That auto-entity card is pretty sweet. I made small changes to your filter, but it's even catching my Shelly iOT DW2 sensors that I have on some cupboard doors (where all the good stuff is kept).Lovely.

I never even thought of adding the Shelly sensors to the armed_away/home groups (but now a new group armed_always) but will do that now. I am/do get direct messages via Shelly app if those specific doors are opened.

Also learnt out that two of my Paradox PIR's that show activity on the PIR itself (that is LED lighting to show activity detected) - are actually not reporting anything back to the Alarm Panel - so need to go figure that out too.

View attachment 1210580

Why'd you black out two sensors?
 

w1tw0lf

Expert Member
Joined
Sep 29, 2009
Messages
1,192
Done the update.

Thinking they trying to move to a more simplar look. Not sure where it is heading to. Gona take some time to adjust. Was constantly looking to where things are now.
 

ItherNiT

Senior Member
Joined
Jan 31, 2011
Messages
962
Done the update.

Thinking they trying to move to a more simplar look. Not sure where it is heading to. Gona take some time to adjust. Was constantly looking to where things are now.
Congrats on the 1000th, post!
 

calypso

Expert Member
Joined
Feb 10, 2009
Messages
1,857

Neuk_

Executive Member
Joined
Jan 23, 2018
Messages
7,995
Anyone updated to the new HA?


Looks like a few UI changes.
Not sure how I feel about the new supervisor change.

I updated a week or so back, messed up my ModBus integration which I have now fixed, but I still have issues with the HA disconnecting whenever I try make config changes.
 

TedLasso

Expert Member
Joined
Feb 23, 2016
Messages
3,760
@Tinuva :

Thanks again. I got it all setup. Still can't figure how parse the template sensor you built which magically pulls in the name of the triggered zone, but it's working so I am leaving it even though I am too dense to understand it (trying very hard though)

What's interesting for me and the approach is slightly different after going through this (in case it's useful for others too)

I started with groups for armed_away / armed_home . As I have two partitions, inside and outside , the recommendation was to build 4 groups for each state. What I realised is I am interested in all of them all the time, so I could just setup one group armed_away which includes all the sensors (so from the Paradox alarm regardless of partition, my Shelly DW2 sensors and my cover switches for garage/gate).

Code:
armed_away:
  name: Armed Away Sensors
  entities:
    - binary_sensor.entrance_pir
    - binary_sensor.play_room_door
    - binary_sensor.lounge_pir
    - binary_sensor.dining_pir
    - binary_sensor.scullery_pir
    - binary_sensor.smoke_detector
    - binary_sensor.garage_pir
    - binary_sensor.passage_pir
    - binary_sensor.bed_2_pir
    - binary_sensor.study_pir
    - binary_sensor.master_bed_pir
    - binary_sensor.master_ac_window
    - binary_sensor.study_window
    - binary_sensor.master_bath_wind
    - binary_sensor.comm_bath_window
    - binary_sensor.carport_pir
    - binary_sensor.garage_od_pir
    - binary_sensor.study_od_pir
    - binary_sensor.guest_bed_pir
    - binary_sensor.bed_1_pir
    - binary_sensor.shelly_shdw_2_483fda81e33b_door_window
    - binary_sensor.shelly_shdw_2_40f5202e0e65_door_window
    - binary_sensor.shelly_shdw_2_483fda81e190_door_window
    - binary_sensor.shelly_shdw_2_483fda81e18d_door_window
    - cover.front_gate_1
    - cover.garage_door_1

Note for now, I have a group called armed_always which includes the gate, garage and shelly sensors for testing

Then my automation for getting the notification via Home Assistant . I have two:- one for the inside partition or to outside partition but tied to the same group

YAML:
alias:  - SEND NOTIFICATION WHEN ALARM TRIGGERS - INSIDE
description: Send a notification -EVERYWHERE - when an alarm triggers on INSIDE partition
trigger:
  - platform: state
    entity_id: alarm_control_panel.inside
    to: triggered
condition: []
action:
  - service: notify.mobiledevicesonly
    data:
      title: INTERIOR ALARM !!
      message: >-
        *INTERIOR ALARM TRIGGERED!* on: {{- '\n' -}} {{
        states.sensor.armed_away.state }}
mode: single

YAML:
alias:  - SEND NOTIFICATION WHEN ALARM TRIGGERS - OUTSIDE
description: >-
  Send a notification -EVERYWHERE - when an alarm triggers on OUTSIDE
  partition
trigger:
  - platform: state
    entity_id: alarm_control_panel.outside
    to: triggered
condition: []
action:
  - service: notify.mobiledevicesonly
    data:
      title: EXTERIOR ALARM !!
      message: >-
        *EXTERIOR ALARM TRIGGERED!* on: {{- '\n' -}} {{
        states.sensor.armed_away.state }}
mode: single

For the above, everything works now :D

And because my Paradox alarm itself will not 'trigger' if the garage door/gate or the shelly doors are opened as it is not tied to the official alarm, I just setup a similar notification so that if the Shelly or the Covers change while the exterior partition is armed, to notify me at the minimum. (in the future, maybe to trigger the paradox alarm so that my security company is notified for the gate/garage door/external doors)

With the automation below, I am getting the name of the Shelly DW2 sensor that is being triggered while paradox alarm is armed, but not the name of the cover (garage door or front gate)

YAML:
alias:  - NOTIFY IF SHELLY-GATE-GARAGE CHANGES WHILE ALARM IS ARMED
description: >-
  Notify mobile devices that doors connected to Shelly devices/gate/garage
  opened while the outside Alarm is armed
trigger:
  - platform: state
    entity_id: binary_sensor.shelly_shdw_2_483fda81e33b_door_window
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 1
  - platform: state
    entity_id: binary_sensor.shelly_shdw_2_40f5202e0e65_door_window
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 1
  - platform: state
    entity_id: binary_sensor.shelly_shdw_2_483fda81e190_door_window
    for:
      hours: 0
      minutes: 0
      seconds: 1
    from: 'off'
    to: 'on'
  - platform: state
    entity_id: binary_sensor.shelly_shdw_2_483fda81e18d_door_window
    from: 'off'
    to: 'on'
    for:
      hours: 0
      minutes: 0
      seconds: 10
  - platform: state
    entity_id: cover.front_gate_1
    from: closed
    to: open
    for:
      hours: 0
      minutes: 0
      seconds: 1
  - platform: state
    entity_id: cover.garage_door_1
    from: closed
    to: open
condition:
  - condition: state
    entity_id: alarm_control_panel.outside
    state: armed_away
action:
  - service: notify.mobiledevices
    data:
      title: OTHER ALARM !!
      message: >-
        *OTHER ALARM TRIGGERED!*: {{- '\n' -}} {{
        states.sensor.armed_always.state }}
mode: single

I added Garage and Gate in the sensor template to pick up values for the cover - but can't work out how where to troubleshoot this this line by line.

YAML:
  - platform: template
    sensors: 
      armed_always:
        friendly_name: Armed Always
        value_template: >-
          {%- for entity_id in states.group.armed_always.attributes.entity_id if states(entity_id) == 'on' -%}
          {% set parts = entity_id.split('.') -%}
          {% set sensor_name  = (states[parts[0]][parts[1]].name | replace(' - alarm',''))    %}
          {%- if loop.first %}{% elif loop.last %} {{- '\n' -}} {% else %} {{- '\n' -}} {% endif -%}
          {% if ('DOORS' in sensor_name|upper or 'WINDOWS' in sensor_name|upper or 'GATE' in sensor_name|upper or 'GARAGE' in sensor_name|upper) %}{{ sensor_name }} opened{% elif ('DOOR' in sensor_name|upper or 'WINDOW' in sensor_name|upper ) %}{{ sensor_name }} opened{% else %}{{ sensor_name }} triggered{% endif %}
          {%- endfor %}
 

Tinuva

The Magician
Joined
Feb 10, 2005
Messages
12,478
@TedLasso

Happy you got it working.

As for magically putting in the name. I didn't write the code but I do understand it.

It builds a list of entities from the group you created, then do a for loop over them. To get the name it just points to it.

Code:
states.entity_id.name
gets the name instead of the value which is
Code:
states.entity_id.state

So basically, same way it could get the state, it can also get the name. Basically, all you need to know is, the sensors are binary entities, and the for loop looks for sensors in the "on" or "true" state, and then grab the names of those and that is then what you want in your notification.

So example:
Code:
states.binary_sensor.shelly_shdw_2_483fda81e190_door_window.name
 

xrapidx

Honorary Master
Joined
Feb 16, 2007
Messages
40,312
Anyone using the Xiaomi miio integration for Philips bulbs? I have two bulbs which have stopped working after the latest HA update.
 

Veroland

Executive Member
Joined
Aug 24, 2005
Messages
6,304
Have anyone played with the new Area Card in update 2021.12?

I can't seem to find any documentation on it and are trying to figure out why only some of my temperature sensors appear on the cards.
 

w1tw0lf

Expert Member
Joined
Sep 29, 2009
Messages
1,192
Have anyone played with the new Area Card in update 2021.12?

I can't seem to find any documentation on it and are trying to figure out why only some of my temperature sensors appear on the cards.
Had a quick look, but didn't seem much options to customize it. You will need to make sure entities/devices are asigned to areas.
 

Veroland

Executive Member
Joined
Aug 24, 2005
Messages
6,304
Had a quick look, but didn't seem much options to customize it. You will need to make sure entities/devices are asigned to areas.
I did, the big difference is the working Temperatures is from ZHA and the non working ones are from a custom integration I wrote myself.

The ZHA one's are part of a device and my own is only entities, and I am having a hell of a time trying to register a device in python at the moment.
 

alqassam

Expert Member
Joined
Aug 11, 2014
Messages
4,112
Anyone using a nest hub as a display here?

1 option is to do the linking manually
2nd option is to just cast your dashboard. What's the most useful.

A ksonwant to setup an automation that plays an alert when motion is triggered and opens a camera fees on the hub. Is it possible?
 
Top