title: Connect local Mosquitto MQTT broker to Google Cloud IoT
body: <p>In  my current setup i read data using <code>ebusd</code> from my heating system which works perfectly fine. In the next step i'd like to send this data to a Google IoT Core Device. Unfortunately <code>ebusd</code> does not support setting the <code>clientid</code> externally.</p>
  
  <p>To circumvent this i installed a local Mosquitto Broker which accepts unsecured messages in my Raspberry Pi and shall bridge them to the Google IoT Core Broker. Here is how i configured my local Mosquitto Broker:</p>
  
  <pre><code># Place your local configuration in /etc/mosquitto/conf.d/
  #
  # A full description of the configuration file is at
  # /usr/share/doc/mosquitto/examples/mosquitto.conf.example
  
  pid_file /var/run/mosquitto.pid
  
  persistence true
  persistence_location /var/lib/mosquitto/
  
  log_type all
  log_dest file /var/log/mosquitto/mosquitto.log
  
  # Goolge IoT Core Configuration
  
  connection bridge-to-gcp
  
  address mqtt.googleapis.com:8883
  
  bridge_attempt_unsubscribe false
  bridge_certfile /home/pi/certificates/rsa_cert.pem
  bridge_keyfile /home/pi/certificates/rsa_private.pem
  bridge_cafile /home/pi/certificates/roots.pem
  bridge_protocol_version mqttv311
  bridge_insecure false
  
  tls_version tlsv1.2
  try_private true
  
  start_type automatic
  cleansession true
  notifications false
  
  local_clientid local-to-remote-gcp-bridge
  
  remote_username unused
  remote_password &lt;JWT Token generated using jwt.io&gt;
  remote_clientid projects/project-251313/locations/europe-west1/registries/prot/devices/ebusd12345
  
  topic # both
  
  include_dir /etc/mosquitto/conf.d
  </code></pre>
  
  <p>Although this setup works with AWS IoT with Google Cloud IoT i get</p>
  
  <pre><code>1542622526: Connecting bridge bridge-to-gcp (mqtt.googleapis.com:8883)
  1542622526: Bridge projects/project-251313/locations/europe-west1/registries/prot/devices/ebusd12345 sending CONNECT
  1542622526: Socket error on client local.projects/project-251313/locations/europe-west1/registries/prot/devices/ebusd12345, disconnecting.
  </code></pre>
  
  <p>After googling some time i found this blog (see <a href="http://community.onion.io/topic/2858/omega-onion-connecting-to-cloud-cloud-iot/2" rel="nofollow noreferrer">http://community.onion.io/topic/2858/omega-onion-connecting-to-cloud-cloud-iot/2</a>) which states that Google Cloud IoT Core does not support connections by "sub-brokers" but i didn't find a second statement claiming the same.</p>
  
  <p>Can anybody either confirm that i am trying to do something impossible or please help with with configuring the broker properly?</p>