Adding Tags to Things

Hi,

Firstly, I am a new user of Nymea and really appreciate you making a first class piece of software available for me (and others) to use…amazing!

I think I saw some reference in the release notes to tags? Does Nymea allow adding tags to things for categorisation? I would like to be able to tag a thing with a label such as “FloorLamp” and then if possible find the thingid from the tag in a script?

Thanks

Hi,
thanks for the kind words. If possible, we’d appreciate if you could help spreading the word about nymea on social media :slight_smile:

The nymea api does supports tags. Those, however, are currently mostly an implementation detail and not exposed to the user. For instance, marking a thing as favorite would add a tag to it, or adding it to a group would do something similar, also using tags.

Tags are currently not exposed to the ScriptEngine, however, this might be a sensible addition indeed. We’ll consider it adding that.

Thank you for the quick reply on Sunday :slight_smile:

Ok, I will think around this to see if there is another way to reference things from MQTT topic data.

Regards

well, you can keep maps in the script I guess…


ThingState {
    id: floorLamp
    thingId: "..."
    stateName: "power"
}

property var thingsAndTopics = {
  "FloorLamp": floorLamp,
  "SomeOtherAlias": someOtherThingState 
}

onMqttTopicReceived: {
  thingsAndTopics[topic].value = payload
}

I didn’t test it if the syntax is proper, but something similar to this should work I guess…

Ah yes, that will give me something to work on. I will try this tomorrow, thanks again for your help so late in the evening.

Regards

Hi @mzanetti

I am having some success with my script and will start another post with a more relevant topic about this.

Being able to add tags would be useful for scripting but only if the Thing ID can be identified using them e.g in Openhab they use getItemByTag to do that and make a lot of use of metadata.

Does Nymea have a generic motion detector thing? I can see the simulated one but want to use MQTT to feed a generic presence sensor. Also, is there (or will there be) a way to show images in a widget, or even better something like an iframe?

I noticed there is a dashboard in the making - very cool and very welcome!

Thanks again for your help.