Hermes: Send messages to customer specific topics


It would be nice if you were able to send MQTT messages with any topic from the apps, without creating an own connection to your MQTT broker.

I know a second connection is not a problem, but I guess it would make some things way more accessible and fast in development.

something like:
hermes.send(topic=‘hermes/display/siteID’, payload=‘my custom message payload’)
hermes.send(topic=‘cmnd/sonoff/kitchen/POWER’, payload=‘ON’)

Thank you!

(i can’t create my own tag ‘hermes’?)


You can, nothing prevents you to send mqtt messages wherever you want


well, then I should update my feature request to include a complete documentation:

No matter how hard I look, i can only find:

A look into reveals nothing else.

So to directly answer to your comment: If there really is a way to use the build in hermes class to send a message, the only thing that prevents me from using it, is your precise answer…


I’m using my own channels to query data from my satellites, like temperature, Co2 etc etc etc

	def getSensorReadings(self):
	    self.notifyAllModules('projectAlice/modules/alice/getSensors', siteId='all')


	def sendToModule(self, ip, topic, payload=None):
	    if payload is None:
		    payload = {}

		    publish.single(topic, payload=json.dumps(payload), hostname=ip, port=1883)

So you can publish whatever you want wherever you want


thank you!

I’m actually doing exactly the same with publish.single from paho.
I was just hoping for a direct function in the existing hermes instance so I don’t have to bother with ports/ip anymore

So I guess I’ll stay with that solution for now, and this thread will remain as a suggestion for the devs


This is a nice idea and I need something like this. The great thing is it would even be possible to call this from the Snips console because the Hermes object is accessible to the console.


this is something i have asked before and also have added in the forums too as a feature request
the hermes python lib should allow access to the mqtt client so we can link into that without having to create yet another mqtt connection

I use publish.single too but if the user uses a username/pwd or certificate then that’s more coding me for to have to ask the user to once again enter it in


not the point of the post… Hermes does not just allow users access to send mqtt messages wherever they want


hermes doesn’t use password/username/certificate at the moment! You have to use paho already if you want to enable it. I did it for one of my apps already by reading the /etc/snips.toml - but you lose the intentMessage Objekt…
You can have a look at “Garuda” the indian messenger god here: