# Sending and receiving a data request from a device through MQTT from Ewon

**URL:** <https://forum.inductiveautomation.com/t/sending-and-receiving-a-data-request-from-a-device-through-mqtt-from-ewon/46101>\
**Category:** Ignition\
**Tags:** ignition80, perspective, vision\
**Created:** [April 28, 2021, 10:47am UTC](https://forum.inductiveautomation.com/t/sending-and-receiving-a-data-request-from-a-device-through-mqtt-from-ewon/46101 "2021-04-28T10:47:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniele1](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/daniele1/32/31531_2.png) [@daniele1](https://forum.inductiveautomation.com/u/daniele1)\
**Post date:** [April 28, 2021, 10:47am UTC](https://forum.inductiveautomation.com/t/sending-and-receiving-a-data-request-from-a-device-through-mqtt-from-ewon/46101/1 "2021-04-28T10:47:31Z")

</div>

Hi,  
I have a system made up of different station (made up of a PLC and and Ewon router) connected to an Ignition gateway through MQTT that send data when those values changes.  
Sometimes it happens that the gateway looses the tags stored in the MQTT Engine provider: that sometimes happens because the server goes down or other mysterious reasons.  
The simpler way to get back those tags is to simply sending them back from the stations.  
To be able to send all the tags back from the SCADA I created for each station:

- The OPC tag (send\_val) that when 1 and sent to the station triggers the data sending (all ther OPC tags have a script on them that when the value changes they get sent to the station)
- An expression tag (Quality\_bad\_val) that check the quality of the the other tags and when those are bad goes to 1.
- A button that becomes visible when the Quality tag goes to 1 and is binded to the send\_val tag  
So when the server goes down the OPC tags quality go to BAD \> the tag Quality\_bad\_val goes to 1 \>the button appears \> the user sees it and click on it \> the tag send\_val goes to 1 and gets sent \> the station receive it and send the data back.  
The problem appears when the server goes down another time because the send\_val tag is already at 1 adn the request doesn’t get sent.  
I tried different solution but they have their problems too:
- At first I was usig a momentary button that triggered the send\_val tag for 5 seconds put then I tried implementing it on the Perspective side of the project and I remembered that there are no momentary button in Perspective
- I made a script on the tag Quality\_bad\_val so that when the data gets received and it goes to 0 it changes the send\_val value to 0. This solution doesn’t work because some stations are often offline and aren’t able to send the data back and the Quality\_bad\_val stays on 1 and those station are stuck  
My next attemp is to create a timer script on the Gateway the every few seconds write the tag send\_val to 0, I really don’t like this approach though.  
Do you have any solution that you can share?  
Thanks, regards

Daniele
