Skip to content

Commit

Permalink
fix ha 2023.8 mqtt entity naming warning (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanKun authored Aug 26, 2023
1 parent 7fac913 commit 3f22097
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion app/sensors/Alarm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ async def setup(self):
'identifiers': self.id
}
self.config = {
'name': self.name,
'name': None, # set an MQTT entity's name to None to mark it as the main feature of a device
'unique_id': self.id,
'device': self.device,
'command_topic': alarm_command_topic.format(id=self.id),
Expand Down
14 changes: 8 additions & 6 deletions app/sensors/Boiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
preset_mode_command_topic = "climate/tydom/{id}/set_thermicLevel"
out_temperature_state_topic = "sensor/tydom/{id}/temperature"

#temperature = current_temperature_topic
#setpoint= temperature_command_topic
# temperature = current_temperature_topic
# setpoint= temperature_command_topic
# temperature_unit=C
# "modes": ["STOP", "ANTI-FROST","ECO", "COMFORT"],
#####################################
Expand All @@ -27,8 +27,8 @@
# thermicLevel STOP ECO ...
# auhorisation HEATING
# hvacMode NORMAL None (si off)
#timeDelay : 0
#tempoOn : False
# timeDelay : 0
# tempoOn : False
# antifrost True False
# openingdetected False
# presenceDetected False
Expand Down Expand Up @@ -78,7 +78,8 @@ async def setup(self):

# Check if device is a heater with thermostat sensor
else:
self.config['name'] = self.name
# set an MQTT entity's name to None to mark it as the main feature of a device
self.config['name'] = None
self.device['model'] = 'Climate'
self.config_topic = climate_config_topic.format(id=self.id)
self.config['temperature_command_topic'] = temperature_command_topic.format(
Expand Down Expand Up @@ -153,5 +154,6 @@ async def put_hvac_mode(tydom_client, device_id, boiler_id, set_hvac_mode):
@staticmethod
async def put_thermic_level(tydom_client, device_id, boiler_id, set_thermic_level):
if not (set_thermic_level == ''):
logger.info("Set thermic level (device=%s, level=%s)", device_id, set_thermic_level)
logger.info("Set thermic level (device=%s, level=%s)",
device_id, set_thermic_level)
await tydom_client.put_devices_data(device_id, boiler_id, 'thermicLevel', set_thermic_level)
2 changes: 1 addition & 1 deletion app/sensors/Cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def setup(self):
'identifiers': self.id}
self.config_topic = cover_config_topic.format(id=self.id)
self.config = {
'name': self.name,
'name': None, # set an MQTT entity's name to None to mark it as the main feature of a device
'unique_id': self.id,
'command_topic': cover_command_topic.format(
id=self.id),
Expand Down
2 changes: 1 addition & 1 deletion app/sensors/Light.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ async def setup(self):
'identifiers': self.id}
self.config_topic = light_config_topic.format(id=self.id)
self.config = {
'name': self.name,
'name': None, # set an MQTT entity's name to None to mark it as the main feature of a device
'brightness_scale': 100,
'unique_id': self.id,
'optimistic': True,
Expand Down
4 changes: 1 addition & 3 deletions app/sensors/Sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(self, elem_name, tydom_attributes_payload, mqtt=None):
# extracted from json, but it will make sensor not in payload to be
# considered offline....
self.parent_device_id = str(tydom_attributes_payload['id'])
self.parent_device_name = str(tydom_attributes_payload['name'])
self.id = elem_name + '_tydom_' + str(tydom_attributes_payload['id'])
self.name = elem_name
if 'device_class' in tydom_attributes_payload.keys():
Expand Down Expand Up @@ -106,12 +105,11 @@ def __init__(self, elem_name, tydom_attributes_payload, mqtt=None):
async def setup(self):
self.device = {
'manufacturer': 'Delta Dore',
'name': self.parent_device_name,
'identifiers': self.parent_device_id}

self.config_sensor_topic = sensor_config_topic.format(id=self.id)

self.config = {'name': self.parent_device_name + ' ' + self.name,
self.config = {'name': self.name,
'unique_id': self.id}
try:
self.config['device_class'] = self.device_class
Expand Down
4 changes: 2 additions & 2 deletions app/sensors/ShHvac.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def setup(self):

self.config_topic = thermostat_config_topic.format(id=self.id)
self.config = {
'name': self.name,
'name': None, # set an MQTT entity's name to None to mark it as the main feature of a device
'unique_id': self.id,
'device': self.device,
'temperature_unit ': 'C',
Expand All @@ -64,7 +64,7 @@ async def setup(self):
self.switch_config_topic = thermpstat_boost_config_topic.format(
id=self.id)
self.switch_config = {
'name': self.name + ' Boost',
'name': 'Boost',
'unique_id': self.id + '_boost',
'device': self.device,
'payload_on': 'ON',
Expand Down
2 changes: 1 addition & 1 deletion app/sensors/Switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async def setup(self):
'identifiers': self.id}
self.config_topic = switch_config_topic.format(id=self.id)
self.config = {
'name': self.name,
'name': None, # set an MQTT entity's name to None to mark it as the main feature of a device
'unique_id': self.id,
'command_topic': switch_command_topic.format(
id=self.id),
Expand Down

0 comments on commit 3f22097

Please sign in to comment.