These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
What things you need to install the software and how to install them
-
LilyGo T-Higrow V1.1 (available from AliExpress) (make sure it is V1.1 19-8-22 or later)
-
Windows 10, with installed Arduino EDI (my version 1.8.12)
-
USB Cable with USB-C to attatch to the TTGO-T-HIGrow module
-
MQTT server (I am running on a Synology NAS in docker) If you have a Synology NAS, I can recommend to follow BeardedTinker on YouTube, he makes a very intuitive explanation how to setup the whole environment on Synology.
Below a step by step that tell you how to get a development/production environment up and running, and to make things even more easy, BeardedTinker have created the two tutorials on YouTube, which gives a detailed instruktion how to get it all to work.
He has performed a tremendous task in doing this.
First video is how to setup the whole environment: https://www.youtube.com/watch?v=7w6_ZkLDxko&t=231s, this video is for the version 1.x.x, but the first part is good, as it shows you how to setup the Arduino EDI, which is needed for the VSCode/PlatformIO EDI.
For setting up the VSCode and the PlatformIO, please Google it, there are som good YouTube videos showing how to setup VSCode and PlatformIO on Windows 10
I highly recommend that your see and follow these two videos, as then you only will have success in setting this up.
If you have many sensors and choose to use the autodiscover function, then in the video look away from the updating of the configuration.yaml file, as this is not needed when using Autodiscover. If you only have one or two modules, it might be easier just to update the configuration.yaml file.
After seeing the videos, remenber to give a "Thumbs Up" to support BeardedThinker in his work.
The main program is the:
main.cpp
You just use this .cpp as a master, and upload it to every *LILYGO TTGO T-HIGrow module you have.
Few things of importants:
-
First locate the file user-variables.h in the include folder in your download. This file contains all user modifyable variables for the project.
-
If you have problems in seeing problems where the module is placed and running, you can activate the logging on the board it self, by setting the variable logging = true. (Default is false)
-
Then you have to tell which DHT sensor you have on your module, by uncomment the #define DHT_TYPE variable which matches your sensor, and comment the others out.
-
This step is important, you need to calibrate the sensor for the SOIL HUMIDITY, just follow the description in the program, and set the variables: soil_min and soil_max to the measured values. When you have the values right and placed in the sketch, you update them on the board by setting calibrate_soil = true, and when uploaded and run once, you set it back to false.
-
The variables for the SALT, aka Fertilizer, is set, and you do not need to change them, unless you have very special soil conditions.1
-
Now you give the module a plant name. Check the variable update_plant_name, if set to true, the plant name is stored on the module, after that is done, you set the update_plant_name to false. If you want to use the module on another plant, you just repeat the step "true/false".
-
Now you have to define your SSID's, you can have as many as you like, I have at the moment 4, probably going to 5 soon. You update the variable ssidArr with your access points, each separated by a comma. The variable ssidArrNo must be filled with the number of SSID's given.
-
You then gives the Password for your SSID's (expected to all have the same).
-
You now adjust to your time zone, by giving the numbers of hours multiplied by 3600.
-
The device_name, and the next two variables, you should not change.
-
The last thing to do, is to give in the information for your MQTT broker.
Upload your sketch to the module, and
YOU ARE DONE with first part
The downloaded folder Autodiscovery, you copy to Home Assistant config folder (where you have your configuration.yaml).
**
The Python script in the Autodiscovery folder named:
is unfortunately not an integrated part in Home-Assistant. There is a reason for this. Home-Assistant does not accept the Import command in scripts. As I am using functions which do not exists in Home-Assistant as services, I need to import, and thus, the program has to run outside Home-Assistant.
I therefore run this program in Windows 10, and I do it in the Eric API for Python. The good thing is that you only need to run this program, when you add new modules. When it has run, it have made the mqtt messages from the TTGO-T-HIGrow module, able to be Autodiscovered by Home-Assistant MQTT Autodiscover function.
You can always reinstall the module in Home Assistant, by deleting it in Integrations MQTT, and delete the mac_id and name in the sensors.yaml file, run the Python program again, and voila, the sensors are back in Home Assistant MQTT.
The sensors.yaml (in my case) look like this:
info: This file contains the MAC_ID of the sensors already registred for Autodiscover
info: You can reinitiate Autodiscover for a single MAC_ID, by removing it from the list, or you can initiate a full renewal of sensors to Autodiscover,
info: By removing all MAC_IDs below these comments lines
info: DO NOT REMOVE THESE FOUR INFO LINES.
mac_id: 246f28b2107c
name: Cattleya
mac_id: 3c71bff17118
name: Begonie_1_winter
mac_id: 3c71bff16b30
name: Padron_2_winter
mac_id: 3c71bff16cb8
name: Padron_1_winter
mac_id: 3c71bff17054
name: Begonie_2_winter
mac_id: fcf5c40cf614
name: Begonie_3_winter
**NEVER remove the four first info lines, as it will make the Autodiscover mailfuction.
From release 3.0.4 I have made changes, so that the aboce Battery State Card, which is part of the HACS custom cards, can be utilized.
As I have many TTGO-T-HIGROW modules, it is most confortable to have all these modules battery states in one card on the Home Assistant.
It will look like this:
I did have some problems in understand the explanation on the Github belonging to the card, so I have included an example on how to get it to work here:
The LilyGo T-Higrow V1.1, will wake up every (in this case) hour and report status to the MQTT server, and at the same time it will be updated in Homeassistant. It will run for approx. 2 months on a 3.7V, 800mA, Lithium battery.
I have had a couple of units, which did not last that long. It turns out that one were using 5mA, and the other 14.6 mA when in sleep mode. They are not suitable for battery, and I have no clue why they consume this amount of power. The average consumption for my other boards are around 0.250 mA, which is according to factory specifications.
You can set the wakeup time as you want. Lower time higher battery consumption, Higher time lower battery consumption.
All sensors from the LILYGO TTGO T-Higrow V1.1 are updated, so you can easy include them in Homeassistant if you should wish so.
You can make the Homeassistant give you an alarm for low Soil Humidity, you will have to add the following to your automations.yaml. (example), this is a manual example, but if you use the Autodiscover function, you can add Alarms by using the "Configuration/Automations" function in the control panel of Home-Assistant.
- alias: 'nord_window_soil_8'
trigger:
platform: numeric_state
entity_id: sensor.north_window_soil_8
below: 30
for:
minutes: 30
action:
- service: notify.mobile_app_xxxxxxx_iphone
data:
message: 'North window plant 8, needs watering'
See instructions under Prerequisites
3.0.2 Major release update, introducing Home Assistant Autodiscover for MQTT
3.0.1 Implemented Home-Assistant MQTT Autodiscover, Salt calibration and advice included.
3.0.2 DST switch over now works
3.0.3 Small error corrections
3.0.4 Adapting to HACS frontend card: Battery State Card
3.0.5 The plant name, is now added to the modules SPIFFS file system, so that it part of the constant data of the module.
3.0.6 Corrected DST, so it now works, both for shift to winter time, and shift to summer time.
4.0.0 Same as 3.0.6, but the software has changed from Arduino EDI, to VSCode/PlatformIO
- Per Rose
- BeardedTinker (contributer)
This project is licensed under the MIT License - see the LICENSE.md file for details
- Xinyuan-LilyGO / TTGO-HiGrow https://github.com/Xinyuan-LilyGO/TTGO-HiGrow
- I changed the above from a WEB server to MQTT, with integration into Homeassistant
If you like and use my program, then
it will be appriciated.
In the following you will find instructions on how to download and use the casing for the LILYGO HI-Grow sensor.
What things you need to print the case:
- FreeCad, available from https://www.freecadweb.org/downloads.php
- A 3D printer
- Some optic cable, like this from AliExpress: https://www.aliexpress.com/item/32495181964.html?spm=a2g0s.9042311.0.0.27424c4dFTciIW
- A 5mm and 8mm drill, for aligning the holes for optic cable and charging plug.
- A C-charging plug, eg. like this from AliExpress: https://www.aliexpress.com/item/4000634865136.html?spm=a2g0s.9042311.0.0.27424c4dmTM92r
- A 800mA Lithium-ION battery, like this from AliExpress: https://www.aliexpress.com/item/33022823001.html?spm=a2g0s.9042311.0.0.27424c4dmElaxC
- A tube of Aquarium Silicone, for making expecially outdoor sensors watertight.
Here are a series of images, showing the process of assemble the case after print.
I have included the original file for the cases in FreeCad format.