Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Automation errors #35

Closed
jone9618 opened this issue Nov 5, 2021 · 10 comments
Closed

Automation errors #35

jone9618 opened this issue Nov 5, 2021 · 10 comments
Labels
🕙 awaiting feedback Waiting for an answer from the questioner

Comments

@jone9618
Copy link

jone9618 commented Nov 5, 2021

Hello

I installed this package a few days ago - just after I upgraded to HA 2021.11.

All works well - great work. Only issue is that I get the following error on the card when displaying the automations:

image

I have used the landroid.yaml and landroid_en.yaml from github.

When I try to run either of the two "missing" automations from the automations dashboard in HA I have errors returned in my log, such as:

Error while executing automation automation.mower_status_notificaion: Error rendering data template: UndefinedError: 'dict object' has no attribute 'from_state'
15:38:19 – (ERROR) Automation
Mower status notification: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'from_state'
15:38:19 – (ERROR) Automation
Template variable error: 'dict object' has no attribute 'from_state' when rendering '{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ states('sensor.date_time') }}'
15:38:19 – (ERROR) helpers/template.py - message first occurred at 15:38:18 and shows up 2 times
Error while executing automation automation.mower_error_notificaion: Error rendering data template: UndefinedError: 'dict object' has no attribute 'from_state'
15:38:18 – (ERROR) Automation
Mower error notification: Error executing script. Error for call_service at pos 1: Error rendering data template: UndefinedError: 'dict object' has no attribute 'from_state'
15:38:18 – (ERROR) Automation

This is the section of my landroid.yaml which defines the two automations:

# Automations #######################################################
automation:
  - id: mower_notify_status
    alias: Mower status notificaion
    initial_state: false
    trigger:
      - platform: state
        entity_id: sensor.landroid_mower_status

    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"

    action:
      - service: persistent_notification.create
        data:
          title: 🏎️ Lanroid M500
          message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ states('sensor.date_time') }}"

  - id: mower_notify_error
    alias: Mower error notificaion
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.landroid_mower_error

    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"

    action:
      - service: persistent_notification.create
        data:
          title: 🏎️ Lanroid M500
          message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ states('sensor.date_time') }}"

(as an aside - there is a typo in the alias of both automations - "notificaion" instead of of "notification")

Am I doing something wrong?

@Barma-lej
Copy link
Owner

Copy these lines from your Lovelace:

        - type: custom:fold-entity-row
          head:
            type: section
            label: Automatisierungen
          entities:
            - entity: automation.mower_notify_error
            - entity: automation.mower_notify_status
            - entity: automation.mower_sync_values

and past here

@Barma-lej Barma-lej added the ⚠️ invalid This doesn't seem right label Nov 6, 2021
@jone9618
Copy link
Author

jone9618 commented Nov 7, 2021

These are the lines from my lovelace:

    - type: custom:fold-entity-row
      head:
        type: section
        label: Automations
      entities:
        - entity: automation.mower_notify_error
        - entity: automation.mower_notify_status
        - entity: automation.mower_sync_values

@Barma-lej
Copy link
Owner

Barma-lej commented Nov 8, 2021

I checked package again andI cannot confirm the error. Could you post your landroid.yaml, landroid_en.yaml and lovelace card?

@timvdsm
Copy link

timvdsm commented Dec 5, 2021

I have the same problem, was there any root-cause know? Many thanks for your hard work!

@Barma-lej
Copy link
Owner

Change aliases to

  - id: mower_notify_status
    alias: Mower Notify Status

and

  - id: mower_notify_error
    alias: Mower Notify Error
automation:
  - id: mower_notify_status
    alias: Mower Notify Status
    initial_state: false
    trigger:
      - platform: state
        entity_id: sensor.landroid_mower_status

    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"

    action:
      - service: persistent_notification.create
        data:
          title: 🏎️ Lanroid M500
          message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ states('sensor.date_time') }}"

  - id: mower_notify_error
    alias: Mower Notify Error
    initial_state: true
    trigger:
      - platform: state
        entity_id: sensor.landroid_mower_error

    condition:
      - condition: template
        value_template: "{{ trigger.to_state.state != trigger.from_state.state }}"

    action:
      - service: persistent_notification.create
        data:
          title: 🏎️ Lanroid M500
          message: "{{ trigger.from_state.state }} -> {{ trigger.to_state.state }} - {{ states('sensor.date_time') }}"

@Barma-lej Barma-lej added 🕙 awaiting feedback Waiting for an answer from the questioner and removed ⚠️ invalid This doesn't seem right labels Dec 20, 2021
@jone9618
Copy link
Author

jone9618 commented Jan 1, 2022 via email

@Barma-lej
Copy link
Owner

Barma-lej commented Jan 1, 2022

What are your automation.mower * in the Developer Tools - States?

@jone9618
Copy link
Author

jone9618 commented Jan 3, 2022 via email

@Barma-lej
Copy link
Owner

You have three automations for mower

  • automation.mower_error_notificaion
  • automation.mower_status_notificaion
  • automation.mower_sync_values

Rename these two

  • automation.mower_error_notificaion
  • automation.mower_status_notificaion

to

  • automation.mower_notify_error
  • automation.mower_notify_status

or change in your lovelace card these lines

        - type: custom:fold-entity-row
          head:
            type: section
            label: Automations
          entities:
            - entity: automation.mower_notify_error
            - entity: automation.mower_notify_status
            - entity: automation.mower_sync_values

to

        - type: custom:fold-entity-row
          head:
            type: section
            label: Automations
          entities:
            - entity: automation.mower_error_notificaion
            - entity: automation.mower_status_notificaion
            - entity: automation.mower_sync_values

@jone9618
Copy link
Author

jone9618 commented Jan 4, 2022 via email

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🕙 awaiting feedback Waiting for an answer from the questioner
Projects
None yet
Development

No branches or pull requests

3 participants