Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create simulated sensor node using real accelerations #6

Open
andygrillo opened this issue Sep 2, 2020 · 7 comments
Open

Create simulated sensor node using real accelerations #6

andygrillo opened this issue Sep 2, 2020 · 7 comments
Labels
good first issue Good for newcomers

Comments

@andygrillo
Copy link
Member

To help with testing it would be great to have a simple node that reads from a local file that contains sensor readings from a real earthquake, eg https://github.com/openeew/openeew-detection/tree/master/input/2018_7.2, and send them into the flow.

FYI, each of these files is a JSONL file, belonging to a unique sensor, where every line is one seconds worth of data in x,y and z. Therefore we need to send one line per second to simulate a live sensor.

@andygrillo andygrillo added the good first issue Good for newcomers label Sep 2, 2020
@johnwalicki
Copy link
Member

johnwalicki commented Sep 2, 2020

One of my initial Node-RED experiments read in a JSONL file. I practiced on a JSONL file as I learned how to parse the data. It was a windy journey the first time but I could recreate that easily now.

I could play that directly into a simple dashboard similar to the Node-RED example #2 ?

This would be a flow. Easily modified. You might be asking for a specific Node-RED node. That's quite a bit more work and less flexible.

@johnwalicki
Copy link
Member

I would potentially not do this with Node-RED.
A python script that starts a MQTT broker, and then loops through the file and publishes the earthquake data, would be interesting. Then ANY dashboard solution could listen in could subscribe to it.

Its still a bunch of work.... Would be just as easy to point a dashboard via http get to
https://s3.amazonaws.com/grillo-openeew/index.html#records/country_code=mx/device_id=006/year=2018/month=02/day=16/hour=23/

@krook
Copy link
Member

krook commented Sep 2, 2020

A python script that starts a MQTT broker, and then loops through the file and publishes the earthquake data, would be interesting. Then ANY dashboard solution could listen in could subscribe to it.

The Docker detection project pretty much does this: https://github.com/openeew/openeew-detection#simulate-sensor-data

This simulator runs against the local (Docker) or remote (Kubernetes) MQTT node

@johnwalicki
Copy link
Member

To be honest, if you just need a simulator, there's a full date picker solution in Example #3 of the Node-RED repo here. You can pick your dataset and view it.

I think it would be a simple modification to play the data as a simulator.

@johnwalicki
Copy link
Member

johnwalicki commented Sep 2, 2020

Maybe I have another idea for this issue.
I think the idea of a bespoke Node-RED node that is an OpenEEW real data playback simulator has some merit.

Strip away the MQTT broker, strip away the dashboard widgets.

What if all the date picker dashboard widgets moved into a Node-RED edit dialog. The user picks the sensor, date, time, duration of playback. Behind the scene, the node builds the AWS bucket URL, retrieves all the historic data, and then emits the subsecond x/y/z acceleration data as if it was coming from a live MQTT feed.....

The user clicks the "Inject" tab and the data plays into the rest of the Node-RED flow.

@johnwalicki
Copy link
Member

As a first iteration, the Node-RED edit properties dialog asks for a file path to a JSONL file that you've already downloaded. It reads the JSONL file and plays the data into the rest of the Node-RED flow. That would satisfy the initial request?

@andygrillo
Copy link
Member Author

andygrillo commented Sep 2, 2020

Yes, I believe that would satisfy the folk in #node-red who asked for live data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants