Creating a new Plugin type (interfaces)

@mzanetti

I’m developping a Nymea plugin for a Mect Device (a 4.3" HMI Panel with TCP Modbus interface) that acts like a Burglar Alarm (see my post Disabling items for a “possibleValues” List).

I haven’t found an “interfaces” to start with, so an instance of this type of object appears in nymea as “uncategorized”.

I would need it, like does the “thermostat” interface, to appear as “Anti Theft” and with a very simple name and a couple of “stateTypes” (perhaps a boolean for “Armed” and a QString with the name of the current state, such as “Daytime”, “Nighttime”, and so on), without having to switch to the “Details” view to see the current status of the object.

Is there an example of how this behavior is defined in the plugin’s JSon file, or is there an Interface to derive from?

Many thanks.
Andrea

The interface definitions are in the nymea repository, in libnymea/interfaces/.

The UIs for them are in the nymea:app repository (for example the thermostat one is in nymea-app/ui/devicepages/ThermostatDevicePage.qml)

@mzanetti
Thanks for your reply.

If I understand correctly, it would therefore be necessary to add a new interface and recompile nymea: app

I will try to understand if any of the interfaces already defined can come close to our needs.

Thank you very much for the moment.
Andrea

Yes. To add new interfaces, those need to be defined in libnymea, and then the UI for them need to be implemented in the app.

That said, we won’t add interfaces for specific devices, but rather for device types. It sure will make sense to add something for alarm systems but it needs some more thoughts to find a common ground for various alarm systems out there.

Can you share a link for the device you’re working on?

Of course, we need to think of a scheme as abstract as possible to implement this category of devices.

Perhaps it would be sufficient to be able to show few (maybe only one) “stateTypes” of type QString with the current state of the device (to display things like “Ready”, “Off”, “Armed”, “Night Mode” and so on), perhaps limited to a series of “possibleValues” specified in the implementations JSon and a couple of “actionTypes” to set the state (like “Off”, “Arm” “Mute”).

All other device specific info should be available in “Details” view.

I have to think about it and then I’ll let you know.

As for the type of device at the moment they are not yet public (they are prototypes in development) but you can find an idea of our products on our website (www.mect.it)

Thanks
Andrea