šŸ›” Watchman - keeps track of missing entities and services in your config files

What would you automate though?

@tom_l probably not a lot but I would send out a notification under certain conditions, e.g. in the evening only when I am home and alone.

Current version of integration supports both use cases.

@scr absolutely, and that is great! With adding entity_ids of all problematic entities to the generated entites being on the roadmap, there is really not much I would wish for :smiley:
Regarding a Lovelace card, I would suggest to generate a markdown card from the discussed entity. That should be just a few lines of code you can provide through your README.

Just to be clear. Your addon already helped me a lot!! It is so valuable for users that I thought I can add some constructive criticism :sweat_smile: To be honest, I believe this should find itā€™s way into Home Assistant, in fact you should know that someone is working on a Visual Studio Code extension.

Best!

You can do that now.

This sounds like a good idea, however, I should check if there is a limit for the maximum amount of data for an entity state. The report can be quite long sometimes.

Any feedback is really appreciated, thank you!. :grinning:

All states are limited to no more than 255 characters.

Attributes are unlimited. As far I know. At least I havenā€™t found that limit yet. :wink:

And to add my support for this integration. It really is a great tool. Ive found a bunch of stuff I needed to take care of as well.

:+1:

1 Like

This bug was fixed in v.0.3.1.

2 Likes

Great, thanks for the info!

I get the following error when I add Watchman to my configuration.yaml:

Component error: watchman - cannot import name ā€˜SensorDeviceClassā€™ from ā€˜homeassistant.components.sensorā€™ (/usr/src/homeassistant/homeassistant/components/sensor/init.py)

Iā€™m running version 0.3.1 on 2021.11.5

Any ideas on how to resolve this?

There were unused dependencies on HA version 2021.12, theyā€™re removed in v.0.3.2, please update.

1 Like

@scr Thanks! Itā€™s working now.

Great work!

Just quick a tip, when posting the report here on the forum, you can use

```text
report_here
```

to avoid having the colorful syntax highlighting thatā€™s really meant for diff.

Without `text`
-== WATCHMAN REPORT ==-  

-== Missing 1 service(-s) from 38 found in your config:
+--------------------------------+---------+------------------------------------------+
| Service                        | State   | Location                                 |
+--------------------------------+---------+------------------------------------------+
| xiaomi_miio.vacuum_goto        | missing | automations.yaml:599,605                 |
+--------------------------------+---------+------------------------------------------+

-== Missing 3 entity(-es) from 216 found in your config:
+--------------------------------+---------+------------------------------------------+
| Entity                         | State   | Location                                 |
+--------------------------------+---------+------------------------------------------+
| sensor.stats_pm25_10_median    | unavail | customize.yaml:14                        |
| sensor.xiaomi_miio_sensor      | unavail | automations.yaml:231,1348                |
| vacuum.roborock_s5max          | unavail | automations.yaml:589,603,610,1569        |
+--------------------------------+---------+------------------------------------------+

-== Report created on 03 Feb 2022 17:18:55
-== Parsed 200 files in 0.96s., ignored 66 files 
-== Generated in: 0.01s. Validated in: 0.00s.
With `text`
-== WATCHMAN REPORT ==-  

-== Missing 1 service(-s) from 38 found in your config:
+--------------------------------+---------+------------------------------------------+
| Service                        | State   | Location                                 |
+--------------------------------+---------+------------------------------------------+
| xiaomi_miio.vacuum_goto        | missing | automations.yaml:599,605                 |
+--------------------------------+---------+------------------------------------------+

-== Missing 3 entity(-es) from 216 found in your config:
+--------------------------------+---------+------------------------------------------+
| Entity                         | State   | Location                                 |
+--------------------------------+---------+------------------------------------------+
| sensor.stats_pm25_10_median    | unavail | customize.yaml:14                        |
| sensor.xiaomi_miio_sensor      | unavail | automations.yaml:231,1348                |
| vacuum.roborock_s5max          | unavail | automations.yaml:589,603,610,1569        |
+--------------------------------+---------+------------------------------------------+

-== Report created on 03 Feb 2022 17:18:55
-== Parsed 200 files in 0.96s., ignored 66 files 
-== Generated in: 0.01s. Validated in: 0.00s.
2 Likes

Version 0.4.0:

  • UI options support. Existing yaml configuration will be imported upon the first run and can be safely removed afterwards
  • send_notification service parameter is set to false if omitted (breaking change)
  • default report file name changed to watchman.txt
  • a few minor improvements
1 Like

This is great ! However, it would have been su much nicer if markdown was used. It would be simple:

  • replace + sign in tables to |
  • remove the top and bottom line of the table
  • replace the -== marker for the headings into ##

