Inputs to Generic sensors

I guess I am being not very smart but where do I create the connectivity for the outputs of Simple Garage generic thing. I have both a generic temperature sensor for which I copied your example where the stateName is “input”. same goes for the humidity sensor. So I am going to try the Garage generic thing next. But I am guessing there are only 2 outputs for this one. I assume they are Open, Close. Also Is there a way to input the states which the sensor/acuator has.

First are my guesses correct and in the magic I need to define 2 separate outputs (i.e. one for each open close and stop) how do I do that. Not clear from the temperature sensor input as that goes in the opposite direction. Seems it should have ThingAction but what goes in it. Not clear to me.

Edit: The garadget has a mode to communicate over mqtt. So I am trying to figure out the correct (I assume magic) to connect and monitor the state and actions to open and close commands from the generic garage thing. Help would be appreciated. The opening and closing outputs of the simple garage thing only seem to connect to gateway devices (in my case tasmota) and not allow/support the use of mqtt (ie why I think magic is needed). Garadget sends the state of the door (open, opening, closed, closed) (it uses a light beam to detect if the door is open or not) as well as receiving commands to open or close the door.

as I suspect simple garage generic thing will not accept my status inputs, I decided
to take this a step further, I decided to create/modify a plugin. I failed.
what am I doing wrong?

I did
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key A1A19ED6
sudo apt-add-repository -s “deb http://repository.nymea.io lsb_release -cs main”
sudo apt-get update
sudo apt-get install nymea-sdk
sudo apt-get build-dep nymea-plugins

I downloaded the various nymea git modules but the nymea-remoteproxyclient was not found (by git) even after I created a developer token as required by git. (I did not qmake, make or make install) as it seemed QTcreator would take care of that.

I fixed the LD_LIBRARY_PATH as directed

results as follows:

Directions were to open .pro but Nothing existed so I selected New in QTcreator.
but never got anywhere (yes it did create a directory with a file with the .pro extension) (it gave a lot of feedback of unknowns about Q_OBJECT and Thing stuff)

so decided to start over and select nymea.pro from the nymea directory (i.e. git downloaded) assuming it would fully compile as needed.
on opening the nymea.pro file I got the output below (I have replaced my home directory user name with username)

