Created
February 7, 2018 16:32
-
-
Save c4r-gists/562bf1d693d6b11ccbd818c34d45445c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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