energomera_hass_mqtt.iec_hass_sensor
Package provide single HASS sensor over MQTT from energy meter read using IEC protocol.
Classes
|
Processes entity received from the meter IEC 62056-21 protocol in accordance with given configuration from the |
- class energomera_hass_mqtt.iec_hass_sensor.IecToHassSensor(mqtt_config, mqtt_client, config_param, iec_item, model, sw_version, serial_number)
Bases:
objectProcesses entity received from the meter IEC 62056-21 protocol in accordance with given configuration from the
parameterssection and sends them over to HomeAssistant using MQTT.- Parameters:
mqtt_config (
ConfigMqttSchema) –mqttfragment of the configurationmqtt_client (
MqttClient) – Instance of MQTT clientconfig_param (
ConfigParameterSchema) – particular entry fromparametersconfiguration sectioniec_item (
List[DataSet]) – Entry received from the meter for the specifiedconfig_param
- property state_last_will_payload: str | None
Stores value of last will payload to be set for MQTT client.
Should be implemented by subclasses.
- property iec_item: List[DataSet]
Provides IEC entity associated with the instance.
- Returns:
IEC entity
- iec_try_value_by_index()
Attempts to pick an item from multi-valued meter’s response (if
response_idxis configured in the entry of parameters section being processed).- Return type:
- hass_gen_hass_sensor_props(idx)
Generates various properties for the HASS sensor (device and unique IDs, MQTT topic names etc.).
- Return type:
- hass_config_payload()
Returns HASS config payload for the item.
- hass_state_payload(value)
Returns HASS state payload for the item.
- async process(setup_only=False)
Processes the entry received from the meter and sends it to HASS over MQTT.