I2C Hardware

From Domoticz
Jump to navigation Jump to search

It is possible to add some I2C devices directly connected to your local GPIO into Domoticz.

Supported I2C devices are:

- BMP085, BMP180 Temp + Baro
- BMP280 Temp + Humidity + Baro
- PCF8574, PCF8574A PIO 8 bit expander
- HTU21D Humidity + Temp
- TSL2561 Illuminance
- MCP23017 GPIO 16bit expander

Installation

First connect the I2C device to the RPi GPIO Header.

Goto menu Setup - Hardware

  • Type: Select I2C Sensors Hardware Gateway from the pull down list.
  • Enabled/Disabled: you can disable the hardware gateway. The created devices stay active (but greyed out) but will not be updated.
  • Name: Enter a meaningful name for this I2C Gateway
  • Select Log Levels:
    • Info: Shows info logging about the hardware and its devices in the log file or log page. This will normally generate the most log lines
    • Status: Shows Status logging in the log file or log page.
    • Error: Shows Error logging in the log file or log page.
  • Data Timeout: Enable Data Timeout if needed (1 minute to 24 hours). Domoticz will restart the Hardware thread/plugin if after the set timeout still no data is received by the gateway.
  • Select the I2C Subtype from the pulldown list
  • Set the path to the I2C bus (eg /dev/i2c-1 or leave empty for autodetection)
  • For expanders enter I2C address
  • For expanders enable GPIO inversion if needed.

Click on Add to create the hardware. The related devices based on the I2C Subtype will be created and appear in the device list (menu Setup - Devices) and in your Device tabs.


Not supported I2C devices

For not supported devices you could create an external script (python/bash) that will read/write with the I2C device. Create Dummy Virtual devices and with http URL/API commands update the domoticz devices.

For Python you need to install the smbus library

sudo apt-get install python-smbus

See also for example:

https://www.domoticz.com/forum/viewtopic.php?t=33516