testframework.datasinks.mqtt_client module

This module provides MQTT client to interact with MQTT Server

It includes functionality to create MQTT client with callbacks

class testframework.datasinks.mqtt_client.MQTTClient(port, mqtt_ip, keep_alive, mqtt_first_reconnect_delay=1, mqtt_reconnect_rate=2, mqtt_max_reconnect_count=12, mqtt_max_reconnect_delay=60)

Bases: object

A class used to represent MQTT client

port

port where mqtt client is running on

broker

address where mqtt broker is hosted

keep_alive

time until connection is active

property Client: Client
static get_latest_value_in_messages(variable_id: PowerVariables, messages: List[bytes]) float

Finds the last raw bytes message in a list where to variable name matches the predicate Assumes the latest message is at the end of a sorted list and tries to return the latest available value

get_number_value(variable_id: PowerVariables, sampling_point: SamplingPoint, timeout_dur_secs: float = 30) float

Gets a number value from the given reference point within a certain time. Abstracts the subscription logic to a syncronous function call

exception testframework.datasinks.mqtt_client.MessageNotFoundException

Bases: Exception

No MQTT Messages available