diff --git a/debian/control b/debian/control index 974e0b73..0bfec247 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ Build-depends: libboblight-dev, debhelper (>= 0.0.0), libnymea-dev (>= 0.26~), libnymea-mqtt-dev, + libnymea-gpio-dev, libnymea-zigbee-dev, libqt5serialport5-dev, libqt5websockets5-dev, @@ -376,6 +377,7 @@ Package: nymea-plugin-gpio Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, + libnymea-gpio, nymea-plugins-translations, Description: nymea.io plugin for gpio The nymea daemon is a plugin based IoT (Internet of Things) server. The diff --git a/gpio/README.md b/gpio/README.md index 0b6d3249..0ea0f540 100644 --- a/gpio/README.md +++ b/gpio/README.md @@ -2,7 +2,7 @@ This plugin allows to control GPIOs on different boards. -## Raspberry Pi 2/3 +## Raspberry Pi ![Raspberry Pi GPIO](https://raw.githubusercontent.com/guh/nymea-plugins/master/gpio/docs/images/Raspberry-Pi-2-GPIO.png "Raspberry Pi GPIO") diff --git a/gpio/gpio.pro b/gpio/gpio.pro index f3f8ffd1..060a7a1d 100644 --- a/gpio/gpio.pro +++ b/gpio/gpio.pro @@ -1,6 +1,6 @@ include(../plugins.pri) -TARGET = $$qtLibraryTarget(nymea_integrationplugingpio) +PKGCONFIG += nymea-gpio SOURCES += \ integrationplugingpio.cpp \ diff --git a/gpio/integrationplugingpio.cpp b/gpio/integrationplugingpio.cpp index 08fd6a7f..eee69e7f 100644 --- a/gpio/integrationplugingpio.cpp +++ b/gpio/integrationplugingpio.cpp @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2021, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -35,122 +35,35 @@ IntegrationPluginGpio::IntegrationPluginGpio() { + } -void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) +void IntegrationPluginGpio::init() { - Thing *thing = info->thing(); - qCDebug(dcGpioController()) << "Setup" << thing->name() << thing->params(); + // Raspberry pi + m_gpioParamTypeIds.insert(gpioOutputRpiThingClassId, gpioOutputRpiThingGpioParamTypeId); + m_gpioParamTypeIds.insert(gpioInputRpiThingClassId, gpioInputRpiThingGpioParamTypeId); + m_gpioParamTypeIds.insert(counterRpiThingClassId, counterRpiThingGpioParamTypeId); + m_gpioParamTypeIds.insert(gpioButtonRpiThingClassId, gpioButtonRpiThingGpioParamTypeId); - // Check if GPIOs are available on this platform - if (!Gpio::isAvailable()) { - qCWarning(dcGpioController()) << "There are ou GPIOs on this plattform"; - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("No GPIOs found on this system.")); - } + // Beagle bone black + m_gpioParamTypeIds.insert(gpioOutputBbbThingClassId, gpioOutputBbbThingGpioParamTypeId); + m_gpioParamTypeIds.insert(gpioInputBbbThingClassId, gpioInputBbbThingGpioParamTypeId); + m_gpioParamTypeIds.insert(counterBbbThingClassId, counterBbbThingGpioParamTypeId); + m_gpioParamTypeIds.insert(gpioButtonBbbThingClassId, gpioButtonBbbThingGpioParamTypeId); - // GPIO Switch - if (thing->thingClassId() == gpioOutputRpiThingClassId || thing->thingClassId() == gpioOutputBbbThingClassId) { - // Create and configure gpio - int gpioId = -1; - if (thing->thingClassId() == gpioOutputRpiThingClassId) - gpioId = thing->paramValue(gpioOutputRpiThingGpioParamTypeId).toInt(); + // Raspberry pi + m_activeLowParamTypeIds.insert(gpioOutputRpiThingClassId, gpioOutputRpiThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(gpioInputRpiThingClassId, gpioInputRpiThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(counterRpiThingClassId, counterRpiThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(gpioButtonRpiThingClassId, gpioButtonRpiThingActiveLowParamTypeId); - if (thing->thingClassId() == gpioOutputBbbThingClassId) - gpioId = thing->paramValue(gpioOutputBbbThingGpioParamTypeId).toInt(); + // Beagle bone black + m_activeLowParamTypeIds.insert(gpioOutputBbbThingClassId, gpioOutputBbbThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(gpioInputBbbThingClassId, gpioInputBbbThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(counterBbbThingClassId, counterBbbThingActiveLowParamTypeId); + m_activeLowParamTypeIds.insert(gpioButtonBbbThingClassId, gpioButtonBbbThingActiveLowParamTypeId); - Gpio *gpio = new Gpio(gpioId, this); - - if (!gpio->exportGpio()) { - qCWarning(dcGpioController()) << "Could not export gpio for thing" << thing->name(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Exporting GPIO failed.")); - } - - if (!gpio->setDirection(Gpio::DirectionOutput)) { - qCWarning(dcGpioController()) << "Could not configure output gpio for thing" << thing->name(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring output GPIO failed.")); - } - - if (!gpio->setValue(Gpio::ValueLow)) { - qCWarning(dcGpioController()) << "Could not set gpio value for thing" << thing->name(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Setting GPIO value failed.")); - } - - m_gpioDevices.insert(gpio, thing); - - if (thing->thingClassId() == gpioOutputRpiThingClassId) - m_raspberryPiGpios.insert(gpio->gpioNumber(), gpio); - - if (thing->thingClassId() == gpioOutputBbbThingClassId) - m_beagleboneBlackGpios.insert(gpio->gpioNumber(), gpio); - - return info->finish(Thing::ThingErrorNoError); - } - - if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) { - - int gpioId = -1; - if (thing->thingClassId() == gpioInputRpiThingClassId) - gpioId = thing->paramValue(gpioInputRpiThingGpioParamTypeId).toInt(); - - if (thing->thingClassId() == gpioInputBbbThingClassId) - gpioId = thing->paramValue(gpioInputBbbThingGpioParamTypeId).toInt(); - - GpioMonitor *monitor = new GpioMonitor(gpioId, this); - - if (!monitor->enable()) { - qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); - } - - connect(monitor, &GpioMonitor::valueChanged, this, &IntegrationPluginGpio::onGpioValueChanged); - - m_monitorDevices.insert(monitor, thing); - - if (thing->thingClassId() == gpioInputRpiThingClassId) - m_raspberryPiGpioMoniors.insert(monitor->gpio()->gpioNumber(), monitor); - - if (thing->thingClassId() == gpioInputBbbThingClassId) - m_beagleboneBlackGpioMoniors.insert(monitor->gpio()->gpioNumber(), monitor); - - return info->finish(Thing::ThingErrorNoError); - } - - if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { - - int gpioId = -1; - if (thing->thingClassId() == counterRpiThingClassId) - gpioId = thing->paramValue(counterRpiThingGpioParamTypeId).toInt(); - - if (thing->thingClassId() == counterBbbThingClassId) - gpioId = thing->paramValue(counterBbbThingGpioParamTypeId).toInt(); - - GpioMonitor *monitor = new GpioMonitor(gpioId, this); - - if (!monitor->enable()) { - qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); - //: Error setting up GPIO thing - return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); - } - - connect(monitor, &GpioMonitor::valueChanged, this, &IntegrationPluginGpio::onGpioValueChanged); - - m_monitorDevices.insert(monitor, thing); - - if (thing->thingClassId() == counterRpiThingClassId) - m_raspberryPiGpioMoniors.insert(monitor->gpio()->gpioNumber(), monitor); - - if (thing->thingClassId() == counterBbbThingClassId) - m_beagleboneBlackGpioMoniors.insert(monitor->gpio()->gpioNumber(), monitor); - - m_counterValues.insert(thing->id(), 0); - return info->finish(Thing::ThingErrorNoError); - } - return info->finish(Thing::ThingErrorNoError); } void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) @@ -167,19 +80,11 @@ void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) // Check which board / gpio configuration const ThingClass deviceClass = supportedThings().findById(deviceClassId); if (deviceClass.vendorId() == raspberryPiVendorId) { - // Create the list of available gpios QList gpioDescriptors = raspberryPiGpioDescriptors(); for (int i = 0; i < gpioDescriptors.count(); i++) { const GpioDescriptor gpioDescriptor = gpioDescriptors.at(i); - // Offer only gpios which arn't in use already - if (m_raspberryPiGpios.keys().contains(gpioDescriptor.gpio())) - continue; - - if (m_raspberryPiGpioMoniors.keys().contains(gpioDescriptor.gpio())) - continue; - QString description; if (gpioDescriptor.description().isEmpty()) { description = QString("Pin %1").arg(gpioDescriptor.pin()); @@ -197,11 +102,20 @@ void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) parameters.append(Param(gpioInputRpiThingGpioParamTypeId, gpioDescriptor.gpio())); parameters.append(Param(gpioInputRpiThingPinParamTypeId, gpioDescriptor.pin())); parameters.append(Param(gpioInputRpiThingDescriptionParamTypeId, gpioDescriptor.description())); + } else if (deviceClass.id() == gpioButtonRpiThingClassId) { + parameters.append(Param(gpioButtonRpiThingGpioParamTypeId, gpioDescriptor.gpio())); + parameters.append(Param(gpioButtonRpiThingPinParamTypeId, gpioDescriptor.pin())); + parameters.append(Param(gpioButtonRpiThingDescriptionParamTypeId, gpioDescriptor.description())); + } else if (deviceClass.id() == counterRpiThingClassId) { + parameters.append(Param(counterRpiThingGpioParamTypeId, gpioDescriptor.gpio())); + parameters.append(Param(counterRpiThingPinParamTypeId, gpioDescriptor.pin())); + parameters.append(Param(counterRpiThingDescriptionParamTypeId, gpioDescriptor.description())); } descriptor.setParams(parameters); + // Set device id for reconfigure foreach (Thing *existingThing, myThings()) { - if (existingThing->paramValue(gpioOutputRpiThingGpioParamTypeId).toInt() == gpioDescriptor.gpio()) { + if (existingThing->paramValue(m_gpioParamTypeIds.value(deviceClass.id())).toInt() == gpioDescriptor.gpio()) { descriptor.setThingId(existingThing->id()); break; } @@ -219,13 +133,6 @@ void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) for (int i = 0; i < gpioDescriptors.count(); i++) { const GpioDescriptor gpioDescriptor = gpioDescriptors.at(i); - // Offer only gpios which arn't in use already - if (m_beagleboneBlackGpios.keys().contains(gpioDescriptor.gpio())) - continue; - - if (m_beagleboneBlackGpioMoniors.keys().contains(gpioDescriptor.gpio())) - continue; - QString description; if (gpioDescriptor.description().isEmpty()) { description = QString("Pin %1").arg(gpioDescriptor.pin()); @@ -243,9 +150,25 @@ void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) parameters.append(Param(gpioInputBbbThingGpioParamTypeId, gpioDescriptor.gpio())); parameters.append(Param(gpioInputBbbThingPinParamTypeId, gpioDescriptor.pin())); parameters.append(Param(gpioInputBbbThingDescriptionParamTypeId, gpioDescriptor.description())); + } else if (deviceClass.id() == gpioButtonBbbThingClassId) { + parameters.append(Param(gpioButtonBbbThingGpioParamTypeId, gpioDescriptor.gpio())); + parameters.append(Param(gpioButtonBbbThingPinParamTypeId, gpioDescriptor.pin())); + parameters.append(Param(gpioButtonBbbThingDescriptionParamTypeId, gpioDescriptor.description())); + } else if (deviceClass.id() == counterBbbThingClassId) { + parameters.append(Param(counterBbbThingGpioParamTypeId, gpioDescriptor.gpio())); + parameters.append(Param(counterBbbThingPinParamTypeId, gpioDescriptor.pin())); + parameters.append(Param(counterBbbThingDescriptionParamTypeId, gpioDescriptor.description())); } descriptor.setParams(parameters); + // Set device id for reconfigure + foreach (Thing *existingThing, myThings()) { + if (existingThing->paramValue(m_gpioParamTypeIds.value(deviceClass.id())).toInt() == gpioDescriptor.gpio()) { + descriptor.setThingId(existingThing->id()); + break; + } + } + info->addThingDescriptor(descriptor); } @@ -253,9 +176,258 @@ void IntegrationPluginGpio::discoverThings(ThingDiscoveryInfo *info) } } +void IntegrationPluginGpio::setupThing(ThingSetupInfo *info) +{ + Thing *thing = info->thing(); + qCDebug(dcGpioController()) << "Setup" << thing->name() << thing->params(); + + // Check if GPIOs are available on this platform + if (!Gpio::isAvailable()) { + qCWarning(dcGpioController()) << "There are ou GPIOs on this plattform"; + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareNotAvailable, QT_TR_NOOP("No GPIOs found on this system.")); + } + + // GPIO Switch + if (thing->thingClassId() == gpioOutputRpiThingClassId || thing->thingClassId() == gpioOutputBbbThingClassId) { + + // Create and configure gpio + Gpio *gpio = new Gpio(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); + + if (!gpio->exportGpio()) { + qCWarning(dcGpioController()) << "Could not export gpio for thing" << thing->name(); + gpio->deleteLater(); + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Exporting GPIO failed.")); + } + + if (!gpio->setDirection(Gpio::DirectionOutput)) { + qCWarning(dcGpioController()) << "Could not configure output gpio for thing" << thing->name(); + gpio->deleteLater(); + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring output GPIO failed.")); + } + + if (!gpio->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool())) { + qCWarning(dcGpioController()) << "Could not configure output gpio for thing" << thing->name(); + gpio->deleteLater(); + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Configuring GPIO active low failed.")); + } + + // Make sure the pin is initially low, they will be restored in the post setup to the cached state + if (!gpio->setValue(Gpio::ValueLow)) { + qCWarning(dcGpioController()) << "Could not set gpio initially low for thing" << thing->name(); + gpio->deleteLater(); + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Set GPIO low failed.")); + } + + m_gpioDevices.insert(gpio, thing); + + if (thing->thingClassId() == gpioOutputRpiThingClassId) + m_raspberryPiGpios.insert(gpio->gpioNumber(), gpio); + + if (thing->thingClassId() == gpioOutputBbbThingClassId) + m_beagleboneBlackGpios.insert(gpio->gpioNumber(), gpio); + + return info->finish(Thing::ThingErrorNoError); + } + + // Gpio input + if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) { + GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); + monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool()); + if (!monitor->enable()) { + qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); + //: Error setting up GPIO thing + monitor->deleteLater(); + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); + } + + connect(monitor, &GpioMonitor::enabledChanged, thing, [thing](bool enabled){ + if (thing->thingClassId() == gpioInputRpiThingClassId) { + thing->setStateValue(gpioInputRpiPowerStateTypeId, enabled); + } else if (thing->thingClassId() == gpioInputBbbThingClassId) { + thing->setStateValue(gpioInputBbbPowerStateTypeId, enabled); + } + }); + + m_monitorDevices.insert(monitor, thing); + + if (thing->thingClassId() == gpioInputRpiThingClassId) + m_raspberryPiGpioMoniors.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), monitor); + + if (thing->thingClassId() == gpioInputBbbThingClassId) + m_beagleboneBlackGpioMoniors.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), monitor); + + return info->finish(Thing::ThingErrorNoError); + } + + // Counter + if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { + GpioMonitor *monitor = new GpioMonitor(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); + monitor->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool()); + if (!monitor->enable()) { + qCWarning(dcGpioController()) << "Could not enable gpio monitor for thing" << thing->name(); + monitor->deleteLater(); + //: Error setting up GPIO thing + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO monitor failed.")); + } + + connect(monitor, &GpioMonitor::enabledChanged, thing, [this, thing](bool enabled){ + if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { + if (enabled) { + m_counterValues[thing->id()] += 1; + } + } + }); + + m_monitorDevices.insert(monitor, thing); + + if (thing->thingClassId() == counterRpiThingClassId) + m_raspberryPiGpioMoniors.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), monitor); + + if (thing->thingClassId() == counterBbbThingClassId) + m_beagleboneBlackGpioMoniors.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), monitor); + + m_counterValues.insert(thing->id(), 0); + return info->finish(Thing::ThingErrorNoError); + } + + // Button + if (thing->thingClassId() == gpioButtonRpiThingClassId || thing->thingClassId() == gpioButtonBbbThingClassId) { + GpioButton *button = new GpioButton(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), this); + button->setActiveLow(thing->paramValue(m_activeLowParamTypeIds.value(thing->thingClassId())).toBool()); + if (thing->thingClassId() == gpioButtonRpiThingClassId) { + button->setLongPressedTimeout(thing->setting(gpioButtonRpiSettingsLongPressedTimeoutParamTypeId).toUInt()); + button->setRepeateLongPressed(thing->setting(gpioButtonRpiSettingsRepeateLongPressedParamTypeId).toBool()); + } else if (thing->thingClassId() == gpioButtonBbbThingClassId) { + button->setLongPressedTimeout(thing->setting(gpioButtonBbbSettingsLongPressedTimeoutParamTypeId).toUInt()); + button->setRepeateLongPressed(thing->setting(gpioButtonBbbSettingsRepeateLongPressedParamTypeId).toBool()); + } + + if (!button->enable()) { + qCWarning(dcGpioController()) << "Could not enable button" << button; + button->deleteLater(); + return info->finish(Thing::ThingErrorHardwareFailure, QT_TR_NOOP("Enabling GPIO button failed.")); + } + + // Settings + connect(thing, &Thing::settingChanged, this, [button, thing](const ParamTypeId ¶mTypeId, const QVariant &value){ + qCDebug(dcGpioController()) << button << "settings changed" << paramTypeId.toString() << value; + if (thing->thingClassId() == gpioButtonRpiThingClassId) { + if (paramTypeId == gpioButtonRpiSettingsRepeateLongPressedParamTypeId) { + button->setRepeateLongPressed(value.toBool()); + } else if (paramTypeId == gpioButtonRpiSettingsLongPressedTimeoutParamTypeId) { + button->setLongPressedTimeout(value.toUInt()); + } + } else if (thing->thingClassId() == gpioButtonBbbThingClassId) { + if (paramTypeId == gpioButtonBbbSettingsRepeateLongPressedParamTypeId) { + button->setRepeateLongPressed(value.toBool()); + } else if (paramTypeId == gpioButtonBbbSettingsLongPressedTimeoutParamTypeId) { + button->setLongPressedTimeout(value.toUInt()); + } + } + }); + + // Button signals + connect(button, &GpioButton::clicked, this, [this, thing, button](){ + qCDebug(dcGpioController()) << button << "clicked"; + if (thing->thingClassId() == gpioButtonRpiThingClassId) { + emit emitEvent(Event(gpioButtonRpiPressedEventTypeId, thing->id())); + } else if (thing->thingClassId() == gpioButtonBbbThingClassId) { + emit emitEvent(Event(gpioButtonBbbPressedEventTypeId, thing->id())); + } + }); + + connect(button, &GpioButton::longPressed, this, [this, thing, button](){ + qCDebug(dcGpioController()) << button << "long pressed"; + if (thing->thingClassId() == gpioButtonRpiThingClassId) { + emit emitEvent(Event(gpioButtonRpiLongPressedEventTypeId, thing->id())); + } else if (thing->thingClassId() == gpioButtonBbbThingClassId) { + emit emitEvent(Event(gpioButtonBbbLongPressedEventTypeId, thing->id())); + } + }); + + m_buttonDevices.insert(button, thing); + + if (thing->thingClassId() == gpioButtonRpiThingClassId) + m_raspberryPiGpioButtons.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), button); + + if (thing->thingClassId() == gpioButtonBbbThingClassId) + m_beagleboneBlackGpioButtons.insert(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt(), button); + } + + return info->finish(Thing::ThingErrorNoError); +} + +void IntegrationPluginGpio::postSetupThing(Thing *thing) +{ + // Gpio output + if (thing->thingClassId() == gpioOutputRpiThingClassId || thing->thingClassId() == gpioOutputBbbThingClassId) { + Gpio *gpio = m_gpioDevices.key(thing); + if (!gpio) + return; + + // Note: restore the pin value to the last cached value + if (thing->thingClassId() == gpioOutputRpiThingClassId) { + qCDebug(dcGpioController()) << "Post setup: restore previouse output state" << gpio << thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool(); + if (thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool()) { + gpio->setValue(Gpio::ValueHigh); + } else { + gpio->setValue(Gpio::ValueLow); + } + } + + if (thing->thingClassId() == gpioOutputBbbThingClassId) { + qCDebug(dcGpioController()) << "Post setup: restore previouse output state" << gpio << thing->stateValue(gpioOutputRpiPowerStateTypeId).toBool(); + if (thing->stateValue(gpioOutputBbbPowerStateTypeId).toBool()) { + gpio->setValue(Gpio::ValueHigh); + } else { + gpio->setValue(Gpio::ValueLow); + } + } + } + + // Gpio input + if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) { + GpioMonitor *monitor = m_monitorDevices.key(thing); + if (!monitor) + return; + + if (thing->thingClassId() == gpioInputRpiThingClassId) { + thing->setStateValue(gpioInputRpiPowerStateTypeId, monitor->value()); + } else if (thing->thingClassId() == gpioInputBbbThingClassId) { + thing->setStateValue(gpioInputBbbPowerStateTypeId, monitor->value()); + } + } + + // Counter + if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { + if (!m_counterTimer) { + m_counterTimer = hardwareManager()->pluginTimerManager()->registerTimer(1); + connect(m_counterTimer, &PluginTimer::timeout, this, [this](){ + foreach (Thing *thing, myThings()) { + if (thing->thingClassId() == counterRpiThingClassId) { + int counterValue = m_counterValues.value(thing->id()); + thing->setStateValue(counterRpiCounterStateTypeId, counterValue); + m_counterValues[thing->id()] = 0; + } + if (thing->thingClassId() == counterBbbThingClassId) { + int counterValue = m_counterValues.value(thing->id()); + thing->setStateValue(counterBbbCounterStateTypeId, counterValue); + } + } + }); + } + } +} + void IntegrationPluginGpio::thingRemoved(Thing *thing) { - if (m_gpioDevices.values().contains(thing)) { + const QList gpioThings = m_gpioDevices.values(); + if (gpioThings.contains(thing)) { Gpio *gpio = m_gpioDevices.key(thing); if (!gpio) return; @@ -271,7 +443,8 @@ void IntegrationPluginGpio::thingRemoved(Thing *thing) delete gpio; } - if (m_monitorDevices.values().contains(thing)) { + const QList monitorThings = m_monitorDevices.values(); + if (monitorThings.contains(thing)) { GpioMonitor *monitor = m_monitorDevices.key(thing); if (!monitor) return; @@ -279,14 +452,31 @@ void IntegrationPluginGpio::thingRemoved(Thing *thing) m_monitorDevices.remove(monitor); if (m_raspberryPiGpioMoniors.values().contains(monitor)) - m_raspberryPiGpios.remove(monitor->gpio()->gpioNumber()); + m_raspberryPiGpioMoniors.remove(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt()); if (m_beagleboneBlackGpioMoniors.values().contains(monitor)) - m_beagleboneBlackGpioMoniors.remove(monitor->gpio()->gpioNumber()); + m_beagleboneBlackGpioMoniors.remove(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt()); delete monitor; } + const QList buttonThings = m_buttonDevices.values(); + if (buttonThings.contains(thing)) { + GpioButton *button = m_buttonDevices.key(thing); + if (!button) + return; + + m_buttonDevices.remove(button); + + if (m_raspberryPiGpioButtons.values().contains(button)) + m_raspberryPiGpioButtons.remove(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt()); + + if (m_beagleboneBlackGpioButtons.values().contains(button)) + m_beagleboneBlackGpioButtons.remove(thing->paramValue(m_gpioParamTypeIds.value(thing->thingClassId())).toInt()); + + delete button; + } + if (m_counterValues.contains(thing->id())) { m_counterValues.remove(thing->id()); } @@ -366,55 +556,6 @@ void IntegrationPluginGpio::executeAction(ThingActionInfo *info) info->finish(Thing::ThingErrorNoError); } -void IntegrationPluginGpio::postSetupThing(Thing *thing) -{ - if (thing->thingClassId() == gpioOutputRpiThingClassId || thing->thingClassId() == gpioOutputBbbThingClassId) { - Gpio *gpio = m_gpioDevices.key(thing); - if (!gpio) - return; - - gpio->setValue(Gpio::ValueLow); - if (thing->thingClassId() == gpioOutputRpiThingClassId) { - thing->setStateValue(gpioOutputRpiPowerStateTypeId, false); - } - if (thing->thingClassId() == gpioOutputBbbThingClassId) { - thing->setStateValue(gpioOutputBbbPowerStateTypeId, false); - } - } - - if (thing->thingClassId() == gpioInputRpiThingClassId || thing->thingClassId() == gpioInputBbbThingClassId) { - GpioMonitor *monitor = m_monitorDevices.key(thing); - if (!monitor) - return; - - if (thing->thingClassId() == gpioInputRpiThingClassId) { - thing->setStateValue(gpioInputRpiPowerStateTypeId, monitor->value()); - } else if (thing->thingClassId() == gpioInputBbbThingClassId) { - thing->setStateValue(gpioInputBbbPowerStateTypeId, monitor->value()); - } - } - - if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { - if (!m_counterTimer) { - m_counterTimer = hardwareManager()->pluginTimerManager()->registerTimer(1); - connect(m_counterTimer, &PluginTimer::timeout, this, [this] (){ - - foreach (Thing *thing, myThings()) { - if (thing->thingClassId() == counterRpiThingClassId) { - int counterValue = m_counterValues.value(thing->id()); - thing->setStateValue(counterRpiCounterStateTypeId, counterValue); - m_counterValues[thing->id()] = 0; - } - if (thing->thingClassId() == counterBbbThingClassId) { - int counterValue = m_counterValues.value(thing->id()); - thing->setStateValue(counterBbbCounterStateTypeId, counterValue); - } - } - }); - } - } -} - QList IntegrationPluginGpio::raspberryPiGpioDescriptors() { // Note: http://www.raspberrypi-spy.co.uk/wp-content/uploads/2012/06/Raspberry-Pi-GPIO-Layout-Model-B-Plus-rotated-2700x900.png @@ -521,22 +662,3 @@ QList IntegrationPluginGpio::beagleboneBlackGpioDescriptors() gpioDescriptors << GpioDescriptor(89, 30, "P8 - LCD_AC_BIAS_E"); return gpioDescriptors; } - -void IntegrationPluginGpio::onGpioValueChanged(const bool &value) -{ - GpioMonitor *monitor = static_cast(sender()); - - Thing *thing = m_monitorDevices.value(monitor); - if (!thing) - return; - - if (thing->thingClassId() == gpioInputRpiThingClassId) { - thing->setStateValue(gpioInputRpiPowerStateTypeId, value); - } else if (thing->thingClassId() == gpioInputBbbThingClassId) { - thing->setStateValue(gpioInputBbbPowerStateTypeId, value); - } else if (thing->thingClassId() == counterRpiThingClassId || thing->thingClassId() == counterBbbThingClassId) { - if (value) { - m_counterValues[thing->id()] += 1; - } - } -} diff --git a/gpio/integrationplugingpio.h b/gpio/integrationplugingpio.h index 68b396c7..ac215d83 100644 --- a/gpio/integrationplugingpio.h +++ b/gpio/integrationplugingpio.h @@ -1,6 +1,6 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -* Copyright 2013 - 2020, nymea GmbH +* Copyright 2013 - 2021, nymea GmbH * Contact: contact@nymea.io * * This file is part of nymea. @@ -31,14 +31,14 @@ #ifndef INTEGRATIONPLUGINGPIO_H #define INTEGRATIONPLUGINGPIO_H -#include "hardware/gpio.h" -#include "hardware/gpiomonitor.h" -#include "gpiodescriptor.h" -#include "hardware/gpiomonitor.h" #include "integrations/integrationplugin.h" #include "plugintimer.h" +#include "gpiodescriptor.h" -#include +// libnymea-gpio +#include "gpio.h" +#include "gpiomonitor.h" +#include "gpiobutton.h" class IntegrationPluginGpio : public IntegrationPlugin { @@ -50,30 +50,35 @@ class IntegrationPluginGpio : public IntegrationPlugin public: explicit IntegrationPluginGpio(); - void setupThing(ThingSetupInfo *info) override; + void init() override; void discoverThings(ThingDiscoveryInfo *info) override; + void setupThing(ThingSetupInfo *info) override; + void postSetupThing(Thing *thing) override; void thingRemoved(Thing *thing) override; void executeAction(ThingActionInfo *info) override; - void postSetupThing(Thing *thing) override; private: + QHash m_gpioParamTypeIds; + QHash m_activeLowParamTypeIds; + QHash m_gpioDevices; QHash m_monitorDevices; + QHash m_buttonDevices; QHash m_raspberryPiGpios; QHash m_raspberryPiGpioMoniors; + QHash m_raspberryPiGpioButtons; QHash m_beagleboneBlackGpios; QHash m_beagleboneBlackGpioMoniors; + QHash m_beagleboneBlackGpioButtons; QList raspberryPiGpioDescriptors(); QList beagleboneBlackGpioDescriptors(); PluginTimer *m_counterTimer = nullptr; QHash m_counterValues; -private slots: - void onGpioValueChanged(const bool &value); }; #endif // INTEGRATIONPLUGINGPIO_H diff --git a/gpio/integrationplugingpio.json b/gpio/integrationplugingpio.json index bf3a9bc9..559010c7 100644 --- a/gpio/integrationplugingpio.json +++ b/gpio/integrationplugingpio.json @@ -2,19 +2,9 @@ "displayName": "Gpio Controller", "name": "GpioController", "id": "127ead55-996a-44ac-ba82-fc3c634e018a", - "paramTypes": [ - { - "id": "bfb31f88-b481-49e1-9a0a-41b156b64efe", - "name": "longPressTime", - "displayName": "Long press time", - "type": "int", - "unit": "Seconds", - "defaultValue": 2 - } - ], "vendors": [ { - "displayName": "Raspberry Pi 2/3", + "displayName": "Raspberry Pi", "name": "raspberryPi", "id": "f0d00b66-bbd8-4a07-8591-ea48a61b229e", "thingClasses": [ @@ -39,6 +29,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "4dfddecc-d41c-4b31-bf4a-04297097bd5c", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "504798eb-1faa-4703-a57a-2778e4bf9a67", "name": "description", @@ -57,7 +54,8 @@ "writable": true, "displayNameEvent": "Power changed", "displayNameAction": "Set power", - "ioType": "digitalOutput" + "ioType": "digitalOutput", + "cached": true } ] }, @@ -81,6 +79,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "d877b7cd-0440-4f49-a6d6-5c679d9f3cc3", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "720bb37e-56e6-419e-878e-8c80aaf7ce32", "name": "description", @@ -101,6 +106,72 @@ } ] }, + { + "id": "1abd4dad-0757-4160-8df1-75c45bd61e6e", + "displayName": "GPIO Button", + "name": "gpioButtonRpi", + "createMethods": [ "discovery" ], + "interfaces": [ "longpressbutton" ], + "paramTypes": [ + { + "id": "234538be-710d-4a0b-9cb9-ac57b47ab14d", + "name": "gpio", + "displayName": "GPIO", + "type": "int", + "defaultValue": -1 + }, + { + "id": "90735212-d518-43c0-8fe9-aaa5362a512d", + "name": "pin", + "displayName": "Pin number", + "type": "int", + "defaultValue": -1 + }, + { + "id": "ad7b1641-bc7a-46d3-b029-d2f7628eb790", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, + { + "id": "5ea2fbf9-fd20-4bd7-b0ed-08f72f18157f", + "name": "description", + "displayName": "Description", + "type": "QString", + "defaultValue": "-" + } + ], + "settingsTypes": [ + { + "id": "d826f02e-7528-4ad5-ac71-f49df988114d", + "name": "repeateLongPressed", + "displayName": "Repeat long pressed", + "type": "bool", + "defaultValue": false + }, + { + "id": "46a25783-3e96-4489-a3f0-15236d938f17", + "name": "longPressedTimeout", + "displayName": "Long pressed timeout [ms]", + "type": "uint", + "minValue": 200, + "defaultValue": 250 + } + ], + "eventTypes": [ + { + "id": "28330833-158c-4f99-9f6e-407ee8f29a4e", + "name": "pressed", + "displayName": "Pressed" + }, + { + "id": "5ad39e3d-b155-4091-a7ef-d843c00d75aa", + "name": "longPressed", + "displayName": "Long pressed" + } + ] + }, { "id": "75b13371-a064-47a7-bb82-e9d93a5b5027", "displayName": "Counter", @@ -122,6 +193,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "2b57c0ed-a7e5-4198-a82a-75c2cf3ca710", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "f7b82516-ed2c-4d73-86fa-957b8b6737e4", "name": "description", @@ -170,6 +248,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "c7114a64-b9de-4d51-a58d-9d5c604a6f32", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "760aa4ed-d933-4188-aec8-16285d763aa5", "name": "description", @@ -188,7 +273,8 @@ "writable": true, "displayNameEvent": "Power changed", "displayNameAction": "Set power", - "ioType": "digitalOutput" + "ioType": "digitalOutput", + "cached": true } ] }, @@ -212,6 +298,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "7b4b7c74-ed0d-4add-8e10-1a356a76c0e7", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "da746cde-2380-4ee5-bf2c-017249fcdeef", "name": "description", @@ -232,6 +325,72 @@ } ] }, + { + "id": "4a4b79b9-7e43-4fd7-840f-31108bef0ee2", + "displayName": "GPIO Button", + "name": "gpioButtonBbb", + "createMethods": [ "discovery" ], + "interfaces": [ "longpressbutton" ], + "paramTypes": [ + { + "id": "7a5ad4d6-2aa3-496f-9fb9-ae46eb8b4376", + "name": "gpio", + "displayName": "GPIO", + "type": "int", + "defaultValue": -1 + }, + { + "id": "4c24d8f5-8b87-457f-a64b-aa52f7f81dc0", + "name": "pin", + "displayName": "Pin number", + "type": "int", + "defaultValue": -1 + }, + { + "id": "bd3fefb3-1204-41ed-8452-1b9d11f265a0", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, + { + "id": "fc7850b7-3b9c-4df9-8153-40f3582213ea", + "name": "description", + "displayName": "Description", + "type": "QString", + "defaultValue": "-" + } + ], + "settingsTypes": [ + { + "id": "292bf500-b7ab-428b-908c-2fedae295ee2", + "name": "repeateLongPressed", + "displayName": "Repeat long pressed", + "type": "bool", + "defaultValue": false + }, + { + "id": "007be75a-bfcd-4039-b8ab-9bce25421894", + "name": "longPressedTimeout", + "displayName": "Long pressed timeout [ms]", + "type": "uint", + "minValue": 200, + "defaultValue": 250 + } + ], + "eventTypes": [ + { + "id": "d02b16a8-a242-41f5-b4e0-d3209849f25e", + "name": "pressed", + "displayName": "Pressed" + }, + { + "id": "11ffeeed-23fe-4cd7-bf15-c95c7250448c", + "name": "longPressed", + "displayName": "Long pressed" + } + ] + }, { "id": "3e311ef1-60c4-4b0e-a2fb-186bff9bd792", "displayName": "Counter", @@ -253,6 +412,13 @@ "type": "int", "defaultValue": -1 }, + { + "id": "8745fbd1-d904-4551-93f4-0f923fcee9b5", + "name": "activeLow", + "displayName": "Active low", + "type": "bool", + "defaultValue": false + }, { "id": "cba6a527-9f5c-4c05-8602-60e0c920fd26", "name": "description", diff --git a/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-de.ts b/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-de.ts index 29434158..99deba49 100644 --- a/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-de.ts +++ b/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-de.ts @@ -4,20 +4,14 @@ GpioController - + Gpio Controller The name of the plugin GpioController ({127ead55-996a-44ac-ba82-fc3c634e018a}) GPIO-Controller - - Raspberry Pi 2/3 - The name of the vendor ({f0d00b66-bbd8-4a07-8591-ea48a61b229e}) - Raspberry Pi 2/3 - - - - + + GPIO Output The name of the ThingClass ({75d54a59-f9b0-4bc4-a86c-6b1fc47e0663}) ---------- @@ -25,12 +19,12 @@ The name of the ThingClass ({3885c520-e202-4435-88f6-3c35c362b2e6}) - - - - - - + + + + + + Counter The name of the ParamType (ThingClass: counterBbb, EventType: counter, ID: {fb5181d0-644b-4ab7-afa0-b7ddc8951526}) ---------- @@ -46,8 +40,35 @@ The name of the ThingClass ({75b13371-a064-47a7-bb82-e9d93a5b5027}) - - + + + + + + + + + Active low + The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {8745fbd1-d904-4551-93f4-0f923fcee9b5}) +---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {bd3fefb3-1204-41ed-8452-1b9d11f265a0}) +---------- +The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {7b4b7c74-ed0d-4add-8e10-1a356a76c0e7}) +---------- +The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {c7114a64-b9de-4d51-a58d-9d5c604a6f32}) +---------- +The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {2b57c0ed-a7e5-4198-a82a-75c2cf3ca710}) +---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {ad7b1641-bc7a-46d3-b029-d2f7628eb790}) +---------- +The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {d877b7cd-0440-4f49-a6d6-5c679d9f3cc3}) +---------- +The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {4dfddecc-d41c-4b31-bf4a-04297097bd5c}) + + + + + Counter changed The name of the EventType ({fb5181d0-644b-4ab7-afa0-b7ddc8951526}) of ThingClass counterBbb ---------- @@ -55,101 +76,122 @@ The name of the EventType ({891bc1ce-2f9b-4518-aed9-90e78bc2409e}) of ThingClass - - - - - - + + + + + + + + GPIO The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {68bc0f3b-18c3-4a60-a2df-85bc0605caec}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {7a5ad4d6-2aa3-496f-9fb9-ae46eb8b4376}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {20773255-4576-4c8e-8c8b-051902919761}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {62a9596d-fc7d-4554-9f45-9803635da619}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {a6feb722-1dc9-4262-96b0-96489507508f}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {234538be-710d-4a0b-9cb9-ac57b47ab14d}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {b45ca4a8-c67a-411c-957c-0e78e1f12c0b}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {9eda783f-6d9f-4d39-986d-d2cbfff5a7dd}) - - Long press time - The name of the ParamType (ThingClass: gpioController, Type: plugin, ID: {bfb31f88-b481-49e1-9a0a-41b156b64efe}) - - - - - + + Long pressed - The name of the EventType ({6b439e89-2cac-482a-b012-452c7c665acb}) of ThingClass gpioInputBbb + The name of the EventType ({11ffeeed-23fe-4cd7-bf15-c95c7250448c}) of ThingClass gpioButtonBbb ---------- -The name of the EventType ({0df945d3-38df-4560-b42a-12b05545904d}) of ThingClass gpioInputRpi +The name of the EventType ({5ad39e3d-b155-4091-a7ef-d843c00d75aa}) of ThingClass gpioButtonRpi - - - - - - + + + + + + + + Pin number The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {f9da4a22-b010-4823-9b1c-d1f422c3ad2b}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {4c24d8f5-8b87-457f-a64b-aa52f7f81dc0}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {f383bf1d-3ac0-4808-a82c-18748baf085d}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {14f65be0-ee84-42e4-8fcb-d98a9926a247}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {b2c194bd-1aef-4851-a290-dd45269cc592}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {90735212-d518-43c0-8fe9-aaa5362a512d}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {efd3df4a-d2b6-44f3-9095-7bba07891735}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {2204d278-7bc7-407f-ac82-ce3ae1d5779c}) - - - - - - + + + + + + + + Description The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {cba6a527-9f5c-4c05-8602-60e0c920fd26}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {fc7850b7-3b9c-4df9-8153-40f3582213ea}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {da746cde-2380-4ee5-bf2c-017249fcdeef}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {760aa4ed-d933-4188-aec8-16285d763aa5}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {f7b82516-ed2c-4d73-86fa-957b8b6737e4}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {5ea2fbf9-fd20-4bd7-b0ed-08f72f18157f}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {720bb37e-56e6-419e-878e-8c80aaf7ce32}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {504798eb-1faa-4703-a57a-2778e4bf9a67}) - - + + + Power changed - The name of the EventType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb + The name of the EventType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb +---------- +The name of the EventType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb ---------- The name of the EventType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClass gpioOutputRpi - - - - - - + + + + + + + + Power - The name of the ParamType (ThingClass: gpioOutputBbb, ActionType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) + The name of the ParamType (ThingClass: gpioInputBbb, EventType: power, ID: {22440876-417a-4d57-8e01-efe26ef9f235}) +---------- +The name of the StateType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb +---------- +The name of the ParamType (ThingClass: gpioOutputBbb, ActionType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, EventType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) ---------- @@ -163,8 +205,17 @@ The name of the StateType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClass - - + + + GPIO Button + The name of the ThingClass ({4a4b79b9-7e43-4fd7-840f-31108bef0ee2}) +---------- +The name of the ThingClass ({1abd4dad-0757-4160-8df1-75c45bd61e6e}) + + + + + GPIO Input The name of the ThingClass ({ffd2aa29-55cc-4824-ba95-c311784f7824}) ---------- @@ -172,8 +223,29 @@ The name of the ThingClass ({6aff228b-0410-4ef9-9593-51e8639aacea}) - - + + + Powered + The name of the ParamType (ThingClass: gpioInputRpi, EventType: power, ID: {57f1b7cc-26c8-434b-ba04-d3077dc886c8}) +---------- +The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi + + + + + Powered changed + The name of the EventType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi + + + + + Raspberry Pi + The name of the vendor ({f0d00b66-bbd8-4a07-8591-ea48a61b229e}) + + + + + Set power The name of the ActionType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb ---------- @@ -181,31 +253,16 @@ The name of the ActionType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClas - - - Pressed changed - The name of the EventType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb ----------- -The name of the EventType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi - - - - - - - + + Pressed - The name of the ParamType (ThingClass: gpioInputBbb, EventType: pressed, ID: {22440876-417a-4d57-8e01-efe26ef9f235}) + The name of the EventType ({d02b16a8-a242-41f5-b4e0-d3209849f25e}) of ThingClass gpioButtonBbb ---------- -The name of the StateType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb ----------- -The name of the ParamType (ThingClass: gpioInputRpi, EventType: pressed, ID: {57f1b7cc-26c8-434b-ba04-d3077dc886c8}) ----------- -The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi +The name of the EventType ({28330833-158c-4f99-9f6e-407ee8f29a4e}) of ThingClass gpioButtonRpi - + Beaglebone Black The name of the vendor ({7835d14b-b455-49bd-9f31-72c6e8c3033d}) @@ -214,27 +271,33 @@ The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass IntegrationPluginGpio - + No GPIOs found on this system. Error setting up GPIO thing - + Exporting GPIO failed. Error setting up GPIO thing - + Configuring output GPIO failed. Error setting up GPIO thing - - - + + Configuring GPIO active low failed. + Error setting up GPIO thing + + + + + + Setting GPIO value failed. Error setting up GPIO thing ---------- @@ -242,20 +305,25 @@ Error executing GPIO action - - + + Enabling GPIO monitor failed. Error setting up GPIO thing - + + Enabling GPIO button failed. + + + + No GPIOs available on this system. Error discovering GPIO devices - + GPIO not found Error executing GPIO action diff --git a/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-en_US.ts b/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-en_US.ts index 09294fde..6fcc4804 100644 --- a/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-en_US.ts +++ b/gpio/translations/127ead55-996a-44ac-ba82-fc3c634e018a-en_US.ts @@ -4,20 +4,14 @@ GpioController - + Gpio Controller The name of the plugin GpioController ({127ead55-996a-44ac-ba82-fc3c634e018a}) - - Raspberry Pi 2/3 - The name of the vendor ({f0d00b66-bbd8-4a07-8591-ea48a61b229e}) - - - - - + + GPIO Output The name of the ThingClass ({75d54a59-f9b0-4bc4-a86c-6b1fc47e0663}) ---------- @@ -25,12 +19,12 @@ The name of the ThingClass ({3885c520-e202-4435-88f6-3c35c362b2e6}) - - - - - - + + + + + + Counter The name of the ParamType (ThingClass: counterBbb, EventType: counter, ID: {fb5181d0-644b-4ab7-afa0-b7ddc8951526}) ---------- @@ -46,8 +40,35 @@ The name of the ThingClass ({75b13371-a064-47a7-bb82-e9d93a5b5027}) - - + + + + + + + + + Active low + The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {8745fbd1-d904-4551-93f4-0f923fcee9b5}) +---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {bd3fefb3-1204-41ed-8452-1b9d11f265a0}) +---------- +The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {7b4b7c74-ed0d-4add-8e10-1a356a76c0e7}) +---------- +The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {c7114a64-b9de-4d51-a58d-9d5c604a6f32}) +---------- +The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {2b57c0ed-a7e5-4198-a82a-75c2cf3ca710}) +---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {ad7b1641-bc7a-46d3-b029-d2f7628eb790}) +---------- +The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {d877b7cd-0440-4f49-a6d6-5c679d9f3cc3}) +---------- +The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {4dfddecc-d41c-4b31-bf4a-04297097bd5c}) + + + + + Counter changed The name of the EventType ({fb5181d0-644b-4ab7-afa0-b7ddc8951526}) of ThingClass counterBbb ---------- @@ -55,101 +76,122 @@ The name of the EventType ({891bc1ce-2f9b-4518-aed9-90e78bc2409e}) of ThingClass - - - - - - + + + + + + + + GPIO The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {68bc0f3b-18c3-4a60-a2df-85bc0605caec}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {7a5ad4d6-2aa3-496f-9fb9-ae46eb8b4376}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {20773255-4576-4c8e-8c8b-051902919761}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {62a9596d-fc7d-4554-9f45-9803635da619}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {a6feb722-1dc9-4262-96b0-96489507508f}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {234538be-710d-4a0b-9cb9-ac57b47ab14d}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {b45ca4a8-c67a-411c-957c-0e78e1f12c0b}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {9eda783f-6d9f-4d39-986d-d2cbfff5a7dd}) - - Long press time - The name of the ParamType (ThingClass: gpioController, Type: plugin, ID: {bfb31f88-b481-49e1-9a0a-41b156b64efe}) - - - - - + + Long pressed - The name of the EventType ({6b439e89-2cac-482a-b012-452c7c665acb}) of ThingClass gpioInputBbb + The name of the EventType ({11ffeeed-23fe-4cd7-bf15-c95c7250448c}) of ThingClass gpioButtonBbb ---------- -The name of the EventType ({0df945d3-38df-4560-b42a-12b05545904d}) of ThingClass gpioInputRpi +The name of the EventType ({5ad39e3d-b155-4091-a7ef-d843c00d75aa}) of ThingClass gpioButtonRpi - - - - - - + + + + + + + + Pin number The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {f9da4a22-b010-4823-9b1c-d1f422c3ad2b}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {4c24d8f5-8b87-457f-a64b-aa52f7f81dc0}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {f383bf1d-3ac0-4808-a82c-18748baf085d}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {14f65be0-ee84-42e4-8fcb-d98a9926a247}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {b2c194bd-1aef-4851-a290-dd45269cc592}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {90735212-d518-43c0-8fe9-aaa5362a512d}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {efd3df4a-d2b6-44f3-9095-7bba07891735}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {2204d278-7bc7-407f-ac82-ce3ae1d5779c}) - - - - - - + + + + + + + + Description The name of the ParamType (ThingClass: counterBbb, Type: thing, ID: {cba6a527-9f5c-4c05-8602-60e0c920fd26}) ---------- +The name of the ParamType (ThingClass: gpioButtonBbb, Type: thing, ID: {fc7850b7-3b9c-4df9-8153-40f3582213ea}) +---------- The name of the ParamType (ThingClass: gpioInputBbb, Type: thing, ID: {da746cde-2380-4ee5-bf2c-017249fcdeef}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, Type: thing, ID: {760aa4ed-d933-4188-aec8-16285d763aa5}) ---------- The name of the ParamType (ThingClass: counterRpi, Type: thing, ID: {f7b82516-ed2c-4d73-86fa-957b8b6737e4}) ---------- +The name of the ParamType (ThingClass: gpioButtonRpi, Type: thing, ID: {5ea2fbf9-fd20-4bd7-b0ed-08f72f18157f}) +---------- The name of the ParamType (ThingClass: gpioInputRpi, Type: thing, ID: {720bb37e-56e6-419e-878e-8c80aaf7ce32}) ---------- The name of the ParamType (ThingClass: gpioOutputRpi, Type: thing, ID: {504798eb-1faa-4703-a57a-2778e4bf9a67}) - - + + + Power changed - The name of the EventType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb + The name of the EventType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb +---------- +The name of the EventType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb ---------- The name of the EventType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClass gpioOutputRpi - - - - - - + + + + + + + + Power - The name of the ParamType (ThingClass: gpioOutputBbb, ActionType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) + The name of the ParamType (ThingClass: gpioInputBbb, EventType: power, ID: {22440876-417a-4d57-8e01-efe26ef9f235}) +---------- +The name of the StateType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb +---------- +The name of the ParamType (ThingClass: gpioOutputBbb, ActionType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) ---------- The name of the ParamType (ThingClass: gpioOutputBbb, EventType: power, ID: {82b567c6-a33c-484e-b5e7-e04795498d00}) ---------- @@ -163,8 +205,17 @@ The name of the StateType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClass - - + + + GPIO Button + The name of the ThingClass ({4a4b79b9-7e43-4fd7-840f-31108bef0ee2}) +---------- +The name of the ThingClass ({1abd4dad-0757-4160-8df1-75c45bd61e6e}) + + + + + GPIO Input The name of the ThingClass ({ffd2aa29-55cc-4824-ba95-c311784f7824}) ---------- @@ -172,8 +223,29 @@ The name of the ThingClass ({6aff228b-0410-4ef9-9593-51e8639aacea}) - - + + + Powered + The name of the ParamType (ThingClass: gpioInputRpi, EventType: power, ID: {57f1b7cc-26c8-434b-ba04-d3077dc886c8}) +---------- +The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi + + + + + Powered changed + The name of the EventType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi + + + + + Raspberry Pi + The name of the vendor ({f0d00b66-bbd8-4a07-8591-ea48a61b229e}) + + + + + Set power The name of the ActionType ({82b567c6-a33c-484e-b5e7-e04795498d00}) of ThingClass gpioOutputBbb ---------- @@ -181,31 +253,16 @@ The name of the ActionType ({06843766-358e-44b0-8d52-2b46ef98459a}) of ThingClas - - - Pressed changed - The name of the EventType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb ----------- -The name of the EventType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi - - - - - - - + + Pressed - The name of the ParamType (ThingClass: gpioInputBbb, EventType: pressed, ID: {22440876-417a-4d57-8e01-efe26ef9f235}) + The name of the EventType ({d02b16a8-a242-41f5-b4e0-d3209849f25e}) of ThingClass gpioButtonBbb ---------- -The name of the StateType ({22440876-417a-4d57-8e01-efe26ef9f235}) of ThingClass gpioInputBbb ----------- -The name of the ParamType (ThingClass: gpioInputRpi, EventType: pressed, ID: {57f1b7cc-26c8-434b-ba04-d3077dc886c8}) ----------- -The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass gpioInputRpi +The name of the EventType ({28330833-158c-4f99-9f6e-407ee8f29a4e}) of ThingClass gpioButtonRpi - + Beaglebone Black The name of the vendor ({7835d14b-b455-49bd-9f31-72c6e8c3033d}) @@ -214,27 +271,33 @@ The name of the StateType ({57f1b7cc-26c8-434b-ba04-d3077dc886c8}) of ThingClass IntegrationPluginGpio - + No GPIOs found on this system. Error setting up GPIO thing - + Exporting GPIO failed. Error setting up GPIO thing - + Configuring output GPIO failed. Error setting up GPIO thing - - - + + Configuring GPIO active low failed. + Error setting up GPIO thing + + + + + + Setting GPIO value failed. Error setting up GPIO thing ---------- @@ -242,20 +305,25 @@ Error executing GPIO action - - + + Enabling GPIO monitor failed. Error setting up GPIO thing - + + Enabling GPIO button failed. + + + + No GPIOs available on this system. Error discovering GPIO devices - + GPIO not found Error executing GPIO action