MQTT module error

ERROR (MainThread) [homeassistant.config] Invalid config for [mqtt]: expected a dictionary for dictionary value @ data[‘mqtt’]. Got ‘broker:192.168.1.113 port:1883 client_id:homeassistant username:username password:password’. (See ?, line ?)

my config yaml is the follwing for Mqtt

mqtt:
broker:192.168.1.113
port:1883
protocol:3.1.1
user:cclckc
password:3673
websocket port:8080

I can successfully send Mqtt messages between two puddy instances…but I am a newbie!

Can you post your code again, but this time format it using </> for better readability?

yaml is VERY white-space dependent.
You need 2 spaces before each of the mqtt lines like this:

mqtt:
  broker:192.168.1.113
  port:1883
  protocol:3.1.1
  user:cclckc
  password:3673
  websocket port:8080
mqtt:
  broker:192.168.1.113
  port:1883
  protocol:3.1.1
  user:cclckc
  password:3673
  websocket port:8080

any reference to mgtt: in my config yaml makes it invalid even just

mqtt:

with nothing else gives me the same error and I thought the built in broker would kick in but no love.

Thank you in advance for any assistance! much appreciated!

post the rest of your configuration.yaml, and I’ll see if I can see the problem.

homeassistant:
  # Name of the location where Home Assistant is running
  name: Home
  # Location required to calculate the time the sun rises and sets
  latitude: ********
  longitude: *********
  # Impacts weather/sunrise data (altitude above sea level in meters)
  elevation: 0
  # metric for Metric, imperial for Imperial
  unit_system: imperial
  # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  time_zone: America/Los_Angeles

# Show links to resources in log and frontend
introduction:

# Enables the frontend
frontend:

# Enables configuration UI
config:

http:
  # Uncomment this to add a password (recommended!!)
  # api_password: PASSWORD
  # Uncomment this if you are using SSL or running in Docker etc
  # base_url: example.duckdns.org:8123

# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:

# 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:

switch:
  platform: rpi_rf
  gpio: 17
  switches:
    outlet01:
      protocol: 1
      pulselength: 186
      code_on: 4281651
      code_off: 4281660
      signal_repetitions: 20
    outlet02:
      protocol: 1
      pulselength: 186
      code_on: 4281795
      code_off: 4281804
      signal_repetitions: 20
    outlet03:
      protocol: 1
      pulselength: 186
      code_on: 4282115
      code_off: 42821124
      signal_repetitions: 20
    outlet04:
      protocol: 1
      pulselength: 186
      code_on: 4283651
      code_off: 4283660
      signal_repetitions: 20
    outlet05:
      protocol: 1
      pulselength: 186
      code_on: 4289795
      code_off: 4289804
      signal_repetitions: 20
    outlet_A: 
      code_off: 8797958
      code_on: 8797960
      protocol: 1
      pulselength: 307
      signal_repetitions: 20
    outlet_ALL: 
      code_off: 8797962
      code_on: 8797961
      protocol: 1
      pulselength: 307
      signal_repetitions: 20
    outlet_B: 
      code_off: 8797953
      code_on: 8797954
      protocol: 1
      pulselength: 307
      signal_repetitions: 20
    outlet_C: 
      code_off: 8797955
      code_on: 8797965
      protocol: 1
      pulselength: 307
      signal_repetitions: 20
    outlet_D: 
      code_off: 8797956
      code_on: 8797964
      protocol: 1
      pulselength: 307
      signal_repetitions: 20
    outlet_E: 
      code_off: 8797959
      code_on: 8797957
      protocol: 1
      pulselength: 307
      signal_repetitions: 20


      
      
      
      # Weather Prediction
sensor:
  platform: yr
  
 
  
device_tracker:
  - platform: nmap_tracker
    hosts: ****************
    home_interval: 10
    exclude: 192.168.1.113, 192.168.1.111, 192.168.1.222, 1923.168.1.1
    track_new_devices: yes
    consider_home: 180


