pdf-icon

UIFlow Guide

UIFlow 1.0 Blockly

Event

Unit

UIFlow 1.0 Project

Atomic PoE

Example


API

poe.tcp_udp_config('', 0, 1, 1)
  • Initializes the LAN connection. Configures the remote IP address, port number, and selects the communication protocol type (TCP/UDP), as well as specifying if the device is acting as a server or client.
poe.mqtt_config('mqtt.m5stack.com', 1883, '', '', '', 120)
  • Initializes the MQTT server connection, specifying the server address, port, client ID, username, password, and keepalive interval.
poe.is_available_packet(1)
  • Checks if there are any available TCP data packets and returns the packet count.
poe.get_ezdata(ezdata_get_KzSyFcb, 'GCJ3Ic5h2eXnzV3rT3bBXvrncCaJnART', '')
  • Retrieves data from a specified MQTT topic using the topic name and token.
poe.remove_ezdata('GCJ3Ic5h2eXnzV3rT3bBXvrncCaJnART', '')
  • Deletes a specified topic from the MQTT server, using the topic name and token.
poe.set_ezdata('GCJ3Ic5h2eXnzV3rT3bBXvrncCaJnART', '', '', 0)
  • Saves specified data to a topic and authenticates using a token.
poe.get_if_config()
  • Retrieves the current network or device configuration information.
poe.http_get('', True)
  • Fetches data from a specified URL using HTTP or HTTPS, with an option to retrieve the full content.
poe.http_post('', 'application/json', '')
  • Sends data to a specified URL using HTTP or HTTPS, with data formats like JSON or form data.
poe.local_ip()
  • Retrieves the local IP address of the device on the LAN.
poe.mqtt_is_connect()
  • Checks if the device is currently connected to the MQTT server.
poe.mqtt_connect()
  • Connects to the specified MQTT server.
poe.mqtt_disconnect()
  • Disconnects the current MQTT server connection.
poe.mqtt_poll_loop()
  • Polls for downlink messages from the MQTT server.
poe.mqtt_publish('', '', 0)
  • Publishes a message to a specified MQTT topic.
poe.mqtt_subscribe('', atom_poe_mqtt_cb, 0)
  • Subscribes to a specified MQTT topic, with an option to set the Quality of Service (QoS).
def atom_poe_mqtt_cb(poe_mq_topic, poe_mq_payload):
  global ezdata_value1, lan_topic, lan_msg
  lan_topic = poe_mq_topic
  lan_msg = poe_mq_payload
  pass
  • Sets a callback function to handle messages received on the subscribed MQTT topic.
poe.remote_ip()
  • Retrieves the remote device’s IP address.
poe.socket_close()
  • Closes the current network socket connection.
poe.tcp_receive_packet(0)
  • Receives data packets via TCP and reads the specified number of bytes.
poe.tcp_send_packet('1234')
  • Sends a data packet via TCP with the specified string or numeric content.
poe.udp_receive_packet(0)
  • Receives data packets via UDP and reads the specified number of bytes.
poe.udp_send_packet('', 0, '')
  • Sends a data packet via UDP to a specified IP address, port number, and with specified content.
On This Page