Giter VIP home page Giter VIP logo

iot_control's Introduction

Connect your IoT devices

This project provides a framework to easily connect IoT devices (sensors and switches) with different backends. It allows to include more backends and devices.

Supported devices:

  • BME280 sensor: humidity, air pressure, temperature
  • ADS1115 sensor: analog digital converter
  • BH1750: illuminance
  • Raspberry PI GPIO switches: drive GPIO pins on the raspberry pi. To actually drive the pins you need to use the mqtt-hass backend.
  • Shell command switches: run shell commands when a switch is clicked in Home Assistant. Has an 'on' and an 'off' command.
  • Raspberry PI cover for garage doors or covers as defined by Home Assistant. It uses two input pins to detect the closed or opened state of the cover and one output pin which triggers a pulse so that the garage door motor is put into action.

Supported backends:

Backends can set and read states if the functionality of the software used provides this. Pure database backends like influx will only store the values from the sensors.

Prerequisites

  • Install .deb packages: 'sudo apt install python3-yaml'
  • Install PIP packages: 'pip3 install smbus2 RPi.GPIO rpi.bme280 paho-mqtt influxdb'

Hint: On Raspbian GNU/Linux 9.13 (stretch) don't use the .deb package 'python3-influxdb' but the much newer pip3 package 'influxdb'

How to get started:

  1. Get some sensors and a small device to run the sensors on. The device should be able to run python.
  2. Make sure you habe a suitable backend that will store the data or interact with the sensors. That's why you are here, right? So maybe you have an Home Assistant installation already. Then please check that mqtt is enabled. Otherwise: get one or get an InfluxDB instance.
  3. Clone this project at the device and copy the example setup to a setup.yaml and edit the content of the setup file according to your needs.
  4. Run rooftop.py. Maybe with a screen session, but much better as a service (via systemd).

I need support for more backends and more sensors

Send me a message, I'll write this when its needed. It should be easy to add more of both kinds.

iot_control's People

Contributors

knuedd avatar mkluge avatar

Watchers

 avatar  avatar

Forkers

knuedd

iot_control's Issues

add auto-off functionality to iotraspigpio

I'd like to add an auto-off feature. If a raspi GPIO is switched on then it switches itself off after minutes. This should happen locally on the raspi so that the garden doesn't get flooded because the wifi is interrupted or the mqtt broker fails or whatever.

Basically, this is simple with HA MQTT. But if goes against the architecture of iot_control. The 'mqtthass' component doesn't know about the 'iotraspigpio' cpmponent's details and 'iotraspigpio' is not supposed to send MQTT messages.

What would be a clean solution?

Option A: The backends already know the devices. Should the devices get to know the backends as well? And then call them directly? Sounds wrong, doesn't it?

Option B: The device get a pointer to the iotruntime object. And the iotruntime gets a "switch me <on/off> in time" functionality. This could be equivalent to a MQTT message arriving but triggered locally. The time could be in granularity of the iotruntime.update_intervall -- in every loop iteration it checks if anything is due from an ordered list of scheduled events ( == option B1). Or it could use a background thread via Python's threading.Timer ( == option B2).

Which one would you like?

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.