initialstate / wunderground-sensehat

Tutorial and code for using the Raspberry PI Sense HAT plus a weather API (Dark Sky) to create a personal weather dashboard.
MIT License
262 stars 57 forks source link

Local vs. DarkSky values #12

Open bsculley opened 5 years ago

bsculley commented 5 years ago

I'm thinking of implementing this idea using Node-Red, which has available nodes for both retrieving data from DarkSky and sending data to InitialState. Before beginning, I would like to know why the local data from SenseHat (or elsewhere) uses different (and not very intuitive) field names than the DarkSky data, for example, the local temperature is recorded as "sunny":

streamer.log(":sunny: " + SENSOR_LOCATION_NAME + " Temperature(C)", temp_c)
streamer.log(":cloud: " + SENSOR_LOCATION_NAME + " Pressure (mb)", pressure_mb)

while the data from DarkSky is recorded as "Temperature":

streamer.log("Temperature",curr_conditions['currently']['temperature']) Why not just substitute the local value for the one from DarkSky?

jrbail01 commented 5 years ago

What you are seeing is just a data stream name being built (string). The :sunny: part is simply an emoji token that gets replaced by an emoji in Initial State (see https://support.initialstate.com/hc/en-us/articles/360002915551-Emojis ). SENSOR_LOCATION_NAME is just a global variable that you can set at the top. The result is something like "☀️Office Temperature(C)" for the data stream name.

bsculley commented 5 years ago

Thanks for the reply. Maybe I'm just being thick, but can you tell me by what data key the dashboard will reference the local temperature?

Thanks.

jrbail01 commented 5 years ago

When you stream the local data into your Initial State account in this statement: streamer.log(":sunny: " + SENSOR_LOCATION_NAME + " Temperature(C)", temp_c) you are creating a stream key named something like :sunny: Office Temperature(C). That stream key will contain all values of the local temperature from the sense HAT. For the local temperature from Dark Sky, that stream key name will be Temperature.