fixed w1 temperature sensor
This commit is contained in:
parent
256593f83c
commit
27d1861886
@ -292,14 +292,17 @@ void IntegrationPluginOneWire::executeAction(ThingActionInfo *info)
|
|||||||
void IntegrationPluginOneWire::thingRemoved(Thing *thing)
|
void IntegrationPluginOneWire::thingRemoved(Thing *thing)
|
||||||
{
|
{
|
||||||
if (thing->thingClassId() == oneWireInterfaceThingClassId) {
|
if (thing->thingClassId() == oneWireInterfaceThingClassId) {
|
||||||
m_owfsInterface->deleteLater();
|
if (m_owfsInterface) {
|
||||||
m_owfsInterface = nullptr;
|
m_owfsInterface->deleteLater();
|
||||||
return;
|
m_owfsInterface = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myThings().filterByThingClassId(temperatureSensorThingClassId).isEmpty()) {
|
if (myThings().filterByThingClassId(temperatureSensorThingClassId).isEmpty()) {
|
||||||
m_w1Interface->deleteLater();
|
if(m_w1Interface) {
|
||||||
m_w1Interface = nullptr;
|
m_w1Interface->deleteLater();
|
||||||
|
m_w1Interface = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myThings().empty()) {
|
if (myThings().empty()) {
|
||||||
@ -337,12 +340,12 @@ void IntegrationPluginOneWire::onPluginTimer()
|
|||||||
double temperature = 0;
|
double temperature = 0;
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
|
|
||||||
if (myThings().findById(thing->parentId())->thingClassId() == oneWireInterfaceThingClassId) {
|
if (!thing->parentId().isNull()) {
|
||||||
if (m_owfsInterface) {
|
if (m_owfsInterface) {
|
||||||
temperature = m_owfsInterface->getTemperature(address);
|
temperature = m_owfsInterface->getTemperature(address);
|
||||||
connected = m_owfsInterface->isConnected(address);
|
connected = m_owfsInterface->isConnected(address);
|
||||||
} else {
|
} else {
|
||||||
qCWarning(dcOneWire()) << "onPlugInTimer: OWFS interface not setup yet for thing" << thing->name();
|
qCWarning(dcOneWire()) << "onPlugInTimer: OWFS interface not setup for thing" << thing->name();
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user