Hi, can anyone help with what might be a simple task - I’m using browser_mod
within which I can see a number of devices (browsers) that have accessed a dashboard I make available to some colleagues. Can I count how many have connected (ie the total number of devices within the integration) and also the number of browsers that are connected at the moment?
I’d be grateful for some pointers.
Thanks aceindy. That stimulated another search through the community which came up with this
{%- set find_integration = 'browser_mod' %}
{%- set devices = states | map(attribute='entity_id') | map('device_id') | unique | reject('eq',None) | list %}
{%- set ns = namespace(entities = []) %}
{%- for device in devices %}
{%- set ids = device_attr(device, 'identifiers') | list | first | default %}
{%- if ids and ids | length == 2 and ids[0] == find_integration %}
{%- set ns.entities = ns.entities + [ids[1]] %}
{%- endif %}
{%- endfor %}
{{ ns.entities |count }}
{{ ns.entities |list | sort}}
This list all the browsers that have ever registered with browser_mod but i’d like to only count those currently logged on on better still those that have connected in the last 24hrs (for example).
I’ve tried adding
{%- if states('sensor.'~ids[1]|lower~'_browser_user') not in ['unknown','unavailable'] %}
but that isn’t working (only gives me 1 when 3 are currently logged on) and it doesn’t allow a slection of recent users. I’m quite out of my depth here!