Project MESSAGE: Building nymea with tests
Project MESSAGE: ============================================
Project MESSAGE: Qt version: 5.12.8
Project MESSAGE: Copyright 2013 - 2021
Project MESSAGE: Building nymea version 0.28.1
Project MESSAGE: JSON-RPC API version 5.6
Project MESSAGE: Source directory: /home/username/nymea
Project MESSAGE: Build directory: /home/username/build-nymea-Desktop-Debug
Project MESSAGE: Translations: /home/username/nymea/translations/nymead-cs.ts /home/username/nymea/translations/nymead-da.ts /home/username/nymea/translations/nymead-de.ts /home/username/nymea/translations/nymead-en_US.ts /home/username/nymea/translations/nymead-es.ts /home/username/nymea/translations/nymead-fi.ts /home/username/nymea/translations/nymead-fr.ts /home/username/nymea/translations/nymead-it.ts /home/username/nymea/translations/nymead-nl.ts /home/username/nymea/translations/nymead-pt.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts
Project MESSAGE: Debug build
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with udev support
Project MESSAGE: Building with JS plugin support
Project MESSAGE: Building with Python plugin support
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project ERROR: Unknown module(s) in QT: qml
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project ERROR: Unknown module(s) in QT: qml
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building nymea with tests
Project MESSAGE: ============================================
Project MESSAGE: Qt version: 5.12.8
Project MESSAGE: Copyright 2013 - 2021
Project MESSAGE: Building nymea version 0.28.1
Project MESSAGE: JSON-RPC API version 5.6
Project MESSAGE: Source directory: /home/username/nymea
Project MESSAGE: Build directory: /home/username/build-nymea-Desktop-Debug
Project MESSAGE: Translations: /home/username/nymea/translations/nymead-cs.ts /home/username/nymea/translations/nymead-da.ts /home/username/nymea/translations/nymead-de.ts /home/username/nymea/translations/nymead-en_US.ts /home/username/nymea/translations/nymead-es.ts /home/username/nymea/translations/nymead-fi.ts /home/username/nymea/translations/nymead-fr.ts /home/username/nymea/translations/nymead-it.ts /home/username/nymea/translations/nymead-nl.ts /home/username/nymea/translations/nymead-pt.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts
Project MESSAGE: Debug build
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with udev support
Project MESSAGE: Building with JS plugin support
Project MESSAGE: Building with Python plugin support
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project ERROR: Unknown module(s) in QT: qml
Project ERROR: Unknown module(s) in QT: qml
Project MESSAGE: Building nymea with tests
Project MESSAGE: ============================================
Project MESSAGE: Qt version: 5.12.8
Project MESSAGE: Copyright 2013 - 2021
Project MESSAGE: Building nymea version 0.28.1
Project MESSAGE: JSON-RPC API version 5.6
Project MESSAGE: Source directory: /home/username/nymea
Project MESSAGE: Build directory: /home/username/build-nymea-Desktop-Debug
Project MESSAGE: Translations: /home/username/nymea/translations/nymead-cs.ts /home/username/nymea/translations/nymead-da.ts /home/username/nymea/translations/nymead-de.ts /home/username/nymea/translations/nymead-en_US.ts /home/username/nymea/translations/nymead-es.ts /home/username/nymea/translations/nymead-fi.ts /home/username/nymea/translations/nymead-fr.ts /home/username/nymea/translations/nymead-it.ts /home/username/nymea/translations/nymead-nl.ts /home/username/nymea/translations/nymead-pt.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-de.ts /home/username/nymea/plugins/mock/translations/727a4a9a-c187-446f-aadf-f1b2220607d1-en_US.ts
Project MESSAGE: Debug build
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with udev support
Project MESSAGE: Building with JS plugin support
Project MESSAGE: Building with Python plugin support
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project ERROR: Unknown module(s) in QT: qml
Project MESSAGE: Building with QtSerialBus support.
Project ERROR: Unknown module(s) in QT: qml
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.
Project MESSAGE: Building with QtSerialBus support.

did not look right to me but don’t know what is wrong. But I boldly took the next step anyways.

I could never find a play button but ctrl R in QTCreator seems to run an action but with the following error:
make: *** [/home/username/build-nymea-Desktop-Debug/Makefile:97: warning: sub-libnymea-core-qmake_all] Error 3

/home/username/build-nymea-Desktop-Debug/ directory was built but no executable exists there with the following in that directory:

directory /home/username/build-nymea-Desktop-Debug/libnymea
directory /home/username/build-nymea-Desktop-Debug/libnymea-core
/home/username/build-nymea-Desktop-Debug/Makefile
/home/username/build-nymea-Desktop-Debug/version.h
/home/username/build-nymea-Desktop-Debug/.qmake.stash

so I looked at the installation of nymea in synaptic and found libnymea1 was there again.
further investigation showed that libnymea1-dev was not installed (as I expected) but as shown below:

libnymea1-dev:
	Depends: libnymea1 (=0.25.1+202101291804~focal1) but 0.28.1+202107162128~focal1 is to be installed


libnymea1 (=0.25.1+202101291804~focal1)
replaces libguh1-dev

I am on Ubuntu 20.04 up to date.
Not sure what to do now!
Ok, I am not a programmer but am giving this a shot.

Hi @hiflyer,

I took a look at the generic garage things and indeed there seems to be something missing… Anyhow, trying to answer your questions one by one:

First, yes, you’re right that you’ll need a mqtt client thing and some magic (rule or script, both should work) to make it talk MQTT. Generic I/O connections in the settings only work for simple On/Off swtiches, but not when you need more stuff, like topics and payloads as it’s the case for MQTT.

What sould work for now already, is to connect the state changes for openingOutput and closingOutput and send your MQTT commands there. What won’t work with this generic garage door, is to report back the actual state to nymea.

