In this training, you will learn the basics of the Internet of Things. In this part, you will learn how to customize a dashboard to be able to visualize sensor data.

Send random data to the dashboard

import time
import random
import requests
from requests.structures import CaseInsensitiveDict

url = "https://demo.thingsboard.io/api/v1/your_divice_token/telemetry/"
headers = CaseInsensitiveDict()
headers["Content-Type"] = "application/json"

while True:
    temp = random.randrange(70)
    print(temp)
    data = {"temperature": temp}
    resp = requests.post(url, headers=headers, data=str(data))
    time.sleep(5)
    

 

0 comment

There are no comments yet.

Log in to leave a reply

Related posts

An Internet of Things Training Part 1: Getting Started

13/2/2022

Internet of Things Training Part 2: Programming of Raspberry PI GPIO

13/2/2022

Internet of Things Training Part 3: ThingsBoard IoT platform

14/2/2022