That would look like (for example)


#  Watchman Report  

## Missing 1 service(s) from 35 found in your config:

| Service ID                     | State   | Location                                                     |
|--------------------------------|---------|--------------------------------------------------------------|
| homeassistant.turn_            | missing | blueprints/automation/adchevrier/synchronize-the-on-off-  state-of-2-entities.yaml:29                                  |

## Missing 7 entity(ies) from 249 found in your config:
| Entity ID                      | State   | Location                                                     |
--------------------------------|---------|--------------------------------------------------------------|
| group.movement_inside          | unknown | groups.yaml:105                                              |
| binary_sensor.pir_motion_sensor_home_security_motion_detection_2   | missing | groups.yaml:106                                              |
| binary_sensor.pir_motion_sensor_home_security_motion_detection | missing | groups.yaml:107                                              |
| automation.deurnotificatie     | missing | customize.yaml:20                                            |
| automation.auto_duettes_op     | missing | scripts.yaml:142                                             |
| switch.schedule_abcdef         | missing | custom_components/scheduler/services.yaml:8,29,94,154        |
| light.my_lamp                  | missing | custom_components/scheduler/services.yaml:64,124             

and would then be viewed like:

Watchman Report

Missing 1 service(s) from 35 found in your config:

Service ID State Location
homeassistant.turn_ missing blueprints/automation/adchevrier/synchronize-the-on-off- state-of-2-entities.yaml:29

Missing 7 entity(ies) from 249 found in your config:

Entity ID State Location
group.movement_inside unknown groups.yaml:105
binary_sensor.pir_motion_sensor_home_security_motion_detection_2 missing groups.yaml:106
binary_sensor.pir_motion_sensor_home_security_motion_detection missing groups.yaml:107
automation.deurnotificatie missing customize.yaml:20
automation.auto_duettes_op missing scripts.yaml:142
switch.schedule_abcdef missing custom_components/scheduler/services.yaml:8,29,94,154
light.my_lamp missing custom_components/scheduler/services.yaml:64,124
1 Like

Already installed & tested this component.
The result was amazing! Iā€™d have never believed how many bugs I had in my yamlā€™s.
I needed nearly an hour to resolve everything.

Thanks for this component. Really helpful - great job!!

PS: I will automate it once a month. Too good to may forget to use it :wink:

1 Like

I am trying to use this markdown card in yaml mode:

      - type: markdown
        content: >-
          <h2> <ha-icon icon='mdi:shield-half-full'></ha-icon> Watchman report<h2>
          <h3>Missing Entities: {{ states.sensor.watchman_missing_entities.state }} </h3>
          {%- for item in state_attr("sensor.watchman_missing_entities", "entities") %}
          <hr> <table><tr> <td>
          <ha-icon icon='mdi:
          {%- if item.state=="missing"-%}cloud-alert'
          {%- elif item.state=="unavail" -%}cloud-off-outline' {%- else-%}cloud-question'
          {%- endif -%} ></ha-icon>
          {{ item.id }} [{{item.state}}] <a title="{{item.occurrences}}">
          {{item.occurrences.split('/')[-1].split(':')[0]}}</a>
          </td></tr></table>
          {%- endfor %}

But when i go to developers-> models to test it i get only:

TypeError: 'NoneType' object is not iterable

And in the lovelace.log i get:

2022-02-23 16:59:37 ERROR (Thread-461) [homeassistant.helpers.template] Template variable error: 'item' is undefined when rendering '<h3>Missing Entities: {{ states.sensor.watchman_missing_entities.state }} </h3>
{{ item.id }} [{{item.state}}] <a title="{{item.occurrences}}">
  {{item.occurrences.split('/')[-1].split(':')[0]}}</a>
  </td></tr></table>'

In lovelace i have no visible card.
As i am not so expert in these things i am asking helpā€¦

EDIT: Solved after latest release !
Thanksā€¦

And your solution was ??? Other people following this thread might like to know.

No solution from meā€¦ i installed latest version released only few minutes ago and the card is showing!
I just pasted and copied the example posted here

The new version was published in ~30 minutes after documentation was updated. I believe @maurizio53 was lucky enough to discover a new feature before it was actually released. :grinning:

1 Like

New in version 0.5.0:

  • support of custom reports within a Lovelace card!
  • sensor.watchman_missing_entities and sensor.watchman_missing_services are now automatically updated when a relevant entity or service changes state

1 Like

Suggestion: Put the current Watchman version in the report.

How do I determine what version I have installed?
How do I upgrade to the latest version?

If you are using HACS, click the 3 dots and then click Redownload:

1 Like