Skip to content

Instantly share code, notes, and snippets.

@c4r-gists
Created February 7, 2018 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c4r-gists/562bf1d693d6b11ccbd818c34d45445c to your computer and use it in GitHub Desktop.
Save c4r-gists/562bf1d693d6b11ccbd818c34d45445c to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from time import sleep
from socket import gethostname
import cloud4rpi
# Put your device token here. To get the token,
# sign up at https://cloud4rpi.io and create a device.
DEVICE_TOKEN = '__YOUR_DEVICE_TOKEN__'
# Enable the MQTT traffic encryption (TLS).
tls = {
'ca_certs': '/etc/ssl/certs/ca-certificates.crt'
}
device = cloud4rpi.connect(DEVICE_TOKEN, tls_config=tls)
diagnostics = {
'Host Name': gethostname()
}
device.declare_diag(diagnostics)
device.publish_diag()
sleep(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment