Git Product home page Git Product logo

ha-mcp23017's Introduction

HA-mcp23017

MCP23008/MCP23017 implementation for Home Assistant (HA)

Highlights of what it does offer

  • Async implementation (more reactive and nicer to HA)
  • Thread-safety allows different entities to use the same component
  • Config Flow support (UI configuration) in addition to legacy configuration.yaml.
  • Push iso pull model for higher reactivity, e.g. 100ms polling for 'zero-delay' push button without loading HA.
  • Optimized i2c bus bandwidth utilisation
    • Polling per device instead of per entity/8x gain, register cache to avoid read-modify-write/3xgain or rewriting the same register value)
  • Synchronization with the device state at startup, e.g. avoid output glitches when HA restart.
  • Compatible with MCP23008 device (8 pins variant).

Installation

1. Add this MCP23017 integration to HA

  • Using HACS
  • Or by updating manually your custom_components folder
    • Clone or download this repository
    • Move custom_components/mcp23017 to your <ha_configuration_folder>, e.g. /home/homeassistant/.homeassistant/custom_components/mcp23017
    • Restart HA and clear browser cache (or restart a browser); latter is required for new config_flow to show up

2. Add your mcp23017 component(s) using either:

  • config flow (Configuration->Integrations->Add integration)
    • Created entities will be visible in the Integrations tab and aggregated per device (i2c address) in the Devices tab.
    • Entity parameters (invert logic, pull-up, ...) can be adapted individually by using the entity's Options button once created.
  • configuration.yaml see configuration example below.
    • Syntax is compatible with the now defunct core implementation (removed by home-assistant/core#67281)
      • New hw_sync option allowing to either synchronize initial value of the switch with the hardware (true, default option) or to set it to a fixed value (false, value=invert_logic)
    • Entity parameters (invert logic, pull-up, ...) can only be set globally for all pins of a given device/integration.

Example entry for configuration.yaml:

# Example configuration.yaml

binary_sensor:
  - platform: mcp23017
    i2c_address: 0x26
    pins:
      8 : Button_0
      9 : Button_1
      10: Button_2
      11: Button_3
  - platform: mcp23017
    i2c_address: 0x27
    invert_logic: true
    pins:
      8: Button_4
      9: Button_5
      10: Button_6
      11: Button_7

switch:
  - platform: mcp23017
    i2c_address: 0x26
    pins:
      0 : Output_0
      1 : Output_1
      2 : Output_2
      3 : Output_3
  - platform: mcp23017
    i2c_address: 0x27
    hw_sync: false
    pins:
      0 : Output_4
      1 : Output_5
      2 : Output_6
      3 : Output_7

ha-mcp23017's People

Contributors

jpcornil-git 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.