My personal project for collecting, processing, storing the sensor data I'm collecting in my home.
- Loading hubitat temp data into databases:
- hubitat is configured to send data to my LAN server's
/sensor
flask route which callsreceive_sensor_data()
load_sensor()
celery task is called from the above route
- hubitat is configured to send data to my LAN server's
- Pull / load public weather data:
- Won't have anything to do with flask, just a timed (periodic) celery task
- must be in the directory where the
docker-compose.yml
file is for the following commands - To rebuild the docker-compose containers:
sudo docker-compose build
- To check if your docker compose is running, you run
sudo docker-compose ps
- Spin up the docker-compose,
sudo docker-compose up -d
(-d
puts it in the background). I also have a systemd service file that starts this up automatically in the event the server reboots. - this is a great resource about configuring celery and rabbitmq
- Using the Maker API app within hubitat, we can either push data to our LAN device at a dedicated IP, or I can poll endpoints continuously from my LAN device to my hubitat. I think it's a little cleaner to push the data instead of poll for it. That's the direction I'm taking for now.
It quickly became too much work to maintain my virtual box VM and keep that in-sync with the resources installed on my LAN server. So now I'm treating my LAN server as my development server.
When adding more functionality in the future:
- make sure
./transfer_files_to_server.sh
is pushing all the files my LAN server will need - update all of the
.dockerfile
s to make sure they all have the right files, dependencies, etc - run
./transfer_files_to_server.sh
, ssh into the LAN server, navigate to the project directory, executesudo docker-compose up -d
- omit the
-d
if you want to read the logs as data is passing through the system - useful for testing/debugging
To run tests (there's only a handful of tests for utils currently):
$ pytest -rA
This stack overflow answer has good info on inspecting logs of a running docker compose environment