DoorOpenerPicoNetwork

class DoorOpenerPicoNetwork(credentials, discovery_payload)

Network subclass of DoorOpenerPicoBase, implements network and MQTT functionality.

__init__(credentials, discovery_payload)

Initialises the wireless interface amd MQTT client, loads login credentials, discovery payload and configuration options, initialises board hardware devices, sets up networking and indicates the board has started by flashing the control panel LEDs alternately.

Parameters:
  • credentials (dict) – Wireless network and MQTT login credentials.

  • discovery_payload (dict) – The discovery payload to be sent to the MQTT server.

Methods

__init__(credentials, discovery_payload)

Initialises the wireless interface amd MQTT client, loads login credentials, discovery payload and configuration options, initialises board hardware devices, sets up networking and indicates the board has started by flashing the control panel LEDs alternately.

async _check_msg()

Coroutine, checks if any MQTT messages have been recieved.

_connect_mqtt()

Connects to the MQTT broker specified in the credentials conf, subscribes to the command topic on connection. Displays an error message if connection was unsuccessful.

_connect_wifi()

Attempts to connect to the wireless access point specified in credentials.conf, displays an error if connection couldn’t be established.

_force_open_or_closed(state)

Publishes the state of the door to the MQTT broker, then opens or closes the door, doesn’t check the sensors first to determine whether to continue. Verifies the door successfully opened or closed, displays error otherwise. Overridden from _force_open_or_closed().

Parameters:

state (str) – The intended state of the door, can be “open” or “closed”.

_get_conf_keys()

Returns the keys that should be present in the configuration file, overridden from _get_conf_keys().

Returns:

The list of keys

Return type:

list

_get_event_loop()

Adds suitable methods to the event loop and returns it. Overridden from _get_event_loop() to add additional network related tasks.

Returns:

The event loop.

Return type:

class

async _maintain_connections()

Coroutine, reconnects to the wifi and MQTT broker in the case of a connection issue.

_mqtt_command_dispatcher(topic, payload, retained, duplicate)

Calls a given door function (open, close, force_open or force_close) when an applicable MQTT message is recieved.

_network_setup()

Initialises MQTT topic variables, connects to the wifi and MQTT broker, publishes the MQTT discovery payload so Home Assistant can create a suitable entity and sets the availability of the door opener.

async _ping()

Coroutine, periodically pings the MQTT broker at the interval set in the config. Regular network activity is required to detect if there has been a connection issue.

_set_availability()

Publishes the availability of the door opener to the MQTT broker based on the current state of the door.

_set_state(state)

Publishes the current state of the door to the MQTT broker and sets the LED activity appropriately. Overridden from _set_state().

Parameters:

state (str) – State to set, can be “open”, “closed”, “opening” or “closing”.

_show_error()

Signifies the door is in the error state, publishes the availability to the MQTT broker and flashes the red LED. Overridden from _show_error().