Help setting mqtt setupt correctly

I’m new to using homeassistant anywhere. I have am having issues in my automation, I’d like to know that my mqtt is setup properly, in case I might have missed something.
Running
hass --script check_config
this, doesn’t show any errors.
What I’ve done is installed library paho-mqtt and this is the python script that I run with nohup via ssh.
import RPi.GPIO as GPIO
import picamera
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish
import argparse
import signal
import sys
import time
import logging
import datetime

### camera
camera = picamera.PiCamera()
camera.vflip=True

#mqtt
broker = '192.168.0.103'
topic = 'dev/test'
mqttQos = 0
mqttRetained = False

# setup for taking input from switch
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down = GPIO.PUD_UP)
prev_input = 0

def on_connect(client, userdata, flags, rc):
   print("Connected with result code "+str(rc))
   client.subscribe(topic)
# The callback for when a PUBLISH message is received from the server.
#
def on_message(client, userdata, msg):
   payload = str(msg.payload.decode('ascii'))  # decode the binary string
   print(msg.topic + " " + payload)
   process_trigger(payload)

client = mqtt.Client()
client.on_connect = on_connect    # call these on connect and on message
client.on_message = on_message
client.username_pw_set(username='pi',password='user_pass')  # need this
client.connect(broker)
client.loop_start()    #  run in background and free up main thread

def post_image():
   print('Taking photo')
   camera.capture('image.jpg')
   file_name = 'image_' + str(datetime.datetime.now()) + '.jpg'
   camera.capture(file_name)  # time-stamped image # create an object for this file and then pass the object here
   with open('image.jpg', "rb") as imageFile:
       myFile = imageFile.read()
       data = bytearray(myFile)
   client.publish('dev/camera', data, mqttQos, mqttRetained)  #
   client.publish('dev/test', 'Capture!')
   print(file_name + 'image published')


while True:
        input = GPIO.input(17)
        if ((not prev_input) and input):
            post_image()
            time.sleep(2)
        prev_input = input
        time.sleep(0.2)

and this is my configuration.yaml.

notify:
    - platform: telegram
      name: telegram
      chat_id: xxxxxxxx

telegram_bot:
  - platform: polling
    api_key: yyyyyyyyyyy:some_thing_somet_hing_here.
    allowed_chat_ids:
      - xxxxxxxxxxx

mqtt:
#this is empty here

automation:
    - alias: Doorbell_pressed_automation
      trigger:
        platform: mqtt
        topic: dev/test
        payload: 'Capture!'
      action:
        - service: automation.turn_off
          entity_id: automation.doorbell_pressed_automation
        - service: script.turn_on
          entity_id: script.doorbell_pressed_script
        - delay: "00:00:5"
        - service: automation.turn_on
          entity_id: automation.doorbell_pressed_automation

script:
    doorbell_pressed_script:
      alias: 'notify me'
      sequence:
        - service: notify.telegram
          data:
            title: Home Assistant Notification
            message: --Doorbell Pressed--
            data:
              photo:
                - url: http://192.168.0.103/images/image.jpg
                  caption: Doorbell View
    dev_publish_on_script:
      sequence:
        - service: mqtt.publish
          data: {"topic":"dev/test", "payload":"ON"}
    test_telegram:
        alias: 'test_telegram'
        sequence:
          - service: notify.telegram
            data:
              title: TEST Message
              message: 'This is a test!'
              data:
                photo:
                  - url: http://192.168.0.103/images/image.jpg

I think the username and password you need here is HA username and password as specified here, rather than the pi versions.

Yes, I think that was it. I missed that completely. Thanks