{"id":13488542,"url":"https://github.com/kaulketh/greenhouse","last_synced_at":"2026-03-15T13:46:32.720Z","repository":{"id":115854245,"uuid":"159660319","full_name":"kaulketh/greenhouse","owner":"kaulketh","description":"Control a greenhouse by using Telegram app (Bot API) and a RaspberryPi.","archived":false,"fork":false,"pushed_at":"2020-06-02T20:16:15.000Z","size":57225,"stargazers_count":9,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-01T18:37:59.272Z","etag":null,"topics":["electric","greenhouse","linux","plants","python","raspberry-pi","shell","telegram","telegram-bot"],"latest_commit_sha":null,"homepage":"https://kaulketh.github.io/greenhouse/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaulketh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-11-29T12:06:40.000Z","updated_at":"2023-03-28T12:01:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"eac2b3e4-e6c1-4554-9112-5310b4b5e420","html_url":"https://github.com/kaulketh/greenhouse","commit_stats":{"total_commits":1101,"total_committers":5,"mean_commits":220.2,"dds":0.5104450499545867,"last_synced_commit":"e8c78aac61a9d8ede30ce5755a60b1a461947bc3"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaulketh%2Fgreenhouse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaulketh%2Fgreenhouse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaulketh%2Fgreenhouse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaulketh%2Fgreenhouse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaulketh","download_url":"https://codeload.github.com/kaulketh/greenhouse/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222333976,"owners_count":16968058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["electric","greenhouse","linux","plants","python","raspberry-pi","shell","telegram","telegram-bot"],"created_at":"2024-07-31T18:01:17.792Z","updated_at":"2026-03-15T13:46:27.688Z","avatar_url":"https://github.com/kaulketh.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# My Greenhouse\n\u003e Control a greenhouse by using Telegram app and a Raspberry Pi.\n\u003e I did not reinvent the wheel.\n\n\u003e Thank you for inspiring me, [Stefan Weigert](https://www.stefan-weigert.de/php_loader/raspi.php) and [Felix Stern](https://tutorials-raspberrypi.de/automatisches-raspberry-pi-gewaechshaus-selber-bauen/)\n\n---\n\n![release](https://img.shields.io/github/release/kaulketh/greenhouse.svg?color=darkblue) ![size](https://img.shields.io/github/repo-size/kaulketh/greenhouse.svg?color=blue) ![commit](https://img.shields.io/github/last-commit/kaulketh/greenhouse.svg?color=darkviolet) ![platform](https://img.shields.io/badge/platform-linux-blue.svg?color=yellow) ![languages](https://img.shields.io/github/languages/count/kaulketh/greenhouse.svg?color=yellowgreen) ![coverage](https://img.shields.io/github/languages/top/kaulketh/greenhouse.svg?color=darkgreen\u0026style=flat) [![license](https://img.shields.io/github/license/kaulketh/greenhouse.svg?color=darkred)](https://unlicense.org/)\n\n\n\u003e This repository is used to gather and show information and experiences during the building of a smart control possibility.\n\u003e All code is written or adapted by myself and w/o any copyrights. I have tried to use no copyright protected stuff.\n\u003e Almost everything published already exists, to be found on the net, and was adapted and used only by me accordingly.\n\n\u003e And please excuse the mistakes made and violations of any conventions, I am new to this matter.\n\u003e Do not be afraid to correct or improve me and inform me accordingly.\n\u003e Consider and refer [Contributor Covenant Code of Conduct!](https://github.com/kaulketh/greenhouse/blob/master/CODE_OF_CONDUCT.md)\n\n\n### Table of Contents\n- [Installation and usage](#Installation-and-usage)\n- [Telegram app](#telegram-app)\n- Raspberry Pi requirements\n    - [Raspberry Pi OS](#raspberry-pi-os-image)\n    - [First boot](#boot-raspi-and-connect-via-ssh)\n    - [Configure IP](#configure-static-ip)\n    - [Updates and main config](#make-updates-and-adapt-main-config)\n    - [Dyn dns client](#install-and-configure-dyn-dns-client-ddclient)\n    - [Remote ftp access](#install-and-configure-remote-ftp-if-required)\n    - [Live stream](#configure-the-live-stream)\n- [Router port forwarding](#configure-port-forwarding-in-router-accordingly-the-dns-and-port-settings)\n- [Required packages](#install-required-packages-python-python-telegram-bot-python-pip-telepot-and-wiringpi)\n- [Add/create scripts](#add-scripts-in-pi-user-directory)\n- [Autostart](#enable-autostart-of-the-bot-application)\n- [Additional](#additional-functionality)\n- [Hardware](https://github.com/kaulketh/greenhouse/blob/master/hardware/HARDWARE.md)\n- [License](#License)\n\n---\n### Installation and usage\n\u003e Currently no installation routine is planned.\n\u003e Feel free to use, adapt, download or copy all the published stuff.\n\u003e Main programming language is Python and shell scripting is used also. \n\n\t\n### Telegram app\n##### Install the app and create bot\n\n```\nName: \tThK1220RealGreenhouse\nTOKEN: \t\u003capi_token\u003e\nChatID:\t\u003cchat_id\u003e\n```\n\n* [Web](https://telegram.org/)\n* [Ios](https://itunes.apple.com/de/app/telegram-messenger/id686449807?mt=8)\n* [Android](https://play.google.com/store/apps/details?id=org.telegram.messenger\u0026hl=de)\n\n---\n\n### Raspberry Pi OS image\n* download [latest stretch lite w/o desktop](https://downloads.raspberrypi.org/raspbian_lite_latest) \n* prepare sd card / flash image, e.g. use [Etcher](https://etcher.io/?ref=etcher_footer) \n* _**enable SSH access**_ \n    * As of the November 2016 release, Raspbian has the SSH server disabled by default. You will have to enable it manually. \n    * For headless setup, SSH can be enabled by placing a file named \"ssh\", without any extension, onto the boot partition of the SD card.\n\n---\n\n### Boot raspi and connect via ssh\n\n---\n\t\t\t\n### Configure (static) IP\n##### adapt /etc/[dhcpcd.conf](configs/dhcpcd.conf)\n\n```\nsudo service dhcpcd status \nsudo service dhcpcd start // if not yet started \nsudo systemctl enable dhcpcd \nsudo nano /etc/dhcpcd.conf\nsudo reboot\n```\n* [how-to at elektronik-kompendium](https://www.elektronik-kompendium.de/sites/raspberry-pi/1912151.htm) (I recommend variant 2)\n* [also helpful, how-to for wlan](https://unix.stackexchange.com/questions/92799/connecting-to-wifi-network-through-command-line)\n* [another how-to at elektronik-kompendium](https://www.elektronik-kompendium.de/sites/raspberry-pi/1912221.htm)\n \n\n_**Retest and doublecheck network conection and settings before executing next steps!!!!!**_\n\n---\n\n### Make updates and adapt main config\n\n```\nsudo apt-get update --yes \u0026\u0026 sudo apt-get upgrade --yes\nsudo raspi-config\n    Hostname:\tgreenhouse\n    User:\t\tpi\n    Password:\t******************\nsudo rpi-update //update firmware\nsudo reboot\n```\n---\n### Install and configure dyn dns client (ddclient)\n#### ignore config let it empty e.g can be configured due next steps\n```\nsudo apt-get update\nsudo apt-get install libio-socket-ssl-perl\nsudo apt-get install ddclient\n```\n\n#### use e.g. [FreeDNS](http://freedns.afraid.org) and update [ddclient.conf](configs/ddclient.conf) accordingly the dns provider\n\n```\n\nsudo nano /etc/ddclient.conf\n\n```\n\n\n##### other possible method could be e.g insert crontabs\n```\n0,5,10,15,20,25,30,35,40,45,50,55 * * * * sleep 31 ; wget -O - http://freedns.afraid.org/dynamic/update.php?******************************************** \u003e\u003e /tmp/freedns_greenhouse_my_to.log 2\u003e\u00261 \u0026\n3,8,13,18,23,28,33,38,43,48,53,58 * * * * sleep 44 ; wget -O - http://freedns.afraid.org/dynamic/update.php?******************************************** \u003e\u003e /tmp/freedns_greenhouse_chickenkiller_com.log 2\u003e\u00261 \u0026\n```\n* [how-to dyndns client with ssl](https://hexaju.wordpress.com/2013/03/20/raspberry-pi-as-dyndns-client-with-ssl/)\n \n---\n\n### Install and configure remote ftp if required\n```\nsudo apt-get install pure-ftpd\nsudo groupadd ftpgroup\nsudo useradd ftpuser -g ftpgroup -s /sbin/nologin -d /dev/null\nsudo mkdir /home/pi/FTP\nsudo chown -R ftpuser:ftpgroup /home/pi/FTP\nsudo pure-pw useradd upload -u ftpuser -g ftpgroup -d /home/pi/FTP -m\nsudo pure-pw mkdb\nsudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/60puredb \nsudo service pure-ftpd restart\n```\n\n* [how-to remote access](https://www.raspberrypi.org/documentation/remote-access/ftp.md)\n \n---\n### Configure the live stream\n##### install motion and update /etc/motion/[motion.conf](configs/motion.conf)\n```\t\nsudo apt-get install motion -y\nsudo nano /etc/motion/motion.conf   //additional: output_pictures off\nsudo nano /etc/default/motion\nmkdir /home/pi/Monitor\nsudo chgrp motion /home/pi/Monitor\nchmod g+rwx /home/pi/Monitor\nsudo service motion start\n```\n\n* [How-to 1 live stream](https://tutorials-raspberrypi.de/raspberry-pi-ueberwachungskamera-livestream-einrichten/)\n* [How-to 2 live stream](https://www.datenreise.de/raspberry-pi-ueberwachungskamera-livestream/)\n\n---\n\n### Configure port forwarding in router accordingly the dns and port settings\n##### [my live url](http://greenhouse.my.to:8082/)\n\n---\t\t\t\t\t\n### Install required packages (python, python-telegram-bot, python-pip, telepot and wiringpi)\n```\nsudo apt-get install build-essential python-dev python-pip python-smbus python-openssl git --yes //python\nsudo pip install python-telegram-bot\nsudo pip install telepot\n```\n\n##### First check that wiringPi is not already installed.\n```\ngpio -v\n```\n\n##### If you get something, then you have it already installed. The next step is to work out if it’s installed via a standard package or from source. If you installed it from source, then you know what you’re doing – carry on – but if it’s installed as a package, you will need to remove the package first. To do this:\n```\nsudo apt-get purge wiringpi\nhash -r\n```\n\n##### WiringPi is maintained under GIT for ease of change tracking. If required to install do it like described as followed.\n```\nsudo apt-get install git-core\nsudo apt-get update\nsudo apt-get upgrade\ncd git\ngit clone git://git.drogon.net/wiringPi\ncd ~/wiringPi\ngit pull origin\ncd ~/wiringPi\n./build\n```\n\n* [how to to install wiringpi](http://wiringpi.com/download-and-install/)\n\n---\n\n### Add scripts in pi user directory\n##### e.g in this case in scripts/TelegramBot\n\n_**Make them executable and chown root:root!**_\n* access.py - external file, content will not provided, contains api token, chat IDs and other sensitive data\n* [greenhouse_config.py](bot/conf/greenhouse_config.py) - settings and properties\n* [greenhouse.py](bot/greenhouse.py) - main bot\n* [lib_global.py](bot/conf/lib_global.py) - global constants and settings \n* [lib_german.py](bot/conf/lib_german.py) - constants, strings for descriptions and messages\n* [ext_greenhouse.py](bot/ext_greenhouse.py) - extended bot\n* [lib_ext_greenhouse.py](bot/conf/lib_ext_greenhouse.py) - constants, strings for commands and texts\n* [lib_english.py](bot/conf/lib_english.py) - English translation of German version, is set in global lib\n* [gpio_check.py](bot/peripherals/gpio_check.py) - to check state of GPIOs and logs state, in case it is wished\n* [update_bot.sh](bot/update_bot.sh) - to updates all scripts from this repository by using last commit and branch\n   \n---\n### Enable autostart of the bot application\n##### Add the program as service. To enable autostart add it to the init.d directory, insert [telegrambot.sh](bot/telegrambot.sh) in **/etc/init.d** as root and execute commands as followed.\n\n```\nsudo chmod +x telegrambot.sh\nsudo update-rc.d telegrambot.sh defaults\nsudo reboot\n```\n\n* [how to](https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/#init)\n\n---\n\n### Additional functionality\n##### Add as required or wished\n\n##### Crontabs examples\n\n```\n# update check every 10 minutes\n0,10,20,30,40,50 * * * * bash /home/pi/scripts/TelegramBot/update_bot.sh \u003caccess token repository\u003e \u003cchat id\u003e \u003capi token\u003e\n\t\n# update check every hour\n0 * * * * bash /home/pi/scripts/TelegramBot/update_bot.sh \u003caccess token repository\u003e \u003cchat id\u003e \u003capi token\u003e\n\n# backup bot every day at 1:30AM\n30 1 * * * tar -zcf /home/pi/backups/greenhouse.tgz --exclude='*.pyc' /home/pi/scripts/TelegramBot/\n\n# also move log backups to backup folder\n31 1 * * * mv -v /*.gz /home/pi/backups/\n```\n\n##### Logrotate to compress and clear log files\n* see http://znil.net/index.php/Logfiles_in_Logrotate_aufnehmen_-_automatisches_packen,_rotieren_und_leeren_von_Logs \n\n```\nsudo nano /etc/logrotate.conf\n```\n\n```\n/update_bot.log {\n\tmissingok\n\tdaily\n\trotate 1\n\tcompress\n\tdateext\n\tcreate 644 root root\n}\n\n/greenhouse.log {\n\tmissingok\n\tdaily\n\trotate 1\n\tcompress\n\tdateext\n\tcreate 644 root root\n}\n```\n---\n## License\n\n[![license](https://img.shields.io/github/license/kaulketh/greenhouse.svg?color=darkred)](https://unlicense.org/)\n\n- **[License](https://github.com/kaulketh/greenhouse/blob/master/LICENSE    )**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaulketh%2Fgreenhouse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaulketh%2Fgreenhouse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaulketh%2Fgreenhouse/lists"}