konstk1 / helium-dashboard

Helium dashboard
MIT License
23 stars 14 forks source link

Multiple hotspots support #8

Closed ThomDietrich closed 2 years ago

ThomDietrich commented 2 years ago

Hey there! I was about to use your script and dashboard for my own needs. Could you clarify one thing for me: Did I misunderstand something or do you indeed just query stats for one hotspots. I own a few more and would like to retrieve stats for all of them. Does your script support multiple Hotspots (ideally just all hotspots linked to the given account) or would you otherwise be interested in a PR?

This question is also motivated by the fact, that I am not a javascript developer...

konstk1 commented 2 years ago

Right now the script only pulls the data for a single hotspot but it would be trivial (for a js developer) to modify it to support multiple.

ThomDietrich commented 2 years ago

The trivial solution from my non-js-dev point of view would be to provide the hotspot id to the function processHotspotActivity, then loop the following line for each ID given in .env: https://github.com/konstk1/helium-dashboard/blob/5701e0cd342b1214041ffd370f91868165373423/src/helium.js#L140 (dunno how to do this in the context of promise)

Am I close?

You only own one miner or why did you never miss that kinda obvious feature? :) Greetings?

konstk1 commented 2 years ago

Yes, that's how I would do it.


await Promise.all([
    processHotspotActivity(hostpot1, DateTime.local().minus({ hours: HOTSPOT_LOOKBACK_HOURS })),
    processHotspotActivity(hotpost2, DateTime.local().minus({ hours: HOTSPOT_LOOKBACK_HOURS })),
    processHeliumStats(),
    getPrice(),
  ]);```

I only have one miner so I didn't bother with that feature.