Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. English
    3. ioBroker general
    4. RPI Pico W and MQTT Server question

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    RPI Pico W and MQTT Server question

    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      MartiMan last edited by MartiMan

      Dear all,

      For my pergola I designed a servo control to follow the sun and a "dimmer setting" that allows a percentage of the sun.

      As I have a double pergola, I also have 2 controls.
      The trigonometry calculations are done in my PLC and my 2 RPI Pico W's subscribe to each the same topic "set_angle" and publish their "status".

      Communication works as expected but in ioBroker objects, the 2 devices share identical topics.

      Screenshot 2024-08-22 130920.png

      The parameters and code I use in mPython are:

      MQTT_BROKER = "rpi4.local"
      CLIENT_ID = "pergola1"
      SUBSCRIBE_TOPIC = b"set_angle"
      PUBLISH_TOPIC1 = b"status"
      
      print(f"Begin connection with MQTT Broker :: {MQTT_BROKER}")
      mqttClient = MQTTClient(CLIENT_ID, MQTT_BROKER, keepalive=60)
      mqttClient.set_callback(sub_cb)
      mqttClient.connect()
      mqttClient.publish(PUBLISH_TOPIC1, str("Homing").encode())
      mqttClient.subscribe(SUBSCRIBE_TOPIC)
      print(f"Connected to MQTT  Broker :: {MQTT_BROKER}, and waiting for callback function to be called!")
      

      I've seen duplicate devices where each gets it's own folder with each their respective states in the ioBroker objects but no idea how to do that in this case...

      Does anyone know how to get each device into their own designated folder?
      Thanks in advance!

      M 1 Reply Last reply Reply Quote 0
      • M
        MartiMan @MartiMan last edited by MartiMan

        @martiman OK, it was a case of RTFM 😂

        SUBSCRIBE_TOPIC = b"set_angle" b"pergola1/set_angle"
        PUBLISH_TOPIC1 = b"status" b"pergola1/status"

        Solved...

        1 Reply Last reply Reply Quote 1
        • First post
          Last post

        Support us

        ioBroker
        Community Adapters
        Donate

        507
        Online

        31.7k
        Users

        79.9k
        Topics

        1.3m
        Posts

        1
        2
        231
        Loading More Posts
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes
        Reply
        • Reply as topic
        Log in to reply
        Community
        Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
        The ioBroker Community 2014-2023
        logo