There are 3 generic garage door things in total for now:

  • Impulse based garage door: This one would be used if you connect to garage door’s impulse input (most of the driver do have such an impulse input) via a relay. Not what you want with your garadget thingie.
  • Simple garage door: One would use this with a garage driver that has 2 inputs, one for open and one for close.
  • Garage door with position control: This one is very similar to the previous one, but additionally has a setting for how long the door would take to open/close and timing the output control with that, so it would allow setting a more precise position.

Now, thinking about it, I believe the second and third could be merged into one… (Well, the second could be dropped and just the third one kept mostly as is).
And also, there’s one missing that would allow to report back the actual state which would suit your case.

I suppose the reason why it’s that way currently is because noone thought about this use case when implementing those. They were really meant to be used with relays (as all of the I/O connections stuff) but not actually with MQTT becasue, to be honest, the best would be to create a dedicated plugin for garadget. And with that, on to your second post :slight_smile:

So, to begin with, in order to create a plugin, you don’t need to build nymea itself. You start by installing:
sudo apt-get install nymea-sdk libnymea-dev

Then, using QtCreator, you should find a wizard that will guide you to create a basic plugin code folder (including it’s .pro file) and it should actually build when clicking the build button.

Next steps would be to adjust the .json file and describe the garadget thing class.

Once done, you should be able to load the plugin (check the docs on building/testing) and add the thing. It obviously won’t do anything useful at that point but being a beginner, I’ll stop with overloading you with information at this point and we’ll continue when you’ve reached this point. It shouldn’t be too hard to get this going if we work together… Let me know when you’ve reached this point and we’ll start with talking to the garadget thing together.

Feel free to join one of the real time chat groups and ping me there, it will probably be easier than for this than the forum.

Ok, sounds good but where do I sign up for the real time chat groups

You’ll find them in nymea:app in the main menu (Telegram or Discord - whichever you prefer)

So here are the process to figure out where the problems are. It appears that the repository has an issue some place. below are the steps I followed to show that the 20.04 is not working but the 21.04 version is working. So where do I go from here as I prefer not to upgrade till the LTS version of ubuntu comes out.

Notes: on testing I did (I can get back on the link if you have time)
tried on my old laptop slower but still works and got the same resuls (its on Ubuntu 20.04 also)

installed Ubuntu 20.04 to a very old and slow computer (accepted all defaults)
selected erase entire disk
sudo apt update
sudo apt upgrade
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key A1A19ED6
sudo apt-add-repository -s “deb http://repository.nymea.io lsb_release -cs main”
sudo apt-get update
sudo apt-get install nymea-sdk
sudo apt-get install libnymea-dev

response of apt-get
Reading package lists… Done
Building dependency tree
Reading state information… Done
libnymea-dev is already the newest version (0.28.1+202107162128~focal1).
libnymea-dev set to manually installed.
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm9
Use ‘sudo apt autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

started QTcreator
did the create nymea thing but it failed just like on my machine.
details of initial screen show

cstddef:50:10: fatal error: 'stddef.h' file not found
integrationplugintestrun.h:1:1: note: in file included from /home/beckstein/testrun/integrationplugintestrun.h:1:
integrationplugintestrun.h:24:10: note: in file included from /home/beckstein/testrun/integrationplugintestrun.h:24:
integrationplugin.h:34:10: note: in file included from /usr/include/nymea/integrations/integrationplugin.h:34:
libnymea.h:34:10: note: in file included from /usr/include/nymea/libnymea.h:34:
QtGlobal:1:10: note: in file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/QtGlobal:1:
qglobal.h:46:12: note: in file included from /usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:46:

sudo apt install synaptic
removed all nymea componets including lib components showing in synaptic
sudo apt autoremove

rm .config/QtProject
software updater upgrade to 21.04
(i did thru graphical unit not directly thru apt)
removed obsolete software
after reboot

software & update to re-enable the nymea repository
sudo apt update
sudo apt-get install nymea-sdk
sudo apt-get install libnymea-dev
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
libnymea-dev is already the newest version (0.28.1+202107162128~hirsute1).
libnymea-dev set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

