Message - How to use it?

Functionality and usage of the OpenNethome Server
Post Reply
perjarle
Posts: 30
Joined: Wed Aug 03, 2016 8:08 am

Message - How to use it?

Post by perjarle » Fri Feb 16, 2018 11:42 am

Hi
In the Create/Edit page there is a way to create a Message (under Ports) which in the feature listing is mentioned to be pre-defined messages that can be sent with MQTT.

The Create Message page have 4 input fields: Item Name, To, Subject and Message.

How do I configure this to put messages out to the mqtt?

An example would be appreciated

--PJ

mikkot
Posts: 33
Joined: Fri Aug 21, 2015 6:30 am

Re: Message - How to use it?

Post by mikkot » Wed Feb 21, 2018 8:37 am

Hi,

Not sure how you'd like to trigger the messages to MQTT broker, but I have used MQTTValueLogger (under Gauges) to send values (can be any attribute of any object) as MQTT messages. Currently I send temperature and humidity readings, but it can be anything.

I'm not sure if this happens in real time. There's an "React on event" selection that might mean real time, but as there's no documentation, better let Stefan to reply ;) Edit: did a quick search viewtopic.php?f=5&t=101&p=681&hilit=ReactOnEvent#p681

In order to use MQTTValueLogger, you first need to have an MQTTClient set (under Ports). Here you define the MQTT broker address, port, base topic etc.

/Mikko

perjarle
Posts: 30
Joined: Wed Aug 03, 2016 8:08 am

Re: Message - How to use it?

Post by perjarle » Wed Feb 21, 2018 8:56 am

Thank you for replying

I basically needs to trigger it from a lamp item, but also plan to be able to trigger with jabber message in the future.

So if i set up a MQTTValueLogger with the lamp it will send out messages?
Sounds great, and i will try it

Thank you for the help :)

-PJ

mikkot
Posts: 33
Joined: Fri Aug 21, 2015 6:30 am

Re: Message - How to use it?

Post by mikkot » Wed Feb 21, 2018 11:00 am

No problem, I'm glad to be able to help!

And yes, you can post the state changes of any lamp item to the MQTT broker. Please report back how it works (if there's a delay or not). I might consider this myself as well.

My current goal is to have automatic outgoing state change messages sent to an external system, but I would not like to go with MQTTValueLogger as I have tens of devices which would mean tens of MQTTValueLoggers too to get all the state changes handled... I'd prefer something more dynamic and "REST-like" i.e. getting all the object data updates, not only state changes but e.g. brightness changes distributed outside automatically. The distribution channel might still be MQTT, though.

/Mikko

Post Reply