# Reading failed reported states

**URL:** <https://forums.losant.com/t/reading-failed-reported-states/5576>\
**Category:** Help\
**Tags:** mqtt, workflow, device\
**Created:** [August 22, 2024, 1:49pm UTC](https://forums.losant.com/t/reading-failed-reported-states/5576 "2024-08-22T13:49:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cesar\_Guedes](https://avatars.discourse-cdn.com/v4/letter/c/e68b1a/32.png) [@Cesar\_Guedes](https://forums.losant.com/u/Cesar_Guedes)\
**Post date:** [August 22, 2024, 1:49pm UTC](https://forums.losant.com/t/reading-failed-reported-states/5576/1 "2024-08-22T13:49:53Z")

</div>

Hello!  
I’m currently working on an issue with a device I have. It randomly sends messages in the wrong format, and I need to be alerted when it happens.

To make things clear, this is the kind of error that will appear in the app log:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/4/4ea164c494c62e471babdeede2b9e276c87832dc.png)

Unfortunately, I can’t seem to find a way of triggering something with this message. The only plausible nodes available are the MQTT Trigger and Device: State Trigger  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/a/a5dc4364fba2444a4d58362b5258c37df50e5659.png)  
But there’s not exactly a “state” being reported and the MQTT trigger doesn’t subscribe to private topics.  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/9/9e2789b33a454656994985a2506a8a8ebda12ddf.png)

I also tried, from the Losant API node, to get the app logs and device logs, but no relevant information is returned.

Is there currently a way of using error messages as triggers? Can I read past error messages?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 22, 2024, 2:16pm UTC](https://forums.losant.com/t/reading-failed-reported-states/5576/2 "2024-08-22T14:16:51Z")

</div>

One thing you can catch here is that the Device: State Trigger should fire, but with an empty `data` object in this particular case. It won’t have the raw payload (your “Test” string) but this would at least tell you that _something_ went wrong by checking if the `data` object has 0 keys in it.

But this a good use case. I’m running it by the team now and will see if there is a better solution we can offer.

---

<div class="post-metadata">

**Author:** ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)\
**Post date:** [August 22, 2024, 3:35pm UTC](https://forums.losant.com/t/reading-failed-reported-states/5576/3 "2024-08-22T15:35:16Z")

</div>

Actually, in some cases (depending on the format of the message you’re sending) this may _not_ fire the Device: State Trigger. My mistake.

I’ll follow up if I can come up with a better recommendation.
