Package: rpi-thermo-chick
rpi-thermo-chick 🐔🔥Rapsberry-pi Thermostat for chicken.Backend python 3 - fastapi / frontend vuejs - vuetifyHardwareRaspberry Pi (zeroin that case, should work with all the other)Temperature sensorDS18B20using1-wire(example)Relay hat (example)OS preparationEnable1-wire:Add following lines to your/boot/config.txt:[all]dtoverlay=w1-gpio,gpiopin=3# default pin is 4 but it enter in conflict with relay hatInstallThis project is meant to run as a  service (see next section), but to give it a try you can instal it as a normal user (lets assume aspidefault user).# install from pip repositorypipinstallrpi-thermo-chick# create empty configuration filesudopi-thermo-chick.serviceconfigure# edit configuration file (See configuration section)sudonano/root/.config/rpi-thermo-chick/config.jsonInstall as a serviceAll the following command are prefix by sudo cause the service will be run as a service (as root user).# install from pip repositorysudopipinstallrpi-thermo-chick# create empty configuration filesudopi-thermo-chick.serviceconfigure# edit configuration file (See configuration section)sudonano/root/.config/rpi-thermo-chick/config.json# install service (register in systemd)sudorpi-thermo-chick.serviceinstall# now enable(auto start) and start  the servicesudosystemctlenablerpi-thermo-chick.service
sudosystemctlstartrpi-thermo-chick.service# check if the service is properly runningsudosystemctlstatusrpi-thermo-chick.serviceNow service should be running (openhttp://<pi-ip>:8000/appto check) and will start automatically with the pi.ConfigurationYou have to configure 2 things, the pins you use for the relay and the device id of the thermometers.To create default config file run:pi-thermo-chick.serviceconfigureIt will create a config file in you current user configuration directory, edit that file (withnanoor any other file editor).For example if you user ispi, config file will be be/home/pi/.config/rpi-thermo-chick/config.json.Configuration file content is a simple json and look like:{"relays":[{"pin":4},{"pin":7}],"thermometers":[{"device":"28-3c01d0751fcd","name":"inside"},{"device":"28-3c01d075db96","name":"outside"}],"influxdb":{"url":"http://localhost:8086","bucket":"bucket","org":"org","token":"<token>"}}Configure thermometersTo know your thermometer device id run the following command:ls/sys/bus/w1/devices|grep28-*It will return something like:28-3c01d0751fcd
28-3c01d075db96Update your configuration file with your own values.⚠️make sure the first thermometer is the inside thermometer that device will control the relay.Configure relaysSimply update the config file with the physical gpio pins wired to the relays.⚠️make sure the first relays is the one controlling the load (second one is not used)Configure influxdb (optional)Data history is stored ininfluxdb(2.x), to enable this feature pass a valid influxdb url/org/bucket/token in the config file.Obviously the token must provide write permission so relays and temperature sensor data can be stored.Setup of influxdb is out of the scope of this project, please seehttps://hub.docker.com/_/influxdborhttps://docs.influxdata.com/influxdb/v2.4/install/.Developmentgitclonehttps://github.com/vrince/rpi-thermo-chick.gitcdrpi_thermo_chick# build and activate a virtual env (optional)# install in dev modepipinstall-e.# see configurationnanoconfig.json# run it locally with the config you just createdrpi-thermo-chick--config-fileconfig.json--port8000Openhttp://<pi-ip>:8000/appto see thevuejsappOpenhttp://<pi-ip>:8000to see current state json payloadNote: replace<pi-ip>by you actual raspberry pi address, like192.168.2.205You can still run and develop on a machine that is not a rpi and that has nothing plug to it, temp dat will be random but everything will still workAPIAs the API usefast-apithe documentation of the API can be access athttp://<pi-ip>:8000/docsReferences1-wireAdafruits ds18b20 (lesson 11)fastapivuejsvuetifyjsinfluxdata