keymaster icon indicating copy to clipboard operation
keymaster copied to clipboard

ISSUE: Unable to get notifications working

Open nivek1385 opened this issue 1 year ago • 13 comments

Describe the bug Pretty sure I'm just missing something on my end, but I'm not able to get notifications working. I have a keymaster__manual_notify script, but the provided template won't save (error: Message malformed: Unable to determine action @ data['sequence'][0]).

keymaster_<lockname>_manual_notify:
  mode: parallel
  sequence:
    - service: notify.mobile_app_<devicename>
      data:
        title: "{{ title }}"
        message: "{{ message }}"

Environment (please complete the following information):

  • OS: HassOS
  • Type of system that HA is running on: RPi
  • Home Assistant version: Been happening for quite some time, but currently on 2025.1.4 Core, 2024.12.3 Supervisor, 14.2 OS)
  • Core
  • Component version: v0.0.99
  • Z-Wave integration name: zwave_js
  • Lock make and model: Kwikset 910

Logs

2025-02-03 12:28:44.795 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration keymaster which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2025-02-03 12:50:31.064 ERROR (MainThread) [homeassistant.components.script.keymaster_<lockname>_manual_notify] keymaster_<lockname>_manual_notify: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:31.065 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] keymaster_<lockname> Lock Notifications: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:31.066 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] Error while executing automation automation.keymaster_<lockname>_lock_notifications: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:35.553 ERROR (MainThread) [homeassistant.components.script.keymaster_<lockname>_manual_notify] keymaster_<lockname>_manual_notify: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:35.554 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] keymaster_<lockname> Lock Notifications: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:35.555 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] Error while executing automation automation.keymaster_<lockname>_lock_notifications: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.196 ERROR (MainThread) [homeassistant.components.script.keymaster_<lockname>_manual_notify] keymaster_<lockname>_manual_notify: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.196 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] keymaster_<lockname> Lock Notifications: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.197 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] Error while executing automation automation.keymaster_<lockname>_lock_notifications: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.562 ERROR (MainThread) [homeassistant.components.script.keymaster_<lockname>_manual_notify] keymaster_<lockname>_manual_notify: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.563 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] keymaster_<lockname> Lock Notifications: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 12:50:53.564 ERROR (MainThread) [homeassistant.components.automation.keymaster_<lockname>_lock_notifications] Error while executing automation automation.keymaster_<lockname>_lock_notifications: Error rendering data template: UndefinedError: 'trigger' is undefined
2025-02-03 14:13:22.761 WARNING (MainThread) [homeassistant.helpers.frame] Detected that custom integration 'keymaster' sets option flow config_entry explicitly, which is deprecated at custom_components/keymaster/config_flow.py, line 104: self.config_entry = config_entry. This will stop working in Home Assistant 2025.12, please create a bug report at https://github.com/FutureTense/keymaster/issues

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here. Please add emails in plain/text format if possible and applicable.

nivek1385 avatar Feb 03 '25 19:02 nivek1385

You are to replace the stuff in <> with your entries.

firstof9 avatar Feb 03 '25 21:02 firstof9

You are to replace the stuff in <> with your entries.

Yes, I know that. I was redacting the actual device names.

nivek1385 avatar Feb 03 '25 21:02 nivek1385

Seems that you have placed the notification under the automations rather than scripts so it's expecting a trigger.

firstof9 avatar Feb 04 '25 02:02 firstof9

Image

No, it's in scripts, not automations.

nivek1385 avatar Feb 04 '25 03:02 nivek1385

Make sure the names match.

firstof9 avatar Feb 04 '25 13:02 firstof9

As in the name of the script? I only have the one manual_notify script. It can be seen in the logs I pasted above. Here is a snippet showing it:

2025-02-03 12:50:53.562 ERROR (MainThread) [homeassistant.components.script.keymaster_<lockname>_manual_notify] keymaster_<lockname>_manual_notify: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'trigger' is undefined

nivek1385 avatar Feb 04 '25 15:02 nivek1385

Check the automation to make sure the trigger populated correctly.

firstof9 avatar Feb 04 '25 15:02 firstof9

What should it look like?

nivek1385 avatar Feb 04 '25 16:02 nivek1385

Depends on which one's firing, but here's an example:

  - alias: keymaster_frontdoor Lock Notifications
    id: keymaster_frontdoor Lock Notifications
    trigger:
      platform: event
      event_type: keymaster_lock_state_changed
      event_data:
        lockname: frontdoor
...

firstof9 avatar Feb 04 '25 17:02 firstof9

This is what was setup back when I added the integration a year or so ago:

alias: keymaster_<lockname> Lock Notifications
triggers:
  - event_type: keymaster_lock_state_changed
    event_data:
      lockname: <lockname>
    trigger: event
conditions:
  - condition: state
    entity_id: input_boolean.<lockname>_lock_notifications
    state: "on"
actions:
  - data_template:
      title: <lockname>
      message: >-
        {{ trigger.event.data.action_text }} {% if trigger.event.data.code_slot
        > 0 %}({{ trigger.event.data.code_slot_name }}){% endif %}
    action: script.keymaster_<lockname>_manual_notify

nivek1385 avatar Feb 04 '25 18:02 nivek1385

For some reason your trigger isn't being defined. What version of HA?

Edit: nm I see you're running 2025.1.x, no idea why your trigger is broken.

firstof9 avatar Feb 04 '25 19:02 firstof9

Any ideas on how to fix it?

nivek1385 avatar Feb 04 '25 19:02 nivek1385

Nope

firstof9 avatar Feb 04 '25 19:02 firstof9