fixed discovery for temperature and humidity sensors
This commit is contained in:
parent
e99643feef
commit
f7308e4d9f
@ -43,16 +43,17 @@ void IntegrationPluginOneWire::discoverThings(ThingDiscoveryInfo *info)
|
||||
{
|
||||
ThingClassId deviceClassId = info->thingClassId();
|
||||
|
||||
if (!m_w1Interface) {
|
||||
m_w1Interface = new W1(this);
|
||||
}
|
||||
|
||||
if (deviceClassId == temperatureSensorThingClassId ||
|
||||
deviceClassId == temperatureHumiditySensorThingClassId ||
|
||||
deviceClassId == singleChannelSwitchThingClassId ||
|
||||
deviceClassId == dualChannelSwitchThingClassId ||
|
||||
deviceClassId == eightChannelSwitchThingClassId) {
|
||||
|
||||
if (myThings().filterByThingClassId(oneWireInterfaceThingClassId).isEmpty()) {
|
||||
if (!m_w1Interface) {
|
||||
m_w1Interface = new W1(this);
|
||||
}
|
||||
|
||||
if (!m_w1Interface->interfaceIsAvailable()) {
|
||||
return info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("No one wire interface initialized. Please set up a one wire interface first."));
|
||||
}
|
||||
@ -410,7 +411,7 @@ void IntegrationPluginOneWire::onPluginTimer()
|
||||
|
||||
void IntegrationPluginOneWire::onOneWireDevicesDiscovered(QList<Owfs::OwfsDevice> oneWireDevices)
|
||||
{
|
||||
foreach(Thing *parentDevice, myThings().filterByThingClassId(oneWireInterfaceThingClassId)) {
|
||||
Thing *parentDevice = myThings().filterByThingClassId(oneWireInterfaceThingClassId).first();
|
||||
|
||||
ThingDescriptors descriptors;
|
||||
foreach (Owfs::OwfsDevice oneWireDevice, oneWireDevices){
|
||||
@ -506,6 +507,4 @@ void IntegrationPluginOneWire::onOneWireDevicesDiscovered(QList<Owfs::OwfsDevice
|
||||
info->addThingDescriptors(descriptors);
|
||||
info->finish(Thing::ThingErrorNoError);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user