Extended readme, fixed discovery without gateway device
parent
f253571093
commit
e4903e00ac
|
|
@ -1,3 +1,39 @@
|
|||
# One wire
|
||||
|
||||
This plugin allows to add one wire devices through the one wire file system.
|
||||
|
||||
|
||||
## One wire interface device
|
||||
|
||||
This device initializes OWFS, during the device setup you can set OWFS init arguments.
|
||||
Default arguments are "--i2c=ALL:ALL" to scan for one-wire devices on all I2C interfaces.
|
||||
|
||||
You can simulate one-wire device with following init argument: "--fake=10,22,28,05"
|
||||
|
||||
More about init arguments here: https://www.owfs.org
|
||||
|
||||
## Supported one-wire devices
|
||||
|
||||
* Family Code 10 - Temperature Sensors
|
||||
..* DS18S20
|
||||
..* DS1820
|
||||
..* DS18S20-PAR
|
||||
..* DS1920
|
||||
* Family Code 22 - Temperature Sensors
|
||||
..* DS1822
|
||||
..* DS1822-PAR
|
||||
* Family Code 28 - Temperature Sensors
|
||||
..* DS18B20
|
||||
..* DS18B20-PAR
|
||||
..* DS18B20X
|
||||
* Family Code 3B - Temperature Sensors
|
||||
..* DS1825
|
||||
* Family Code 05 - Single channel switch
|
||||
..* DS2405
|
||||
* Family Code 12 - Dual channel switch
|
||||
..* DS2406
|
||||
..* DS2407
|
||||
* Family Code 3A - Dual channel switch
|
||||
..* DS2413
|
||||
* Family Code 29 - Eight channel switch
|
||||
..* DS2408
|
||||
|
|
|
|||
|
|
@ -33,10 +33,6 @@ DevicePluginOneWire::DevicePluginOneWire()
|
|||
{
|
||||
}
|
||||
|
||||
void DevicePluginOneWire::init()
|
||||
{
|
||||
}
|
||||
|
||||
Device::DeviceError DevicePluginOneWire::discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms)
|
||||
{
|
||||
Q_UNUSED(params);
|
||||
|
|
@ -46,6 +42,11 @@ Device::DeviceError DevicePluginOneWire::discoverDevices(const DeviceClassId &de
|
|||
deviceClassId == dualChannelSwitchDeviceClassId ||
|
||||
deviceClassId == eightChannelSwitchDeviceClassId) {
|
||||
|
||||
if (myDevices().filterByDeviceClassId(oneWireInterfaceDeviceClassId).isEmpty()) {
|
||||
//No one wire interface intitialized
|
||||
return Device::DeviceErrorHardwareNotAvailable;
|
||||
}
|
||||
|
||||
foreach(Device *parentDevice, myDevices().filterByDeviceClassId(oneWireInterfaceDeviceClassId)) {
|
||||
if (parentDevice->stateValue(oneWireInterfaceAutoAddStateTypeId).toBool()) {
|
||||
//devices cannot be discovered since auto mode is enabled
|
||||
|
|
@ -277,6 +278,7 @@ void DevicePluginOneWire::onOneWireDevicesDiscovered(QList<OneWire::OneWireDevic
|
|||
switch (oneWireDevice.family) {
|
||||
//https://github.com/owfs/owfs-doc/wiki/1Wire-Device-List
|
||||
case 0x10: //DS18S20
|
||||
case 0x22: //DS1822
|
||||
case 0x28: //DS18B20
|
||||
case 0x3b: {//DS1825, MAX31826, MAX31850
|
||||
DeviceDescriptor descriptor(temperatureSensorDeviceClassId, oneWireDevice.type, "One wire temperature sensor", parentDevice->id());
|
||||
|
|
@ -347,22 +349,22 @@ void DevicePluginOneWire::onOneWireDevicesDiscovered(QList<OneWire::OneWireDevic
|
|||
}
|
||||
if (autoDiscoverEnabled) {
|
||||
if (!temperatureDeviceDescriptors.isEmpty())
|
||||
emit autoDevicesAppeared(temperatureSensorDeviceClassId, temperatureDeviceDescriptors);
|
||||
emit autoDevicesAppeared(temperatureSensorDeviceClassId, temperatureDeviceDescriptors);
|
||||
if (!singleChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit autoDevicesAppeared(singleChannelSwitchDeviceClassId, singleChannelSwitchDeviceDescriptors);
|
||||
emit autoDevicesAppeared(singleChannelSwitchDeviceClassId, singleChannelSwitchDeviceDescriptors);
|
||||
if (!dualChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit autoDevicesAppeared(dualChannelSwitchDeviceClassId, dualChannelSwitchDeviceDescriptors);
|
||||
emit autoDevicesAppeared(dualChannelSwitchDeviceClassId, dualChannelSwitchDeviceDescriptors);
|
||||
if (!eightChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit autoDevicesAppeared(eightChannelSwitchDeviceClassId, eightChannelSwitchDeviceDescriptors);
|
||||
emit autoDevicesAppeared(eightChannelSwitchDeviceClassId, eightChannelSwitchDeviceDescriptors);
|
||||
} else {
|
||||
if (!temperatureDeviceDescriptors.isEmpty())
|
||||
emit devicesDiscovered(temperatureSensorDeviceClassId, temperatureDeviceDescriptors);
|
||||
emit devicesDiscovered(temperatureSensorDeviceClassId, temperatureDeviceDescriptors);
|
||||
if (!singleChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit devicesDiscovered(singleChannelSwitchDeviceClassId, singleChannelSwitchDeviceDescriptors);
|
||||
emit devicesDiscovered(singleChannelSwitchDeviceClassId, singleChannelSwitchDeviceDescriptors);
|
||||
if (!dualChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit devicesDiscovered(dualChannelSwitchDeviceClassId, dualChannelSwitchDeviceDescriptors);
|
||||
emit devicesDiscovered(dualChannelSwitchDeviceClassId, dualChannelSwitchDeviceDescriptors);
|
||||
if (!eightChannelSwitchDeviceDescriptors.isEmpty())
|
||||
emit devicesDiscovered(eightChannelSwitchDeviceClassId, eightChannelSwitchDeviceDescriptors);
|
||||
emit devicesDiscovered(eightChannelSwitchDeviceClassId, eightChannelSwitchDeviceDescriptors);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class DevicePluginOneWire : public DevicePlugin
|
|||
|
||||
public:
|
||||
explicit DevicePluginOneWire();
|
||||
void init() override;
|
||||
|
||||
Device::DeviceError discoverDevices(const DeviceClassId &deviceClassId, const ParamList ¶ms) override;
|
||||
Device::DeviceSetupStatus setupDevice(Device *device) override;
|
||||
|
|
|
|||
Loading…
Reference in New Issue