Hi Again,
I am also trying to fetch Air Quality data of PM10 and CO from the JSON file I receive from the API call.
The file looks like below -
[{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":1,"HourDescription":"12 am - 1 am","Value":-0.11487,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":1,"HourDescription":"12 am - 1 am","Value":16.101,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":2,"HourDescription":"1 am - 2 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":2,"HourDescription":"1 am - 2 am","Value":10.175,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":3,"HourDescription":"2 am - 3 am","Value":-0.15443,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":3,"HourDescription":"2 am - 3 am","Value":13.202,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":4,"HourDescription":"3 am - 4 am","Value":-0.130146,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":4,"HourDescription":"3 am - 4 am","Value":13.289,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":5,"HourDescription":"4 am - 5 am","Value":-0.125505,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":5,"HourDescription":"4 am - 5 am","Value":11.953,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":6,"HourDescription":"5 am - 6 am","Value":-0.109888,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":6,"HourDescription":"5 am - 6 am","Value":11.8,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":7,"HourDescription":"6 am - 7 am","Value":-0.105976,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":7,"HourDescription":"6 am - 7 am","Value":11.441,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":8,"HourDescription":"7 am - 8 am","Value":-0.109031,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":8,"HourDescription":"7 am - 8 am","Value":14.554,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":9,"HourDescription":"8 am - 9 am","Value":-0.093543,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":9,"HourDescription":"8 am - 9 am","Value":14.643,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":10,"HourDescription":"9 am - 10 am","Value":-0.1052,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":10,"HourDescription":"9 am - 10 am","Value":13.027,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":11,"HourDescription":"10 am - 11 am","Value":-0.115724,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":11,"HourDescription":"10 am - 11 am","Value":13.855,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":12,"HourDescription":"11 am - 12 pm","Value":-0.108498,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":12,"HourDescription":"11 am - 12 pm","Value":11.367,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":13,"HourDescription":"12 pm - 1 pm","Value":-0.097682,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":13,"HourDescription":"12 pm - 1 pm","Value":11.767,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":14,"HourDescription":"1 pm - 2 pm","Value":-0.094643,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":14,"HourDescription":"1 pm - 2 pm","Value":12.608,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":15,"HourDescription":"2 pm - 3 pm","Value":-0.095467,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":15,"HourDescription":"2 pm - 3 pm","Value":12.206,"AirQualityCategory":"GOOD","DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":16,"HourDescription":"3 pm - 4 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":16,"HourDescription":"3 pm - 4 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":17,"HourDescription":"4 pm - 5 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":17,"HourDescription":"4 pm - 5 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":18,"HourDescription":"5 pm - 6 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":18,"HourDescription":"5 pm - 6 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":19,"HourDescription":"6 pm - 7 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":19,"HourDescription":"6 pm - 7 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":20,"HourDescription":"7 pm - 8 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":20,"HourDescription":"7 pm - 8 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":21,"HourDescription":"8 pm - 9 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":21,"HourDescription":"8 pm - 9 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":22,"HourDescription":"9 pm - 10 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":22,"HourDescription":"9 pm - 10 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":23,"HourDescription":"10 pm - 11 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":23,"HourDescription":"10 pm - 11 pm","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"CO","ParameterDescription":"Carbon monoxide","Units":"ppm","UnitsDescription":"parts per million","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":24,"HourDescription":"11 pm - 12 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null},{"Site_Id":1001,"Parameter":{"ParameterCode":"PM10","ParameterDescription":"PM10","Units":"µg/m³","UnitsDescription":"microgram per cubic meter","Category":"Averages","SubCategory":"Hourly","Frequency":"Hourly average"},"Date":"2022-12-01","Hour":24,"HourDescription":"11 pm - 12 am","Value":null,"AirQualityCategory":null,"DeterminingPollutant":null}]
Flow looks like below -
Debug result looks like below -
The data gives information of 'PM10' or 'CO' in separate slots of Hourdescription: "12 AM - 1 AM" till 24 hours complete. If the the time of the day is 12 PM, I will receive vqalue of 'PM10' for slot 12PM to 1PM but 1PM to 2PM slot will have a Null value.
Just like 'PM10' and 'CO' I can add more parameters like 'NO', 'OZONE', 'SO2' etc. and each of these parameters will increase the JSON file size provide values for 24 slots of time throughout the day.
I want to check the current time (say it's 12PM right now) and pull out the value of all parameters I have asked for between the slot 12PM to 1PM. And I will trigger the flow each hour to get the values for the entire day. How do I achieve this, it's tricky and I am learning javascript and node-red.
Please let me know if you need any more information.
Kind regards,
Amit