Precision Thermometer Products Articles - Health Care Application Notes

Isotel Precision Universal Thermometer

Isotel Precision Cross-Platform Software · IDM

Check Your Thyroid Gland - The Core of Your Vitality Isotel Precision Thermometer - Hello MQTT

Isotel Precision Thermometer - Hello MQTT¶

Measure Anything

A High Performance Pocket USB Thermometer for Personal & Medical, Lab & Industrial, everyday use, made out of safe and non-toxic materials.

Here we represent small piece of python code which publishes the Thermometer readings to MQTT Broker.

This example also shows a concept of post-processors, inserted between the IDM and the MQTT broker, which could in combination with other sensors do some more intelligent processing (as AI).

The Demo¶

The demo Hello-MQTT.ipynb is written in Jupyter Notebooks:

GettingStarted

Hello MQTT¶

In this application note IoT#180 you will learn how to retrieve in-time updates from Thermometer and pushing them to MQTT Broker.

In [ ]:
import paho.mqtt.client as mqtt
from isotel.idm import gateway

idm = gateway.Group()
ipt = gateway.Device(idm, brand_filter='Isotel Precision Thermometer')

client = mqtt.Client("ipy-hellomqtt-1")
client.connect("my.isotel")

T = {}
T['time'] = idm.time()
while True:
T = ipt.get('T', until=float(T['time']) + 2)
print(T['T']['value'] + ' ' + T['T']['unit'], end='\r')
client.publish("test/thermometers/uros", T['T']['value'])


Start the Mosquitto server or use one of the freely available ones, plug-in the thermomter, start the IDM, modify the client.connect() address of selected broker, topic under client.publish(), and simply run the cell. The samples will be pushed to the broker once per second, which may be observed and plotted by the mqtt-spy.

In this simple example we only push the data, for which reason we do not setup any callbacks, neither we subscribe to any topic.

Notes:¶

• The ipt = gateway.Device(idm, brand_filter=’Isotel Precision Thermometer’) will search for the first thermometer starting with the Isotel Precision Thermometer name, and assign the object to ipt. Whether there are more thermometers in the system, they could be listed with idm.get_device_list() and proper full name used as gateway.Device(idm, ‘ … full name … ‘)
• T = ipt.get(‘T’, until=float(T[‘time’]) + 2) takes T[‘time’] as absolute UTC incremented for 2 seconds. In combination with the until parameter IDM waits and return the first next sample until given maximum time is reached. If sample is not received within the given time interval a request to fetch a sample is made. In the case of the thermometer, samples arrive at 1 second interval, so 2 seconds of margin is more than enough to receive the samples in as they arrive manner.