---
description: MQTT Connection Test

metadata:
  name: MQTT Connection Test

parameters:
  mqttHost:
    type: string
    description: IP address or hostname of the MQTT broker

  mqttUsername:
    type: string
    description: Username for MQTT authentication

  mqttPassword:
    type: string
    description: Password for MQTT authentication

resources:
  mqttConnection:
    type: Cybus::Connection
    properties:
      protocol: Mqtt
      connection:
        host: !ref mqttHost
        port: 8883
        scheme: mqtts
        username: !ref mqttUsername
        password: !ref mqttPassword
        trustAllCertificates: false # choose true to allow self-signed certificates

  temperatureEndpoint:
    type: Cybus::Endpoint
    properties:
      protocol: Mqtt
      connection: !ref mqttConnection
      subscribe:
        topic: factory/line1/temperature
