Blog Image

Make it happen

Next: The Power button

Home automation Posted on Thu, March 10, 2016 09:23:21

Alright.. now we have working buttons for light and plant monitoring in the dashboard.. let’s move on to the next button: Power

The idea here is to read my house current power consumption. I plan to do this by reading the little blinky led on the power meter. This led blinks with different speed depending on power consumption. My meter will blink 10.000 blinks/Kwh

I plan to use a light-to-volatage sensor to be able to translate the blinks to a input signal for my ESP8266. When I have the number of blinks in the ESP, I will send them to the webserver similar to the Plant example.

Easy peacy.. right?

“Plant monitor” code

Home automation Posted on Thu, March 10, 2016 09:07:31

Here is some of the code to get the “Plant information”.
The DHT and Soil moisture information is sent to my webserver using HTTP GET requests.

The sketch sends the HTTP request to temp.php on my webserver and this page then reads the data sent in the request (temp, hum, id & soil). Since the sensor data is updated every 30 seconds (I will change this to maybe 4 times per day), the database is filled with a lot of information. To deal with this I have created a “daily” table to store information for longer periods of time and also to be able to create nice graphs in the future. All data in my “detailed” table older than 7 days will be deleted since I don’t see a actual need for this detailed infor for so long time.

Below I have attached the code for the temp.php page.