@@ -17812,6 +17812,18 @@ void DeRestPluginPrivate::pushSensorInfoToCore(Sensor *sensor)
1781217812
1781317813 Q_Q(DeRestPlugin);
1781417814
17815+ bool isMainSubDevice = false;
17816+ Device *device = static_cast<Device*>(sensor->parentResource());
17817+
17818+ if (device)
17819+ {
17820+ const auto &subs = device->subDevices();
17821+ if (!subs.empty() && subs.front() == sensor)
17822+ {
17823+ isMainSubDevice = true;
17824+ }
17825+ }
17826+
1781517827 if (sensor->modelId().startsWith(QLatin1String("FLS-NB")))
1781617828 { } // use name from light
1781717829 else if (sensor->modelId().startsWith(QLatin1String("D1")) || sensor->modelId().startsWith(QLatin1String("S1")) ||
@@ -17823,19 +17835,19 @@ void DeRestPluginPrivate::pushSensorInfoToCore(Sensor *sensor)
1782317835 { } // use name from ZHAPresence sensor only
1782417836 else if (sensor->modelId() == QLatin1String("WarningDevice") && sensor->type() == QLatin1String("ZHAAlarm"))
1782517837 { } // use name from light
17826- else if (!sensor->name().isEmpty())
17838+ else if (!sensor->name().isEmpty() || isMainSubDevice )
1782717839 {
17828- q->nodeUpdated(sensor->address().ext(), QLatin1String("name"), sensor->name());
17840+ emit q->nodeUpdated(sensor->address().ext(), QLatin1String("name"), sensor->name());
1782917841 }
1783017842
1783117843 if (!sensor->modelId().isEmpty())
1783217844 {
17833- q->nodeUpdated(sensor->address().ext(), QLatin1String("modelid"), sensor->modelId());
17845+ emit q->nodeUpdated(sensor->address().ext(), QLatin1String("modelid"), sensor->modelId());
1783417846 }
1783517847
1783617848 if (!sensor->manufacturer().isEmpty())
1783717849 {
17838- q->nodeUpdated(sensor->address().ext(), QLatin1String("vendor"), sensor->manufacturer());
17850+ emit q->nodeUpdated(sensor->address().ext(), QLatin1String("vendor"), sensor->manufacturer());
1783917851 }
1784017852
1784117853 if (!sensor->swVersion().isEmpty())
0 commit comments