Grouped presence

In HA I use a group to display presence as I have found that just 1 means of detection isn’t reliable enough. So I combine an iOS device with a separate nmap device (for the same phone) and roll that up in a group.

HA looks at the home/away of both devices and if either say home, then the grouped person is home.

I’ve just started setting up an appdaemon dashboard but looked like the presence widget only supports an actual device, not a group, and the group widget is for lights.

Are there any plans to support grouped presence?

I have the same question.

This is not my idea and i can’t find the topic where it’s mentioned.

You can use the MQTT Device Tracker for this.

Just set it up, and create automations that publish the state of the group to the given topic.

Example:
group.person1 to on

  - service: mqtt.publish
    data:
      topic: 'home/people/person1'
      payload: 'home'

group.person1 to off

  - service: mqtt.publish
    data:
      topic: 'home/people/person1'
      payload: 'not_home'

Then use the mqtt device tracker for your dashboard.

EDIT:
Found it! Thanks @Cezex

Thanks - never would have thought of that!

I’ve tried to avoid MQTT though so far :slight_smile:

the devicetracker widget uses the device name and not the entity, so you are right that a group wont work with that widget.

but you can use the sensor widget or the icon widget for grouped devices.
just give the group as the entity

1 Like

Ahhh ok great will give that a try! :+1:

Actually if that works it would be better than I expected, as I’d be able to have different icons for different locations?

yes you can

How did you end up working it? When I use a sensor widget I don’t have an icon, just “home” or “away.” When I use an icon widget I get a big fat “O” circle. I tried specifying to use hass icons, or manually forcing them, no dice with either method.

A widget to monitor the state of an entity and display a different icon and style for each listed state, and is configured like the following:

icon:
  title: icon 
  widget_type: icon 
  entity: binary_sensor.basement_door_sensor 
  state_ text: 1 
  icons:

    “active”:
      icon: fa-glass 
      style: “color: green”
    “inactive”:
      icon: fa-repeat 
      style: “color: blue”
    “idle”:
      icon: fa-frown-o 
      style: “color: red”
    “default”:
      icon: fa-rocket 
      style: “color: cyan”
The icons list is mandatory, and each ebtry must contain both an icon and a style entry. It is recommended that quotes are used around the state names, as without these, YAML will translate states like on and off to true and false

The default sntry icon and style will be used if the state doesn’t match any in the list - meaning that it is not necessary to define all states if only 1 or 2 actually matter.

Mandatory Arguments
entity - the entity_id of the binary_sensor
icons - a list of icons and styles to be applied for various states.
Optional Arguments:
title - the title displayed on the tile
title2 - a second line of title text
state_text
state_map
Cosmetic Arguments
widget_style
title_style
title2_style
state_text_style
1 Like

That’s fantastic thanks. Will give it a go tomorrow.

Thought I’d give it a go but it gives me errors:

Phone: parser says 
Phone: in "", line 36, column 20: style: “color: green” ^ 
Phone: mapping values are not allowed here

from

fiona_location:
title: Fiona
widget_type: icon
entity: group.fiona
state_ text: 1
icons:
“home”:
icon: fa-glass
style: “color: green”
“away”:
icon: fa-repeat
style: “color: blue”
“castle royle”:
icon: fa-frown-o
style: “color: red”
“default”:
icon: fa-rocket
style: “color: cyan”

that means that you dont have the right indention.
but i cant see that because you dont show the code as code.
look at the example i gave and at your line 20.

Do I need to use 2 spaces for indent or is 4 ok? I’d been using 4 up to now and everything else was fine.

fiona_location:
    title: Fiona
    widget_type: icon
    entity: group.fiona
    state_text: 1
    icons:
    
        “home”:
            icon: fa-glass
            style: “color: green”
        “away”:
            icon: fa-repeat
            style: “color: blue”
        “castle royle”:
            icon: fa-frown-o
            style: “color: red”
        “default”:
            icon: fa-rocket
            style: “color: cyan”

its yaml, so you need to use the same amount in the whole file.

i use this:

kellercam:
    widget_type: icon
    entity: device_tracker.foscam_keller
    title: Keller
    icons:
        "home": 
            icon: mdi-cctv
            style: "color: green"
        "not_home": 
            icon: mdi-video-off 
            style: "color: red"

make sure you dont have any tabs or strange blank spaces (copy/paste from a website goes wrong with some editors)
if it complains about a specific yaml line, then delete all whitespace and use spaces to make sure it are really spaces.

Ahh ok I wasn’t sure if it was actual yaml or something that just looked similar. Will take another look.

Figured it out - the ""s I copied from the documention weren’t proper ""s :smiley:

1 Like

Any idea why changing the icon colour has no effect? It’s displaying the icon I chose but green (which was the color in the example). I change it to something else in my dash file and reload the dash but it stays green.

2 possibilities:

  1. you made an error when you were changing things (unknown color, typo, wrong css, etc.) and you will probably have an error in the javaconsole or your dash access log
  2. the green icon is cashed by your browser. (make sure you renew the dashboard correct and clear cash)

Must be caching - on my phone it’s fine and seems to change quickly whereas in Chrome on my mac it doesn’t.

I thought it was odd though as anything else I’ve changed reflects on my mac really quickly so interesting that this widget seems to be different.