Git Product home page Git Product logo

sirgoodenough / thermopi Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 166 KB

Use a Raspberry PI connected to one or more temperature sensors to send the results to a Home Assistant Instance via MQTT Discovery.

Home Page: https://www.WhatAreWeFixing.Today/

License: GNU General Public License v3.0

Python 88.76% Shell 11.24%
whatarewefixingtoday sirgoodenough temperature-sensors thermopi adafruit mqtt python am2302 systemd

thermopi's Introduction

ThermoPI

Use a Raspberry PI connected to one or more temperature sensors to send the results to a MQTT server. This is set-up for 1 temp/humid sensor so you will need to do some editing if you want to add more. This at lease gives you the building blocks.

USAGE

Install the program into opt/ThermoPI or any suitable location. (Some people like /usr/local/bin instead of /opt) Make sure the username that is going to be running this script has access to the files and is able to get at python and anything else needed and used here-in.

You will need to rename the file MYsecretsSample.yaml to MYsecrets.yaml. Edit the contents of the new MYsecrets.yaml to match your MQTT & Home Assistant installation and requirements. You will also need to supply the full path to the secrets file in the Get the parameter file section of this python code around line 45.

This program grabs the 2nd half of the MAC address to use as the device ID. This only works consistantly when there is only 1 Ethernet interface configured or you have your multiple interfaces cloned to the same MAC Address. For instance if it boots from WIFI, it will grab that MAC, and if ituses the Ethernet cable or a USB interface, it will grab that MAC. You get my point. HA will discover a different Device based on which interface connects first. This can be avoided by hard coding the DeviceID with the random and unique number of your choice. Also I have not tested this with IP6 addresses. If you have solutions to any of this, please share.

AUTO-Start

Here is a good reference on setting up a program to run from systemd. Use it to get familiar with the process.

How-To Geek on 'Startup With Systemd'

The load-service.sh script will stop and scratch reload the service from the local repository (Once you get all the permissions happy). The thermRestart.sh is the script to quickly restart the process if needed during troubleshooting. I found it helpful.

To start the program looping, you can write a short script to call like the example give in gpio4.sh. This script needs to be executable.

To run the program at boot in order to get constant readings, see the Example-rc.local file and do something similar. There is also ThermoPI.service to run this as a service with load-service.sh there to set it up as a service. (preferred)

Requirements

Program requirements (as written): (Feel free to fork it & update the obsolete DHT Libraries to CircuitPython DHT Libraries and dropping me a merge request...)

  • Python 3.6 or better
  • PyYAML For reading the YAML parameter file
  • Adafruit_DHT For temp / humid sensors (AM2302)
  • paho-mqtt For MQTT broker connection

If you have any questions, comments or additions be sure to add an issue and bring them up on my Discord Server:

This is the circuit used with this program: Circuit Used with ThermoPI

Contact Links

Please help support the channel

Disclaimer

⚠️ DANGER OF ELECTROCUTION ⚠️

If your device connects to mains electricity (AC power) there is danger of electrocution if not installed properly. If you don't know how to install it, please call an electrician.

Beware: certain countries prohibit installation without a licensed electrician present

Remember: SAFETY FIRST. It is not worth the risk to yourself, your family and your home if you don't know exactly what you are doing. Never tinker or try to flash a device using the serial programming interface while it is connected to MAINS ELECTRICITY (AC power).

We don't take any responsibility nor liability for using this software nor for the installation or any tips, advice, videos, etc. given by any member of this site or any related site.

thermopi's People

Contributors

sirgoodenough avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.