Lots of errors in ha core check

Have/had a fine running homeassistant. After sucessfully implemented a handfull of lights via MQTT I tried to implement some automation, before ha core check runs without any errors. My version is 2021.1.4 After adding some lines in automations.yaml I did a check again and I got lot of errors and the default includes in configuration.yaml had been marked with a “!”. I remove the “!” and removed all my changes in automation. Then I did a check again and things got worst.`root@hass:~# ha core check
Error: Testing configuration at /config
ERROR:homeassistant.helpers.check_config:Unexpected error validating config
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/check_config.py”, line 145, in async_check_ha_config_file
await config_validator.async_validate_config( # type: ignore
File “/usr/src/homeassistant/homeassistant/components/script/config.py”, line 44, in async_validate_config
for object_id, cfg in config[DOMAIN].items():
AttributeError: ‘str’ object has no attribute ‘items’
ERROR:homeassistant.config:Invalid config for [automation]: expected dictionary. Got OrderedDict([(‘frontend’, {}), (‘updater’, {‘include_used_components’: False, ‘reporting’: True}), (‘sun’, {}), (‘group’, ‘include groups.yaml’), (‘automation’, ‘include automations.yaml’), (‘script’, ‘include scripts.yaml’), (‘mqtt’, OrderedDict([(‘discovery’, False), (‘broker’, ‘localhost’), (‘port’, 1883)]))]). (See ?, line ?).
ERROR:homeassistant:Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/core.py”, line 1393, in async_call
raise ServiceNotFound(domain, service) from None
homeassistant.exceptions.ServiceNotFound: Unable to find service persistent_notification.create
Failed config
group:
- Invalid config for [group]: expected a dictionary for dictionary value @ data[‘group’]. Got ‘include groups.yaml’. (See ?, line ?).
- automation: include automations.yaml
frontend: ?
group: include groups.yaml
mqtt: [source /config/configuration.yaml:24]
broker: localhost
discovery: False
port: 1883
scene: include scenes.yaml
script: include scripts.yaml
sun: ?
switch: [source /config/configuration.yaml:29]
- platform: mqtt
command_topic: command/Wohnung/Licht/AZ1
name: Arbeitszimmer Licht 1
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/AZ1
- platform: mqtt
command_topic: command/Wohnung/Licht/AZ2
name: Arbeitszimmer Licht 2
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/AZ2
- platform: mqtt
command_topic: command/Wohnung/Licht/Flur1
name: Flur Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/Flur1
- platform: mqtt
command_topic: command/Wohnung/Licht/Flur2
name: Abstellraum Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/Flur2
- platform: mqtt
command_topic: command/Wohnung/Licht/Bad
name: Bad Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/Bad
- platform: mqtt
command_topic: command/Wohnung/Licht/SZ
name: Schlafzimmer Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/SZ
- platform: mqtt
command_topic: command/Wohnung/Licht/EZ
name: Esszimmer Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/EZ
- platform: mqtt
command_topic: command/Wohnung/Licht/WZ1
name: Wohnzimmer Licht
payload_off: OFF
payload_on: ON
qos: 1
state_topic: state/Wohnung/Licht/WZ1
updater: ?
weather: [source /config/configuration.yaml:109]
- platform: openweathermap
api_key: 3031e5f6cbdf193692cb50b258aafb46

script:
- Unexpected error calling config validator: ‘str’ object has no attribute ‘items’
- include scripts.yaml

scene:
- Invalid config for [scene]: expected a dictionary @ data[‘states’][0]. Got None. (See ?, line ?).
- automation: include automations.yaml
frontend: ?
group: include groups.yaml
mqtt: [source /config/configuration.yaml:24]
broker: localhost
discovery: False
port: 1883
script: include scripts.yaml
sun: ?
updater: ?

Successful config (partial)
group:
script:
scene:

root@hass:~# ’
A lot off errors I do not understand
All the mqtt thing in configuration. yaml works still fine as I did not restart hass.

I also have nothing changed in configuration.yam than removeing the “!” in the includes
Realy need help!
Thanks
Rainer

Why did you remove the ! ? they are necessary to include yaml files.

I think that was the problem. Did not realize them before so I thougt HA wrote them in while checking. Check works fine again even with rewriten automations.yaml. Everything works again but not the automation,

Still looking fo an automations sample that publish an mqtt topic trigered by sunraise or sunset.

Thanks Rainer

Sorry still a novice in HA

alias: 'publish on sunrise'
description: ''
  - platform: sun
    event: sunrise
condition: []
action:
  - service: mqtt.publish
    data:
      topic: <insert topic here>
      payload: <insert payload here>
mode: queued
max: 10

You’re welcome …

Great thank you very much
Rainer