notify:
  - name: NOTIFIER_PUSHBULLET
    platform: pushbullet
    api_key: ****************


#Text to speech
tts:
  platform: google

  
  
  
group: !include groups.yaml

automation: !include automations.yaml

mqtt:
  broker:192.168.1.113
  port:1883
  protocol:3.1.1
  user:cclckc
  password:3673
  websocket port:8080
complete error log included

Configuration Validation
Validate your configuration if you recently made some changes to your configuration and want to make sure that it is all valid.
Configuration invalid.CHECK CONFIG
Testing configuration at /home/homeassistant/.homeassistant
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up introduction
2018-01-13 08:31:57 ERROR (MainThread) [homeassistant.config] Invalid config for [mqtt]: expected a dictionary for dictionary value @ data['mqtt']. Got 'broker:192.168.1.113 port:1883 client_id:homeassistant username:username password:password'. (See ?, line ?). Please check the docs at https://home-assistant.io/components/mqtt/
2018-01-13 08:31:57 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Invalid config.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up recorder
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up http
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain introduction took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up history
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up api
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up system_log
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up frontend
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up group
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up sensor
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up sun
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up updater
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up discovery
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up notify
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up zone
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.1 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 0.1 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.1 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain updater took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain discovery took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up config
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up logbook
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up conversation
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up tts
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain zone took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up switch
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up automation
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain conversation took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setting up device_tracker
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain switch took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
2018-01-13 08:31:57 INFO (MainThread) [homeassistant.setup] Setup of domain device_tracker took 0.0 seconds.
Failed config
  mqtt: 
      b
      r
      o
      k
      e
      r
      :
      1
      9
      2
      .
      1
      6
      8
      .
      1
      .
      1
      1
      3
       
      p
      o
      r
      t
      :
      1
      8
      8
      3
       
      c
      l
      i
      e
      n
      t
      _
      i
      d
      :
      h
      o
      m
      e
      a
      s
      s
      i
      s
      t
      a
      n
      t
       
      u
      s
      e
      r
      n
      a
      m
      e
      :
      u
      s
      e
      r
      n
      a
      m
      e
       
      p
      a
      s
      s
      w
      o
      r
      d
      :
      p
      a
      s
      s
      w
      o
      r
      d

  General Errors: 
    - Setup failed for mqtt: Invalid config.

Successful config (partial)
  mqtt:

You need a space between the colon and the item.

1 Like
thank you but same error even with 
mqtt:
  broker: 192.168.1.113
  port: 1883
  protocol: 3.1.1
  user: cclckc
  password: 3673
  websocket port: 8080

ERROR (MainThread) [homeassistant.config] Invalid config for [mqtt]: expected a dictionary for dictionary value @ data['mqtt']. Got 'broker:192.168.1.113

I put your config into my test system. Replaced the lines with the *****, I also had to remove groups and automations because you use files that I don’t have.

Then I can see the problems with your MQTT config.

you need a space between the : and the value on the config lines as already identified by @anon43302295
You also have user, which is not supported. I replaced it with username.
You also have websocket port which is not supported. I don’t know what to do with that.
But this mqtt code works in my test system (works in that it passes the config check)

mqtt:
  broker: 192.168.1.113
  port: 1883
  protocol: 3.1.1
  username: cclckc
  password: 3673
 mqtt:
  broker: 192.168.1.113
  port: 1883
  protocol: 3.1.1
  username: cclckc
  password: 3673

Thank You so much but even with those changes I get the same error. gotta walk away for now.

the best thing to do might be to just re-type in the information.

sometimes copy/paste puts extra stuff in where you don’t see it.

and a big one is TO NOT PUT IN USERNAMES AND PASSWORDS IN THE PUBLIC FORUM!

:grin:

In this last code snippet you have single space indentation. Two spaces are needed.

There is still no space after the colon according to that error message. Did you save the file and restart homeassistant?

The correct code is:

mqtt:
  broker: 192.168.1.113
  port: 1883
  protocol: 3.1.1
  username: someuser
  password: somepass

Save the file and restart!