Page 1 of 1

Serial input to MQTT

Posted: 17 Jun 2018, 23:25
by redskinhu
Hello

I have a small problem. My esp is connected to the alarm system through serial to the rx/tx pins with level converter.
I use the Serial Server plugin. I would like to send the received data to my HASS server through MQTT. I created a rule to publish the recieved data.

Code: Select all

On !Serial# do
  publish home/ESP07/Alarm,%eventvalue%
Endon
If the esp get data from the alarm the !Serial# event is fired. Rule is working, it publish.

But i get this: home/ESP07/Alarm/!Serial#, doesn't matter what is the received data.

I know this plugin is not created to doing this. I thought maybe i can catch the data from the %eventvalue%. But not.... :(

Any idea how can i get the real data? Other plugin?

Thanks
T

Re: Serial input to MQTT

Posted: 26 Jun 2018, 23:15
by xury
Hi I just read about your problem and I have an idea.

Code: Select all

On !Serial# do
  publish home/ESP07/Alarm,%eventvalue%
Endon
Because !Serial# does not have a value name.
You can try use a prefix on sending data as: myname= and after send your data
Obviously if you have an impact on the format of the data being sent to esp trough serial
When try a rule as:

Code: Select all

On !Serial#myname do
  publish home/ESP07/Alarm,%eventvalue%
Endon

Re: Serial input to MQTT

Posted: 02 Jul 2018, 11:00
by dirk_k
i use the following syntax

On Serial#myname do
publish home/ESP07/Alarm,[Serial#myname]
Endon