@@ -62,29 +62,23 @@ void MqttManager::setDeviceData(String deviceName, String hardware, String devic
6262
6363 if (m_mqttDiscoveryEnabled)
6464 {
65- m_deviceStatusSensor = new MqttDiscoveryComponent (" binary_sensor" , m_deviceName + " Status" );
66- m_deviceStatusSensor->discovery_prefix = discovery_prefix;
65+ m_deviceStatusSensor = new MqttDiscoveryComponent (" binary_sensor" , m_deviceName + " Status" , discovery_prefix);
6766 m_deviceStatusSensor->setConfigurtionVariable (" device_class" , " connectivity" );
6867 m_discoveryComponents.push_back (m_deviceStatusSensor);
6968
70- m_deviceIpSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " IP" );
71- m_deviceIpSensor->discovery_prefix = discovery_prefix;
69+ m_deviceIpSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " IP" , discovery_prefix);
7270 m_discoveryComponents.push_back (m_deviceIpSensor);
7371
74- m_deviceMacSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " MAC" );
75- m_deviceMacSensor->discovery_prefix = discovery_prefix;
72+ m_deviceMacSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " MAC" , discovery_prefix);
7673 m_discoveryComponents.push_back (m_deviceMacSensor);
7774
78- m_deviceHardwareSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Hardware" );
79- m_deviceHardwareSensor->discovery_prefix = discovery_prefix;
75+ m_deviceHardwareSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Hardware" , discovery_prefix);
8076 m_discoveryComponents.push_back (m_deviceHardwareSensor);
8177
82- m_deviceFirmwareSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Firmware" );
83- m_deviceFirmwareSensor->discovery_prefix = discovery_prefix;
78+ m_deviceFirmwareSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Firmware" , discovery_prefix);
8479 m_discoveryComponents.push_back (m_deviceFirmwareSensor);
8580
86- m_deviceFirmwareVersionSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Firmware Version" );
87- m_deviceFirmwareVersionSensor->discovery_prefix = discovery_prefix;
81+ m_deviceFirmwareVersionSensor = new MqttDiscoveryComponent (" sensor" , m_deviceName + " Firmware Version" , discovery_prefix);
8882 m_discoveryComponents.push_back (m_deviceFirmwareVersionSensor);
8983
9084 this ->setLastWillMQTT (m_deviceStatusSensor->getStateTopic (), m_lastWillPayload);
0 commit comments