Skip to main content

pyESPMega

This library provides a mean of communicating with the ESPMega Programmable Logic Controller through MQTT

Compatibility

This library is compatible with:

  • ESPMega R2.4 [2018] (Model e) with IoT FreedomOS v1.2+
  • ESPMega R3.0 [2020] (All Model) with IoT Core LT OS V1.4
  • ESPMega Plus R1.0 [2020] (All Model) with IoT Core LT+ OS V1.4
  • ESPMega R4.0 [2023] (All Model) with IoT Core LT OS V2
  • ESPMega PRO R2.0 [2020] (Model c) with IoT Core OS V1
  • ESPMega PRO R3.3 [2023] (Model b,c) with IoT Core OS V2.2 (or above)

ESPMega Client Types

There are two type of ESPMega client, ESPMega and ESPMega_standalone

ESPMega

ESPMega class requires you to provide and maintain an MQTT connection This class takes in a Paho-MQTT Client as an input argument
Import and Initialization

from espmega.espmega_r3 import ESPMega
plc = ESPMega("/basetopic", MQTT_CLIENT)

ESPMega_standalone

ESPMega_standalone create and maintain the required mqtt connection for you. Import and Initialization

from espmega.espmega_r3 import ESPMega_standalone as ESPMega
plc = ESPMega("/basetopic", "MQTT_SERVER", MQTT_PORT)

ESPMega Client Functions

  • digital_read(pin: int) -> bool: Reads the digital value from the specified pin.
  • digital_write(pin: int, state: bool) -> None: Sets the digital state of a pin.
  • analog_write(pin: int, state: bool, value: int): Writes an analog value to the specified pin.
  • adc_read(pin: int) -> int: Reads the value from the ADC pin.
  • dac_write(pin: int, state: bool, value: int): Writes the state and value to the DAC pin.
  • enable_adc(pin: int): Enables the ADC (Analog-to-Digital Converter) for the specified pin.
  • disable_adc(pin: int): Disable the ADC (Analog-to-Digital Converter) for the specified pin.
  • set_ac_mode(mode: str): Sets the mode of the air conditioner.
  • set_ac_temperature(temperature: int): Sets the temperature of the air conditioner.
  • set_ac_fan_speed(fan_speed: str): Sets the fan speed of the air conditioner.
  • get_ac_mode(): Returns the current AC mode.
  • get_ac_temperature(): Returns the current temperature of the air conditioning system.
  • get_ac_fan_speed(): Get the current fan speed of the air conditioner.
  • read_room_temperature(): Reads and returns the room temperature.
  • read_humidity(): Reads and returns the humidity value from the humidity buffer.
  • send_infrared(code: dict): Sends an infrared code.
  • request_state_update(): Update all cached states.
  • handle_message(client: pahomqtt.Client, data, message: pahomqtt.MQTTMessage): Handles incoming MQTT messages.
  • get_input_buffer(): Return all states of the input pins as a list.
  • get_pwm_state(pin: int): Return the state of the specified PWM pin.
  • get_pwm_value(pin: int): Return the value of the specified PWM pin.
  • get_pwm_state_buffer(): Return all states of the PWM pins as a list.
  • get_pwm_value_buffer(): Return all values of the PWM pins as a list.

Metadata

Release files for espmega 1.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for espmega 1.13
File Size Uploaded
espmega-1.13.tar.gz 4.6 kB Details

Release files / espmega-1.13.tar.gz

Download URL espmega-1.13.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ddc452cb042ec04a45a0fe4463a7b554685083d3d66317a999defec06502a688
BLAKE2b-256 checksum
How to use checksums
9600d522d88c4d8707072deabdaeab2f3718381c1a6536d0fa78cd45b659932f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

1.13 This release

1 release file

1.12

1 release file

1.11

1 release file

1.10

1 release file

1.9

1 release file

1.8

1 release file

1.7

1 release file

1.6

1 release file

1.5

1 release file

1.4

2 release files

1.3

2 release files

1.2

2 release files

1.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page