Watch for specific message in homeassistant log

So I happened to be looking for something else in my log today and noticed this:

## Log Details (WARNING)

Logger: homeassistant.components.hue.light
Source: components/hue/light.py:121
Integration: Philips Hue ([documentation](https://www.home-assistant.io/integrations/hue), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+hue%22))
First occurred: 19:08:49 (1 occurrences)
Last logged: 19:08:49

Please check for software updates of the Dining wall wash bulb in the Philips Hue App.

I had no idea there was an update available or how long it’s been available for. I also didn’t know that HA would be aware of a Hue update and log it. I didn’t get any other notification (e.g. from hue) that an update was available. I haven’t opened the Hue app in months.

Is there a way to watch the log for this message and display it in a lovelace card?

You may use conditional messages from system logs:

And I think that HA is not aware of hue updates. It is just that a recent update which fixes a security issue has been released and devs though it was nice to tell you about.

2 Likes

Aha, that’s perfect, thanks!

Hi, can someone please give an example of how to catch such a warning message in the log? I’m trying to create an automation for notify of a hue bulb sw update based on log message but I get this error:

Error while executing automation automation.create_notifications_for_hue: Error rendering data template: UndefinedError: 'dict object' has no attribute 'event'

The message in the log that I am trying to catch:

Logger: homeassistant.components.hue.light
Source: components/hue/light.py:299
Integration: Philips Hue (documentation, issues)
First occurred: 16:45:29 (1 occurrences)
Last logged: 16:45:29

Please check for software updates of the Hall bulb in the Philips Hue App.

Automation for this event:

- alias: "Notifications of a HUE update"
  trigger:
    platform: event
    event_type: system_log_event
    event_data:
      level: WARNING       
  condition:
    condition: template
    value_template: '{{ "Philips Hue App" in trigger.event.data.message }}'
  action:
    - service: notify.telegram
      data:
        message: "LOG MSG: {{ trigger.event.data.message }}."

Does anyone have an idea why this doesn’t work?

Did you set fire_event to True under system_log in your config file?

Yes, the fire_event is set to true. I don’t think that error would have occurred without that setting.

 system_log:
  fire_event: true

Ah OK I see. Missing [0] after message in trigger.event.data.message. So should be trigger.event.data.message[0] perhaps?

Good point, but this will cause the same error. I’m not sure what exactly it means: ‘dict object’ has no attribute ‘event’