Notification messages

Trying to create a notification and I am having difficulties formatting the message. I want to combine the actual time the sun sets from " ‘sun.sun’,‘next_dusk’ " and also the ambient light from a sensor " sensor.lallerod_562_orust_solar_rad ". The automation in automations.yaml reads:

- id: '1645106708654'
  alias: Notice.Low light
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.lallerod_562_orust_solar_rad
    to: '>0'
  condition: []
  action:
  - service: notify.mobile_app_peter_iphone_11
    data: message:'Solnedgång idag är {{as_timestamp(state_attr('sun.sun','next_dusk'))|timestamp_custom('%H:%M')}}
      och dagsljus värdet är nu {{states('sensor.lallerod_562_orust_solar_rad')}}
      kWh'
  mode: single

I have tested the Message code in the template tool and it works fine giving this text:
‘Solnedgång idag är 17:59 och dagsljus värdet är nu 37.19 kWh’

I cannot understand why the automation does not work
Looking at the logs I got this message:

Logger: homeassistant.components.automation.notice_low_light
Source: components/automation/init.py:514
Integration: Automation (documentation, issues)
First occurred: 17 februari 2022 16:34:10 (11 occurrences)
Last logged: 09:11:48

  • Error while executing automation automation.notice_low_light: template value is None for dictionary value @ data[‘message’]
  • Error while executing automation automation.notice_low_light: Error rendering data template: Result is not a Dictionary

message is supposed to be below data and you had only '.
It’s either "{{ states('sensor.lallerod_562_orust_solar_rad') }}" or two ' in the template '{{ states(''sensor.lallerod_562_orust_solar_rad'') }}'

- id: '1645106708654'
  alias: Notice.Low light
  description: ''
  trigger:
  - platform: state
    entity_id: sensor.lallerod_562_orust_solar_rad
    to: '>0'
  condition: []
  action:
  - service: notify.mobile_app_peter_iphone_11
    data: 
      message:"Solnedgång idag är {{as_timestamp(state_attr('sun.sun','next_dusk'))|timestamp_custom('%H:%M')}} och dagsljus värdet är nu {{states('sensor.lallerod_562_orust_solar_rad')}} kWh"
  mode: single

I see the error, my yaml code now looks like this:

alias: Notice.Low light
description: ''
trigger:
  - platform: state
    entity_id: sensor.lallerod_562_orust_solar_rad
    to: '>0'
condition: []
action:
  - service: notify.mobile_app_peter_iphone_11
    data: >-
      message:"Solnedgång idag
      är{{as_timestamp(state_attr('sun.sun','next_dusk'))|timestamp_custom('%H:%M')}}och
      dagsljus värdet är nu {{states('sensor.lallerod_562_orust_solar_rad')}}
      kWh"
mode: single

I am still getting an error:

Logger: homeassistant.components.automation.notice_low_light
Source: components/automation/__init__.py:514
Integration: Automation (documentation, issues)
First occurred: 17 februari 2022 16:34:10 (16 occurrences)
Last logged: 13:28:24

Error while executing automation automation.notice_low_light: template value is None for dictionary value @ data['message']
Error while executing automation automation.notice_low_light: Error rendering data template: Result is not a Dictionary

Have I missed something in your explanation?

I see I have missed a space between message: and "Solnedgång.. perhaps that cases an issue

Yes indeed, that was the problem… also that the “data: >-” section the >- should in fact have also been moved adjacent to the message section instead.
Thanks for your advice and help