pylab_ml.common.mqtt_client.mqtt_displayattributes
- class mqtt_displayattributes(client, message_client, mqtt_receive=None)[source]
Bases:
objectMQTT messages for display and controlling (=’receiver’).
docu muss überarbeitet werden:
- publish:
- topic for display application:
f’{TOPIC_PREFIX}/’Hostname’/{TOPIC_CONTROL}
- payload:
f’{“instrumentname”: {“type”: “set/get”, “cmd”: “function/attributename”, “payload”: yourvalues}}’
- __init__(client, message_client, mqtt_receive=None)[source]
Initialize the MQTT display attributes.
- Parameters:
client (mqtt_init) – The MQTT client instance to be used for communication.
message_client (str) – The name of the message client, used for constructing the MQTT topic.
mqtt_receive (function or None) – A custom function to handle received MQTT messages. If None, the default mqtt_receive method will be used (default: None).
Methods
__init__(client, message_client[, mqtt_receive])Initialize the MQTT display attributes.
mqtt_add()Add the module as member for the mqtt communication.
Remove the module as member for the mqtt communication.
mqtt_receive(topic, msg)publish(attr, value)Send message to broker.
publish_get(instName, function_name)Publish attribute with value as get.
publish_set(instName, function_name, value)Publish attribute with value as set.
- json = <module 'json' from '/home/runner/miniconda3/envs/test/lib/python3.9/json/__init__.py'>
- publish(attr, value)[source]
Send message to broker.
- Parameters:
attr (str) – The attribute name to be published.
value (any) – The value to be published.
- Return type:
None
- publish_get(instName, function_name)[source]
Publish attribute with value as get.
- Parameters:
instName (str) – The name of the instrument for which the command is being published.
function_name (str) – The name of the function or attribute to be retrieved.
- Return type:
None
- publish_set(instName, function_name, value)[source]
Publish attribute with value as set.
- Parameters:
instName (str) – The name of the instrument for which the command is being published.
function_name (str) – The name of the function or attribute to be set.
value (any) – The value to be set for the specified function or attribute.
- Return type:
None