INNER CODE UNIT · Python
add_settings
bkbilly/lnxlink · lnxlink/__main__.py:178
def add_settings(self, name, settings, replace_empty=False):
"""Adds missing configuration under settings"""
from lnxlink import config_setup
self.config = config_setup.add_settings(
self.config, name, settings, replace_empty
)
def publish_monitor_data(self, name, pub_data, retain=True, force_publish=False):
"""Publish info data to mqtt in the correct format"""
subtopic = helpers.text_to_topic(name)
topic = f"{self.config['pref_topic']}/monitor_controls/{subtopic}"
if pub_data is None:
return
saved_data = copy.deepcopy(pub_data)
if isinstance(pub_data, bool):
if pub_data is True:
pub_data = "ON"