homeassistant_ecowitt icon indicating copy to clipboard operation
homeassistant_ecowitt copied to clipboard

Current day High and Low temperature values

Open nihonjin98 opened this issue 2 years ago • 6 comments

How can we get the current day high and low temperature values. They are reporting in the ecowitt app and are updated throughout the day as temps get higher and also as temps get lower. They are also uploaded to weather underground but their API only appears to provide acccess to the historical value for high and low temp and not the current day. thanks.

nihonjin98 avatar Nov 23 '21 00:11 nihonjin98

These are more or less calculated by the device, and not measured/reported. I think the basic answer here is to write a template sensor or min/max sensor in HA to emulate this for you.

garbled1 avatar Nov 23 '21 12:11 garbled1

Ok that makes sense. Any suggestions on how or what template might work. Another suggestion is that weather underground does create both of these values and they match what the device says. However, the values are created as attributes within a json array. They are nested within multiple sets of data and I would need to create a template that can look for the current date within the array of the json file and then read the high and low temp value from that particular array. I do not know how to do this.

Here is what the json file of mine looks like:

{ "summaries":[ { "stationID":"IJIMBO62", "tz":"Australia/Brisbane", "obsTimeUtc":"2021-11-20T13:59:54Z", "obsTimeLocal":"2021-11-20 23:59:54", "epoch":1637416794, "lat":-27.869, "lon":153.03, "solarRadiationHigh":975.1, "uvHigh":9.0, "winddirAvg":281, "humidityHigh":78.0, "humidityLow":30.0, "humidityAvg":61.0, "qcStatus":-1, "metric":{ "tempHigh":34.3, "tempLow":22.1, "tempAvg":26.7, "windspeedHigh":9.0, "windspeedLow":0.0, "windspeedAvg":1.8, "windgustHigh":13.0, "windgustLow":0.0, "windgustAvg":2.7, "dewptHigh":19.8, "dewptLow":14.0, "dewptAvg":18.0, "windchillHigh":34.3, "windchillLow":22.1, "windchillAvg":26.7, "heatindexHigh":35.6, "heatindexLow":22.4, "heatindexAvg":27.2, "pressureMax":1013.82, "pressureMin":1009.82, "pressureTrend":0.05, "precipRate":0.00, "precipTotal":0.00 } }, { "stationID":"IJIMBO62", "tz":"Australia/Brisbane", "obsTimeUtc":"2021-11-21T13:59:48Z", "obsTimeLocal":"2021-11-21 23:59:48", "epoch":1637503188, "lat":-27.869, "lon":153.03, "solarRadiationHigh":1387.7, "uvHigh":13.0, "winddirAvg":138, "humidityHigh":87.0, "humidityLow":52.0, "humidityAvg":74.0, "qcStatus":1, "metric":{ "tempHigh":27.3, "tempLow":21.0, "tempAvg":23.3, "windspeedHigh":8.7, "windspeedLow":0.0, "windspeedAvg":0.8, "windgustHigh":9.3, "windgustLow":0.0, "windgustAvg":1.2, "dewptHigh":20.5, "dewptLow":15.5, "dewptAvg":18.3, "windchillHigh":27.3, "windchillLow":21.0, "windchillAvg":23.3, "heatindexHigh":28.1, "heatindexLow":21.0, "heatindexAvg":23.7, "pressureMax":1015.51, "pressureMin":1010.33, "pressureTrend":0.04, "precipRate":3.00, "precipTotal":0.51 } }, { "stationID":"IJIMBO62", "tz":"Australia/Brisbane", "obsTimeUtc":"2021-11-22T13:59:31Z", "obsTimeLocal":"2021-11-22 23:59:31", "epoch":1637589571, "lat":-27.869, "lon":153.03, "solarRadiationHigh":708.8, "uvHigh":6.0, "winddirAvg":163, "humidityHigh":98.0, "humidityLow":68.0, "humidityAvg":87.6, "qcStatus":1, "metric":{ "tempHigh":25.5, "tempLow":19.6, "tempAvg":21.4, "windspeedHigh":9.7, "windspeedLow":0.0, "windspeedAvg":0.5, "windgustHigh":13.0, "windgustLow":0.0, "windgustAvg":0.9, "dewptHigh":21.6, "dewptLow":17.7, "dewptAvg":19.2, "windchillHigh":25.5, "windchillLow":19.6, "windchillAvg":21.4, "heatindexHigh":26.2, "heatindexLow":19.6, "heatindexAvg":21.7, "pressureMax":1018.12, "pressureMin":1012.84, "pressureTrend":0.14, "precipRate":7.80, "precipTotal":10.39 } }, { "stationID":"IJIMBO62", "tz":"Australia/Brisbane", "obsTimeUtc":"2021-11-23T11:29:54Z", "obsTimeLocal":"2021-11-23 21:29:54", "epoch":1637666994, "lat":-27.869, "lon":153.03, "solarRadiationHigh":1427.7, "uvHigh":13.0, "winddirAvg":112, "humidityHigh":99.0, "humidityLow":53.0, "humidityAvg":81.8, "qcStatus":0, "metric":{ "tempHigh":28.4, "tempLow":17.7, "tempAvg":22.7, "windspeedHigh":12.2, "windspeedLow":0.0, "windspeedAvg":1.1, "windgustHigh":18.3, "windgustLow":0.0, "windgustAvg":1.7, "dewptHigh":22.9, "dewptLow":17.1, "dewptAvg":19.2, "windchillHigh":28.4, "windchillLow":17.7, "windchillAvg":22.7, "heatindexHigh":30.8, "heatindexLow":17.7, "heatindexAvg":23.2, "pressureMax":1019.44, "pressureMin":1015.34, "pressureTrend":0.08, "precipRate":19.81, "precipTotal":8.20 } } ] }

nihonjin98 avatar Nov 23 '21 15:11 nihonjin98

Further to my post above currently i have the following template that does read the above json file and gives me the tempHigh and tempLow but as this entity that reads this json file contains a list of attributes of all the above array values and the listed entries roll over each day the current template is hardcoded to a particular level in the nested array. I need to be able to dynamically read the last level in the array and or somehow find the value of tempHigh and tempLow of the array that matches the current date found in obsTimeLocal.

Any help on how I might do this?

  • platform: template sensors: pws_temp_high: value_template: '{{ states.sensor.pws_history.attributes.summaries[2].metric.tempHigh }}' friendly_name: Temp High unit_of_measurement: '°C'

    pws_temp_low: value_template: '{{ states.sensor.pws_history.attributes.summaries[2].metric.tempLow }}' friendly_name: Temp Low unit_of_measurement: '°C'

nihonjin98 avatar Nov 23 '21 21:11 nihonjin98

You might have better luck on discord, or the general home assistant forums, for a way to either parse that json, or derrive high/low daily from a sensor. This seems like something someone else would have done by now as a general case.

garbled1 avatar Nov 23 '21 22:11 garbled1

Ok will do. Thanks.

nihonjin98 avatar Nov 24 '21 00:11 nihonjin98

This custom component might help you. It can create daily min and max sensors.

https://github.com/jeroenterheerdt/HADailySensor

GSzabados avatar May 16 '22 01:05 GSzabados