save
October 22, 2024, 3:11pm
1
I have created a mqtt.yaml file in the same directory than the configuration.yaml file.
What must I write in the configuration.yaml file to run the mqtt.yaml ?
#mqtt.yaml
light:
name:"Shelly3-ch0"
unique_id:"shelly3_ch0"
payload_on:"on"
payload_off:"off"
qos:0
state_topic:"shellies/shellypro3-34987a480e54/relay/0"
command_topic:"shellies/shellypro3-34987a480e54/relay/0/command"
json_attributes_topic:"shellies/ shellypro3-34987a480e54/info"
sensor:
name:"Shelly3-input1"
unique_id:"shelly3_input1"
qos:0
expire_after:86400
state_topic:"shellies/shellypro3-34987a480e54/input_event/0"
That would be mqtt: !include mqtt.yaml
save
October 22, 2024, 3:44pm
3
Thanks for the fast answe. This message is displayed when check the configuraction in developers tool
Configuration warnings
Invalid config for 'mqtt' at configuration.yaml, line 44: expected dict 'mqtt->0->light->0', got None
Invalid config for 'mqtt' at configuration.yaml, line 44: expected dict 'mqtt->0->sensor->0', got None
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
October 22, 2024, 3:53pm
4
Hi save ,
The MQTT structure is actually a list of dicts.
MQTT breaking changes RC 2022.6 - #70 by Sir_Goodenough .
That’s how I did it.
Inside each of the yaml files I have a dict.
You can see that in my config in the link there.
Not the only way to split this, but it’s very clean and works for me.
save
October 22, 2024, 4:26pm
5
Hello
I don´t understand.
If I write the following line (your post) in configuration.yaml, which must be the name where mqtt devices are defined?
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
October 22, 2024, 5:27pm
6
Look at the examples. That’s a folder I added, and the yaml files are in those folders.
!include_dir_merge_list
looks for files in a folder.
save
October 22, 2024, 5:50pm
7
Sorry but, mqtt is a folder you created in the in the root, or in the homeassistant folder?
Regards
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
October 22, 2024, 6:03pm
8
the same folder as the configuration.yaml file.
Look at my set-up here for the full picture. Here’s another link to it.
GitHub - SirGoodenough/Home-Assistant-Config: My HA Configuration... This is what I run for production in my house. .
save
October 23, 2024, 9:27am
9
I have created these lines in configuration.yaml, following your structure, Could you help me?
mqtt:
- switch: !include_dir_merge_list mqtt/switch/
- binary_sensor: !include_dir_merge_list mqtt/binary_sensor/
And in the file /homeassistant/mqtt/switch/switch.yaml
- name:"Shelly3-example-ch0"
unique_id:"shelly3_example_0"
payload_on:"on"
payload_off:"off"
state_topic:"shellies/shellypro3-34987a480e54/relay/0"
command_topic:"shellies/shellypro3-34987a480e54/relay/0/command"
json_attributes_topic:"shellies/shellypro3-34987a480e54/info"
retain:false
payload_available:"true"
payload_not_available:"false"
This message is displayed when I check the yaml
Invalid config for 'mqtt' at mqtt/switch/switch.yaml, line 1: expected dict 'mqtt->0->switch->0', got 'name:"Shelly3-example-ch0" unique_id:"shelly3_example_0" payload_on:"on" payload_off:"off" state_topic:"shellies/shellypro3-34987a480e54/relay/0" command_topic:"shellies/shellypro3-34987a480e54/relay/0/command" json_attributes_topic:"shellies/shellypro3-34987a480e54/info" retain:false payload_available:"true" payload_not_available:"false"'
```
Troon
(Troon)
October 23, 2024, 10:24am
10
name
and unique_id
should be at the same indentation level.
Also, put a space after the key, so:
- name: "Shelly3-example-ch0"
-------^
save
October 23, 2024, 12:07pm
11
The error message is missing now. But I cannot see the mqtt entitities. How can them be discovered?
Regards
Troon
(Troon)
October 23, 2024, 12:12pm
12
Have you restarted HA?
Once you have, look for, for example, switch.shelly3_example_ch0
.
save
October 23, 2024, 1:15pm
13
Hi
I have done it 100 times. I have the shelly PRO entities running from Shelly integration, but not from mqtt.
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
October 23, 2024, 3:42pm
14
Troon:
Have you restarted HA?
I was going to say the same. After a change to this stuff you need to reload everything.
save
October 23, 2024, 3:52pm
15
As I told you. I did it. Also turning off the power. Really I don´t know what I can do.
Sir_Goodenough
((SG) WhatAreWeFixing.Today)
October 23, 2024, 4:33pm
16
Well if it looks like this, it should work…
save
October 23, 2024, 5:18pm
17
Thanks very much, but my level is not enough for this. I don´t see what you mean.
Don´t waste your time. I think I´ll look for a more easy solution than HA to control MQTT devices