Giter VIP home page Giter VIP logo

homeassistant-mcp2221's Introduction

logo

HomeAssistant MCP2221 integration

validate hacs_badge

Integration that adds missing GPIOs (input, output, ADC) to your NUC or Proxmox-based installation over USB.

# Example configuration.yaml entry
mcp2221:
  - switches:
      - name: "Output 0"
        pin: 0
        unique_id: out0
      - name: "Output 1"
        pin: 1
        unique_id: out1
    binary_sensors:
      - name: "Input 2"
        pin: 2
        unique_id: in2
        device_class: door
      - name: "Input 3"
        pin: 3
        unique_id: in3
        icon: mdi:electric-switch
    # adc:
    #   ref: 4.096
    #   sensors:
    #     - name: "voltage"
    #       pin: 3
    #       unique_id: adc3

Install via HACS

You can find this integration in the community store.

Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

Install manually

You need to copy the mcp2221 folder from this repo to the custom_components folder in the root of your configuration. The file tree should look like this:

└── ...
└── configuration.yaml
└── custom_components
    └── mcp2221
        └── __init__.py
        └── sensor.py
        └── ...

Note: if the custom_components directory does not exist, you need to create it.

Full examples

1️⃣Switch (output) & multiple devices You can also specift multiple device, just adjust the index (`dev`) or even specify different PID/VID
mcp2221:
  - dev: 0
    pid: 0x00DD
    vid: 0x04D8
    switches:
      - name: "Output 0"
        pin: 0
        unique_id: output_0_0
        icon: mdi:toggle-switch
  - dev: 1
    switches:
      - name: "Output 0"
        pin: 0
        unique_id: output_1_0
        icon: mdi:toggle-switch
2️⃣Binary sensor (input) ❗Don't leave pin floating
mcp2221:
  binary_sensors:
    - name: "Input 1"
      pin: 1
      inverted: True
      unique_id: input_0
      icon: mdi:toggle-switch
      scan_interval: 10
      device_class: door
3️⃣Sensor (ADC) Only pins GP1-GP3, result is 10-bit (0-1023)

You can also adjust the result, example here is when power supply is 3.3V

mcp2221:
  adc:
    ref: "VDD" # or 1.024, 2.048, 4.096
    sensors:
      - name: "Battery voltage"
        pin: 3
        unique_id: battery_voltage
        scan_interval: 50
        icon: mdi:car-battery
        device_class: voltage
        unit_of_measurement: V
        value_template: "{{ value * 3.3 / 1023}}"

homeassistant-mcp2221's People

Contributors

pilotak avatar dependabot[bot] 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.