started qtcreator
no red this time but does issue warning
This file is not part of any project. The code model might have issues parsing this file properly.

looking a synaptic, libnymea1-dev this is a 0.25.1+202101291804~focal1 version no longer exists.
in 20.04 it existed but would not install.
in 20.04 libnymea-dev 0.28.1+202107162128~focal1 is installed
but
in 21.04 libnymea-dev 0.28.1+202107162128~focal1 is installed
nymea-qtcreator-wizards 0.0.9+202105141847~5fd1053~hirsute is installed
nymea-sdk 0.28.1+202107162128~hirsute1 is installed
the ubuntu 21.04 qt5 stuff is on version 5.15-2
the ubuntu 20.04 qt5 stuff is on version 5.12.8

so this is a very old and very slow laptop I am working on.
I would prefer not to upgrade my normal laptop to ubuntu 21.04 as I have a different issue with Bareos
(my backup software will have when the next lts comes out)
also all my normal tool are not installed on this old computer.

so where do I go from here as it looks like the repository seems to be missing something?

Indeed, libnymea1-dev should not exist any more in the repos, it was renamed to libnymea-dev (mind the “1”). I’ve cleaned it up from the repos… Remove that one if you still have it installed.

Also, in 21.04 you shouldn’t add the “focal” repository but instead the “hirsute” one…

That said, none of those seem to be related to the missing stddef.h… That would be caused by a missing linux-libc-dev. Now, how you’ve installed all the Qt packages without having that one installed is beyond me… Perhaps try to sudo apt-get install build-essential

repository in 21.04 was pointing at hirsute

nope build-essential was not it.
build-essential was already installed. I tested the gcc compiler as well (yes it was already installed) and i created a simple c program to printf to stdio. It worked.
other ideas?

also reinstalled nymea-sdk from clean install but still the same. and the linux-libc-dev is installed

using find found
/usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h
/usr/lib/gcc/x86_64-linux-gnu/7/include/stddef.h
/usr/lib/gcc/x86_64-linux-gnu/8/include/stddef.h
/usr/lib/llvm-10/lib/clang/10.0.0/include/stddef.h
/usr/include/linux/stddef.h
/usr/src/linux-headers-5.4.0-80/include/linux/stddef.h
/usr/src/linux-headers-5.4.0-80/include/uapi/linux/stddef.h
/usr/src/linux-hwe-5.4-headers-5.4.0-56/include/linux/stddef.h
/usr/src/linux-hwe-5.4-headers-5.4.0-56/include/uapi/linux/stddef.h
/usr/src/linux-headers-5.3.0-28/include/linux/stddef.h
/usr/src/linux-headers-5.3.0-28/include/uapi/linux/stddef.h
/usr/src/linux-headers-5.4.0-81/include/linux/stddef.h
/usr/src/linux-headers-5.4.0-81/include/uapi/linux/stddef.h

started qtcreator from a terminal.
in the terminal when I ran thru the process of creating nymea I got the following:
Field DeveloperName has unsupported keys: trPlaceholder
Field DeveloperMail has unsupported keys: trPlaceholder
Field DeveloperName has unsupported keys: trPlaceholder
Field DeveloperMail has unsupported keys: trPlaceholder
Info: creating stash file /home/beckstein/nymea-testing/build-test-Desktop-Debug/.qmake.stash
is this a problem?

Those wouldn’t be problems, no… just something about translations which we don’t need to care at this point…

The last message, about the stash file is OK.

