# Collect device alarms states & durations and send in csv to ftp site

**URL:** <https://forums.losant.com/t/collect-device-alarms-states-durations-and-send-in-csv-to-ftp-site/4768>\
**Category:** Help\
**Tags:** events, csv, notebooks\
**Created:** [October 10, 2022, 7:48pm UTC](https://forums.losant.com/t/collect-device-alarms-states-durations-and-send-in-csv-to-ftp-site/4768 "2022-10-10T19:48:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![William\_Morgan](https://avatars.discourse-cdn.com/v4/letter/w/b77776/32.png) [@William\_Morgan](https://forums.losant.com/u/William_Morgan)\
**Post date:** [October 10, 2022, 7:48pm UTC](https://forums.losant.com/t/collect-device-alarms-states-durations-and-send-in-csv-to-ftp-site/4768/1 "2022-10-10T19:48:59Z")

</div>

Hi!

I am working on a new set of requests for a client and I am looking for help/tips on the most efficient way to setup the workflows/exports.

I would like to collect specific device states when the device sends an alert as well as when that alert is cleared.

For example:  
Device 12345  
System Shutdown = 0  
Time: 14:00:00 UTC

Then

Device 12345  
System Shutdown = 1  
Time: 15:00:00 UTC

The report would run every hour and send multiple device states durations between changes via a CSV file to a FTP site.

Any help in making this process clearer would be much appreciated!

---

<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:** [October 10, 2022, 8:09pm UTC](https://forums.losant.com/t/collect-device-alarms-states-durations-and-send-in-csv-to-ftp-site/4768/2 "2022-10-10T20:09:29Z")

</div>

Are you trying to export [Losant events](https://docs.losant.com/applications/events/), or [device state data](https://docs.losant.com/devices/state/), to this FTP site? I’m unclear on that from your explanation.

Also, do you just want to put up the raw CSV data, or do you need to do some sort of processing / calculation on that data in a Losant workflow first?

We do have a [Stream Exports to AWS S3 template](https://app.losant.com/applications/recent/template-library?templateId=60f6bd7435d0960006dcf9cc) that I think would be useful to you; it demonstrates how to …

- Trigger an asynchronous task (in your case, you’d use a [Timer Trigger](https://docs.losant.com/workflows/triggers/timer/) hooked up to a [Losant API Node](https://docs.losant.com/workflows/data/losant-api/) that calls the [Data: Export](https://docs.losant.com/rest-api/data/#export) action.
- Provide a callback URL in the request, with the value being the URL of a [Webhook](https://docs.losant.com/applications/webhooks/) from your application.
- Trigger another workflow execution off the request to the callback URL, using the [Webhook Trigger](https://docs.losant.com/workflows/triggers/webhook/).
- Pipe the CSV directly to your FTP server using the [FTP: Put Node](https://docs.losant.com/workflows/data/ftp-put/). (This replaces the AWS S3: Put Node in the template.)

Let me know if that points you in the right direction.
