I collect thermostat data every 5min. Now I would like to know how many hours per day the heater is on. I do this with this query:
$sql = "SELECT round((COUNT(*)*5)/60,1) as Counter, date(timestamp) as WeekDay, Heating
FROM `rawdata`
WHERE Heating = 1
GROUP BY DAY(timestamp);";
Works fine and gives me back the hours of the day, IF it was on for that day. For my graphs that I build on this data however, it would be better if I got a row in return with date and the value 0. In other words, I would need a row returned for each day.
Any help would be appreciated.