Ok, I give up. I upgraded my old laptop to Ubuntu 21.04. QTCreator now seems to be working.
created a project Garadget.
I copied the simplegaragedoor modifying all id with new ids as follows
{
“name”: “Garadget”,
“displayName”: “Remote Garage Door Opener”,
“id”: “19de2ec0-f1aa-4f0f-9e77-d0864d61c89b”,
“vendors”: [
{
“name”: “Garadget”,
“displayName”: “Garadget Inc.”,
“id”: “e2d91562-457a-4c9e-a561-bb63c1837f35”,
“thingClasses”: [
{
“name”: “Garadget”,
“displayName”: “Garadget”,
“id”: “c419ad91-98dd-4f9f-9dea-c215328331ea”,
“setupMethod”: “JustAdd”,
“createMethods”: [“User”],
“interfaces”: [ ],
“paramTypes”: [

                ],
                "stateTypes": [
                {
                    "id": "4802224a-6f0d-41d1-a7ef-e77d0dd10f90",
                    "name": "state",
                    "displayName": "State",
                    "displayNameEvent": "State changed",
                    "type": "QString",
                    "possibleValues": ["open", "closed", "opening", "closing", "intermediate"],
                    "defaultValue": "closed"
                },
                {
                    "id": "2eb5359e-ea22-4ed4-bf0f-06003054cf68",
                    "name": "moving",
                    "displayName": "Moving",
                    "displayNameEvent": "Moving changed",
                    "type": "bool",
                    "defaultValue": false
                },
                {
                    "id": "51e24c98-4524-4f42-82a6-e8f3179b4135",
                    "name": "percentage",
                    "displayName": "Open position",
                    "displayNameEvent": "Open position changed",
                    "displayNameAction": "Set open position",
                    "type": "int",
                    "minValue": 0,
                    "maxValue": 100,
                    "defaultValue": 100,
                    "writable": true
                },
                {
                    "id": "5057a201-f23b-4690-b616-71e3b2f90d53",
                    "name": "openingOutput",
                    "displayName": "Opening output",
                    "displayNameEvent": "Opening output changed",
                    "type": "bool",
                    "defaultValue": false,
                    "ioType": "digitalInput"
                },
                {
                    "id": "46b32eda-c6fd-4087-8dee-b6c328a13e1f",
                    "name": "closingOutput",
                    "displayName": "Closing output",
                    "displayNameEvent": "Closing output changed",
                    "type": "bool",
                    "defaultValue": false,
                    "ioType": "digitalInput"
                }
                ],
                "actionTypes": [
                {
                    "id": "9e1b71de-491c-48e2-9552-0edccca1ea2e",
                    "name": "open",
                    "displayName": "Open"
                },
                {
                    "id": "445094b4-cdc4-4689-b8de-4d4e014f9952",
                    "name": "close",
                    "displayName": "Close"
                },
                {
                    "id": "77644a1c-39dc-447b-8c78-c9fb5d3e4597",
                    "name": "stop",
                    "displayName": "Stop"
                }
                ],
                "eventTypes": [

                ]
            }
        ]
    }
]

}

I added LD_LIBRARY_PATH to my qtcreator run environment as described in the manual
I added NYMEA_PLUGINS_PATH to my qtcreator run environment as described in the manual
I installed nymead via synaptic
I installed nymea-app via synaptic
I pointed the qtcreator custom executable to /usr/bin/nymead and set -n to parameters
I set a working directory
I set the build run to debug

started nymea-app
executed run in qtcreator
in nymea-app selected the local nymead
this allowed me to add Garadget as shown above and looks like simple garage (it was the only possibility)

so I set the interfaces to simplegaragedoor and this worked as well.
So I assume that the setup I have is working as it should

I have installed nymea-mqtt-server (I assume this is needed for my next steps below)

BUT when I set the interfaced to Garadget of course it fails as I have not defined it.
So what are the next steps to create this interface. I am not clear from the manual.
and what do I do such that I can connect to the internal browser to at lease the open and close?

So, the next step would be to start working on the code. I’d say we start with finding the garagdet in the network.

First, try to find a way how you can discover the garagdet thing in the network. Perhaps ZeroConf/mdns could work? Try to run avahi-browse -avr and see if your garadget devices shows up.

I do not find on avahi-browse. On the other hand via my router, I have the ipv4 address, mac, and network name. Is this what you are trying to identify via avahi?

I have already set the device magic to work with a generic thing to detect the status via mqtt and allow magic to activate the device to close the garage door.

I still wish to proceed with the attempt to create a plugin.