A template to show Zigbee devices with flat battery

With a lot of battery-powered ZigBee devices on my home network (thermostats, contact sensors, remote controls, etc) it’s useful to have an Home Assistant dashboard with the status of all the batteries, to change the ones before the device goes off.

Simple task, with an Entities Card:

type: entities
title: Battery level
state_color: true
entities:
  - type: section
    label: Remote controls
  - entity: sensor.switch_01_ikea_e1743_battery
  - type: section
    label: Thermostats
  - entity: sensor.thermo_001_battery
    name: Living room
  - entity: sensor.thermo_002_battery
    name: Parents room

With the following result:

Home Assistant Battery dashboard

But this approach has three main drawbacks:

  • Every time a new devices is added to the network, the card needs to be updated
  • Even if the colors help to identify at a glance the batteries that need to be replaced, the search is still a manual process
  • It cannot be automated, for example sending a message every time a battery goes under a certain level

Templates to the rescue

Here a Markdown card with a template that identify all the entities in the system tracking battery level, find the ones with a value below a certain number, and list them:

type: markdown
content: |
  {#- Find all the battery sensors -#}
  {%- set sensors = expand(states.sensor)
    | rejectattr('state', 'in', ['unavailable', 'undefined', 'unknown'])
    | selectattr('attributes.device_class', 'defined') 
    | selectattr('attributes.device_class', '==', 'battery') 
    | rejectattr('entity_id', "search", "keepout_8p")
    | selectattr('attributes.unit_of_measurement', 'defined') 
    | selectattr('attributes.unit_of_measurement', '==', '%') 
    | list %}
  {#- Show only the entities with a battery level below a certain threshold -#}
  {%- for s in sensors -%}
  {%- if s.state | int(0) < 30 -%}
    {{ s.attributes.friendly_name + ": " + s.state }}
    {#- s.entity_id can be used too #}
  {% endif -%}
  {% endfor -%}
title: Devices with low battery level

With this final result:

Home Assistant Markdown card

Let’s look at the code block by block.

Find all the entities measuring a battery level

  {#- Find all the battery sensors -#}
  {%- set sensors = expand(states.sensor)
    | rejectattr('state', 'in', ['unavailable', 'undefined', 'unknown'])
    | selectattr('attributes.device_class', 'defined') 
    | selectattr('attributes.device_class', '==', 'battery') 
    | rejectattr('entity_id', "search", "keepout_8p")
    | selectattr('attributes.unit_of_measurement', 'defined') 
    | selectattr('attributes.unit_of_measurement', '==', '%') 
    | list %}

First, the expand() command returns all the sensors in the system, then a series of Jinja 2 filters are applied to remove unavailable, undefined and unknown entities, find all the entities with a battery device class, remove entity_id of my phone (keepout_8p) and find all the remainig entities with the % as unit of measurement of the battery.

Find all the battery level below a certain threshold

  {#- Show only the entities with a battery level below a certain threshold -#}
  {%- for s in sensors -%}
  {%- if s.state | int(0) < 30 -%}
    {{ s.attributes.friendly_name + ": " + s.state }}
    {#- s.entity_id can be used too #}
  {% endif -%}
  {% endfor -%}

A simple check for all the sensors found previously, to identify if there are battery levels below a certain threshold. To be sure a comparison between numbers is done, the state value is parsed as integer, and then compared with the threshold level. Once the entity is identified, the message to show is assembled, chaining different property of the sensor.

A template sensor with the devices

To get the information, but inside an sensor, it could be useful to create a template sensor. The logic is the same:

 template:
  - sensor:
      - name: ZigBee devices battery to change
        unique_id: zigbee_devices_battery_to_change
        state: >
          {#- Find all the battery sensors -#}
          {%- set sensors = expand(states.sensor)
            | rejectattr('state', 'in', ['unavailable', 'undefined', 'unknown'])
            | selectattr('attributes.device_class', 'defined') 
            | selectattr('attributes.device_class', '==', 'battery') 
            | rejectattr('entity_id', "search", "keepout_8p")
            | selectattr('attributes.unit_of_measurement', 'defined') 
            | selectattr('attributes.unit_of_measurement', '==', '%') 
            | list %}
          {#- Show only the devices with a battery level below a certain threshold -#}
          {%- for s in sensors -%}
          {% if s.state | int(0) < 30 %}
          {{ s.attributes.friendly_name + ": " + s.state }}
          {#- s.entity_id can be used too -#}
          {% endif -%}
          {%- endfor -%}

The Community Commitment Curve to architect community engagement

“How to use the Community Commitment Curve to architect community engagement” is a comprehensive session aimed at helping individuals and organizations create and sustain vibrant developer marketing communities.

The session will provide insights into the concept of the Community Commitment Curve, a strategic framework designed to map and optimize community engagement.

(Developer Marketing Alliance webinar, 11 Oct 2023)

Leadership Lessons From A Team of Community Builders

Good managers are made, not born. It makes no difference for a team of community builders, with added complexities such as remote working, high burnout risk, unclear career path, etc. I’ll share my stories covering topics like hiring, setting a vision, building and tracking metrics, managing a remote team, keeping work-life in harmony, scaling, etc – while working in the context of a community team.

(Community Rebellion Conference, June 2023)

Slides, with a lot of speaker’s notes

Scaling communities through chapters

Alfredo Morresi and Van Riper have over a decade of experience at Google in developer relationship and community management. They will talk about their experiences in the context of the Google Developer Groups, a meta community program born in 2009 that has grown to 1,000+ chapters across 140 countries.

They discuss how to build a program at that scale with benefits for the company, benefits for the developer community, and benefits for the world.

(link to the video and transcript)

A Playbook for a Successful Community Operations Team

When a community program grows, it moves from a one-person band role, to a team of people, to a team of teams. And Community Operations is often one of the first teams formed. When to start one, and how to scale it? What are its key responsibilities? It’s just about data, dashboards and automations, or is there something more? In this session, I shared my best learnings in leading a dev community operations team in Google, the most embarrassing failures and “the road head”.

(CMX Summit, Sept 2022)

Here are the slides, with lot of info in the speaker’s notes too.

Podcasts for Metaverse and XR

There is so much happening in the XR and Metaverse space, that it’s important to carefully select the right sources of information, to filter out all the buzz, save time, and still have a good awareness of what’s going on front and behind the scene. Here the podcasts part of my personal informative diet. In order of importance.

Building the Open Metaverse podcast logo

Building the Open Metaverse (RSS) is a podcast that invites a broad range of technical experts to share their insights on how the community is building the metaverse together.

I follow it because the hosts, Patrick Cozzi and Marc Petit, rarely focus on “the latest news”, but instead, they bring on stage people with a wide range of expertise and experiences, and there are always good-to-mind-blowing learnings in listening to what they’re doing on “the metaverse”, and how they’re contributing to its development. The cut of the podcast follows an open and collaborative philosopy, so it’s not uncommon to listen about standards, techy topics that are fundamental to understand the current challenges, cutting-edge explorations creators and companies are facing today, etc.

This week in XR podcast logo

This Week in XR Podcast is a pithy take on the week’s tech news, followed by interviews with industry guests. Hosted by Forbes Tech Columnist, Professor Charlie Fink, and Ted Schilowitz, Futurist at Paramount Global.

I listen to the podcast for a summary of the latest news in the space. They’re shared and commented every week with different guests, bringing their diverse points of view into the discussion. What I like about this podcast is that I’ve the perception to listen to a “watercooler discussion about everything about VR”, but run by very informed attendees.

Voices of VR podcats logo

Voices of VR: since 2014, Kent Bye has conducted over 1200 (impressive!!!) podcast interviews featuring the pioneering artists, storytellers, and technologists driving the resurgence of virtual & augmented reality.

The podcast archive offers a ton of content (and often audio contents are transcribed on the linked website), so there is also a page on the top 10 episodes to Get Started into VR. I highly recommend listening them, and not only to the beginners in this space. Plus, in episode 1000 transcription, there is a sort of index of different topics and how they’ve been discussed in various episodes.

Boz to the Future podcast logo

Boz to the Future is a podcast hosted by Meta CTO Andrew “Boz” Bosworth where he talks to technologists and leaders building the future of technology, entertainment, and beyond. Episodes will talk about the future Meta is building, Reality Labs, AR/VR/XR, and the metaverse

Despite being very focused on Meta’s vision for the metaverse, the guests explorer and analyze topics in a way that is not only related to Meta, but pertinent to the whole space. Of course, it’s important to consider the podcast is sponsored by Meta.

As stated at the beginning, this was not a comphensive list, and here some additional podcasts I haven’t the time to really explore / follow / have an impression on.

Happy listening!