How to resolve failed config error home assistant cloudmqtt

This is my automations.yaml code for cloudmqtt trigger
trigger:
platform: mqtt
topic: test1/1

Can you please supply more info the mqtt section and the full automations.yaml config using the code blocks (as shown in the blue box above the post) to preserve spacing and formatting.

this is the code on my configuration.yaml

group: !include groups.yaml
automation: !include automations.yaml

mqtt:
broker: m11.cloudmqtt.com
port: 12322
username: clouduser
password: cloudpass

device_tracker:
platform: owntracks

the code on my automations.yaml only have this
trigger:
platform: mqtt
topic: test1

i am trying out using this https://home-assistant.io/blog/2017/03/28/http-to-mqtt-bridge/

Well you can’t have a trigger without an action, what is the corresponding action for the trigger?

the action is just to turn on the light when i send my cloudmqtt topic test1 message is 1 and off when message is 0

I wouuld do it like this… note the spacing…

mqtt:
  broker: m11.cloudmqtt.com
  port: 12322
  username: clouduser
  password: cloudpass

device_tracker:
  platform: owntracks

group: !include groups.yaml

automation: !include automations.yaml

In automations.yaml

I would have…

 - alias: 'TestMQTT turn on lamp'
   trigger:
     - platform: mqtt
       topic: test1
       payload: '1'
   action:
     - service: homeassistant.turn_on
       entity_id: switch.your_light_entity_id

 - alias: 'TestMQTT turn off lamp'
   trigger:
     - platform: mqtt
       topic: test1
       payload: '0'
   action:
     - service: homeassistant.turn_off
       entity_id: switch.your_light_entity_id

… again note the spacing it’s very important in yaml.

That should work provided your cloud MQTT settings are correct.

oh thanks i will try it. Do i have to create the entity_id or service?

i try it and got this error

what error is this?

Please use the code blocks as shown in the blue box at the top of the post and post ALL of your config files contents.

Discover some devices automatically

discovery:

Allows you to issue voice commands from the frontend in enabled browsers

conversation:

Enables support for tracking state changes over time.

history:

View all events in a logbook

logbook:

Track the sun

sun:

Weather Prediction

sensor:
platform: yr

Text to speech

tts:
platform: google

mqtt:
broker: m11.cloudmqtt.com
port: 12463
username: clouduser
password: cloudpass

device_tracker:
platform: owntracks

group: !include groups.yaml
automation: !include automations.yaml

this is some of the content inside the config file

my error comes from automations yaml file

Yes but so far we haven’t seen all of the automations.yaml yet?

  • alias: ‘TestMQTT turn on lamp’
    trigger:

    • platform: mqtt
      topic: test1
      payload: ‘1’
      action:
    • service: homeassistant.turn_on
      entity_id: switch.your_light_entity_id
  • alias: ‘TestMQTT turn off lamp’
    trigger:

    • platform: mqtt
      topic: test1
      payload: ‘0’
      action:
    • service: homeassistant.turn_off
      entity_id: switch.your_light_entity_id

this are the code inside my automations .yaml
it is the one that u send

i get error when i restart my homeassistant

what cost this error? is it the code?or something else?

The code works error solve

  • alias: ‘TestMQTT turn on lamp’
    trigger:
    • platform: mqtt
      topic: test1
      payload: ‘1’
      action:
    • service: homeassistant.turn_on
      entity_id: switch.your_light_entity_id
  • alias: ‘TestMQTT turn off lamp’
    trigger:
    • platform: mqtt
      topic: test1
      payload: ‘0’
      action:
    • service: homeassistant.turn_off
      entity_id: switch.your_light_entity_id

now i will try on my cloudmqtt

I can’t see how that’s any different from what I posted, however it still won’t work as is, since you haven’t changed the your_light_entity_id to whatever you are trying to switch on/off. To find the entity_id you have to look in the developers tools and click the <> symbol and scroll till you find the switch/light, however unless they are auto discovered there may not be anything in there as I can’t see any defined in your config?

so i just have to change the state to either off or on on the entity id?

and also what do you mean by cant see define config?

- alias: 'TestMQTT turn off lamp'
   trigger:
     - platform: mqtt
       topic: test1
       payload: '0'
   action:
     - service: homeassistant.turn_off
       entity_id: switch.your_light_entity_id

The action part of the above code…

service: homeassistant.turn_off calls a service in HA that will attempt to turn_off the switch/light named in the following line entity_id: whatever_your_light_or_switch_is_called

In your config there are no lights/switches defined, which leads me to assume that your lights/switches are auto discovered by HA, some switches/lights can be discovered, I’m not sure which as I don’t have any, mine are all defined by me in either a switches.yaml or lights.yaml. If this is not the case where are the switches/lights defined?

How to know whether it is auto discovered?

What exactly are you trying to turn on/off?

i am trying to turn on/off a relay that connected to a light power by wemos cloudmqtt
i am using home assistant to setup my heroku so i will be able to use ifttt makerwebhook to control my relay to on/off

i have following this link: https://home-assistant.io/blog/2017/03/28/http-to-mqtt-bridge/

as of now i am trying to integrate cloudmqtt and homeassistant so it work get the heroku working

How do i define the switch/light on the config file?

Also how to check whether have i integrate home assistant with cloud mqtt?