Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep getting error: "Message malformed: extra keys not allowed @ data['automation']" when trying to save automation #25

Open
nielssteenvoorde opened this issue Jan 14, 2024 · 6 comments

Comments

@nielssteenvoorde
Copy link

nielssteenvoorde commented Jan 14, 2024

I was getting United Consumers working within HACS. This is working oke. Than I added in configuration.yaml the sensor:

sensor:
 - platform: brandstofprijzen

Did try the extensive sensor too.

sensor:
  - platform: brandstofprijzen
    monitored_variables:
      - euro95
      - diesel
      - lpg
      - super
      - super_mlv
      - premium_benzines
      - premium_diesels
    icon: mdi:gas-station
    unit_of_measurement: €/L
    prefix: Adviesprijs
    scan_interval:
        hours: 1

Didn't work either.

Restarted HA after adjustment. After this I wanted to add the automation (changed automation screen to yaml) and paste the text:

automation:
  - alias: "Melding bij gewijzigde brandstofprijzen"
    id: brandstofprijzen_update_notification
    description: >
      Send notification when a fuel price changed
    trigger:
      - platform: state
        entity_id:
          - sensor.adviesprijs_euro95
          - sensor.adviesprijs_diesel
          - sensor.adviesprijs_lpg
          - sensor.adviesprijs_super
          - sensor.adviesprijs_super_mlv
          - sensor.adviesprijs_premium_benzines
          - sensor.adviesprijs_premium_diesels
    condition: "{{ trigger.state.to_state != trigger.state.from_state }}"
    action:
      - service: notify.notify
        data:
          title: Adviesprijs gewijzigd
          message: >
            De adviesprijs voor
            {{ state_attr(trigger.entity_id, 'friendly_name') }}
            is
            {% if trigger.state.to_state > trigger.state.from_state %}
              verhoogd.
            {% else %}
              verlaagd.
            {% endif %}
    mode: queued

When wanted to save the automation I'll keep getting the message:

Message malformed: extra keys not allowed @ data['automation']

In log files there are no clues

The HA is running on a RPI4 from an SSD stick

Core: 2024.1.3
Supervisor: 2023.12.0
Operating System: 11.4
Frontend: 20240104.0

Editing in Chrome browser on a Windows 11 machine

Strange thing is happening for the other fuel addon: dutch gas prices too. I don't get it. Is it because of the new version of HA that the functionality data doesn't work anymore?

@metbril
Copy link
Owner

metbril commented Jan 14, 2024

Hi. What version of the United Consumers integration are you using?

To be able to help you troubleshoot, you should edit your issue and put 3 backticks (```) both before and after your configuration.

Are there any errors when you check you configuration?

@nielssteenvoorde
Copy link
Author

nielssteenvoorde commented Jan 14, 2024

I'm using v0.4 of United Consumers.

I think I now put the backticks in the wright way ;-)

@metbril
Copy link
Owner

metbril commented Jan 14, 2024

From the error message it looks like you added the line "automation:" where you shouldn't. If you paste the automation in the automation editor you should leave that line out. You can have it only once in the file at the top.

@nielssteenvoorde
Copy link
Author

nielssteenvoorde commented Jan 14, 2024

From the error message it looks like you added the line "automation:" where you shouldn't. If you paste the automation in the automation editor you should leave that line out. You can have it only once in the file at the top.

Is not working.

first step:
United Consumers toevoegen automation

second step:
United Consumers bewerking YAML

third step (without automation:):
United Consumers (excl automation)

third step (with automation:)
United Consumers (incl automation)

Both methods give the same error message:

Message malformed: extra keys not allowed @ data['automation']

I still can't get it to work. Does it had something to do with the new version of HA that skipped "data" perhaps?

@metbril
Copy link
Owner

metbril commented Jan 14, 2024

Please try to replace the hyphen before "alias" with a space. The automation should be left aligned without any leading hyphens. Open one of your other automations as yaml to see what I mean.

@nielssteenvoorde
Copy link
Author

nielssteenvoorde commented Jan 17, 2024

I think it now works. I did change the automation text in:

alias: Melding bij gewijzigde brandstofprijzen
description: |
  Send notification when a fuel price changed
trigger:
  - platform: state
    entity_id:
      - sensor.adviesprijs_euro95
      - sensor.adviesprijs_diesel
      - sensor.adviesprijs_lpg
      - sensor.adviesprijs_super
      - sensor.adviesprijs_super_mlv
      - sensor.adviesprijs_premium_benzines
      - sensor.adviesprijs_premium_diesels
condition:
  - condition: template
    value_template: "{{ trigger.state.to_state != trigger.state.from_state }}"
action:
  - service: notify.notify
    data:
      title: Adviesprijs gewijzigd
      message: >
        De adviesprijs voor {{ state_attr(trigger.entity_id, 'friendly_name') }}
        is {% if trigger.state.to_state > trigger.state.from_state %}
          verhoogd.
        {% else %}
          verlaagd.
        {% endif %}
mode: queued

Now hoping for lower prices here in the Netherlands ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants