GithubHelp home page GithubHelp logo

superbox-dev / unipi-control Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 3.0 1.3 MB

Control Unipi I/O directly with MQTT commands.

License: Apache License 2.0

Python 99.72% Dockerfile 0.08% Shell 0.20%
home-assistant home-automation mqtt iot python homeassistant smarthome internet-of-things unipi modbus

unipi-control's Introduction

coverage-badge CI Version

license-url PyPi downloads Typing: strict Code style: black Code style: Ruff

Unipi Control

Unipi Control use Modbus for fast access to the I/O and provide MQTT topics for reading and writing the circuits. Optionally you can enable the Home Assistant MQTT discovery for binary sensors, sensors, switches and covers.


For more information please read the documentation at: docs.superbox.one


Getting started

Recommended installation (only for Unipi Neuron)

We have a ready to use SD card image called Unipi Control OS.

Alternative installation with pip (Debian based systems)

Requirements:

Create a virtual environment:

python3 -m venv PATH_TO_VENV

Activate the virtual environment:

source PATH_TO_VENV/bin/activate

Install unipi-control with pip:

pip install unipi-control

Copy the config files to /etc/unipi and configurate the /etc/unipi/control.yaml.

Create the systemd service /etc/systemd/system/unipi-control.service with following content:

[Unit]
Description=Unipi Control
After=multi-user.target

[Service]
Type=simple
ExecStart=PATH_TO_VENV/bin/unipi-control --log systemd
Environment=PYTHONUNBUFFERED=1

[Install]
WantedBy=multi-user.target

Enable and start the systemd service:

systemctl --system daemon-reload
systemctl enable unipi-control.service
systemctl start unipi-control.service

Changelog

The changelog lives in the CHANGELOG.md document. The format is based on Keep a Changelog.

Contributing

We're happy about your contributions to the project!

You can get started by reading the CONTRIBUTING.md.

Donation

We put a lot of time into this project. If you like it, you can support us with a donation.

ko-fi

Extras

We have a Home Assistant blueprint automation to control covers with binary sensors. Take a look in the extras directory.

Additional information

This is a third-party software for Unipi Neuron. This software is NOT from Unipi Technology s.r.o..

unipi-control's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar kepi avatar mh-superbox avatar mh-x-net avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aufi lattic kepi

unipi-control's Issues

Unipi 1.1 support

What a wonderful project!

Would you be able to support the Unipi 1.1 as well?

I tried running your project, but I am getting an error because /sys/bus/i2c/devices/1-0057/eeprom seems to be read when it is empty with the Unipi 1.1.

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Support for switches as lights

Hi,

I discovered your project yesterday when I tried to replace some of custom scripts I'm using on my Unipi. After some digging, it seems it is much much better then I hoped for, thanks for it!

I'm currently using modbus integration in HA, but unipi-control seems much faster (more responsive), so I would like to ditch all my modbus configs and switch over to it. But I realized that all RO's are discovered as switches and there is no option in Features to handle RO as light instead of switch.

TBH, I'm not 100 % sure at this moment why I need light switches as lights :) but I remember I had troubles with this in HA before and it had been worth it to change modbus switches to lights.

I'm opening this issue more as a discussion - are you open to have this feature in unipi-control? If yes, I can try to prepare PR, but I would appreciate any tips for where to begin and how you would like to have this configured. My thought was add something like device_integration next to device_class.

Extension not working - probably need some clarification in documentation?

This is probably some misconfiguration on my part, but I'm not able to find what is wrong in logs or documentation.

Worth to mention that I added yml for xS10 extension myself #121 so there might be some error with it? I'm not sure at this moment how unipi-control decides which hw definition is used.

Here is relevant part of my configuration:

modbus_serial:
  port: /dev/extcomm/0/0
  baud_rate: 19200
  units:
    - unit: 1
      device_name: xS10
      identifier: xS10
      suggested_area: 1.03 Technická

Btw. I can't find in docs what identifier is used for.

In evok, working configuration is:

[EXTENSION_1]
global_id = 2
device_name = xS10
modbus_uart_port = /dev/extcomm/0/0
allow_register_access = False
address = 1
scan_frequency = 10
scan_enabled = True 
baud_rate = 19200  

Evok is stopped. When I start unipi-control, it says Reading extensions but there are no features from extension available, only those from main unit are.

(.venv) unipi@holly:~/dev/unipi_control$ sudo /home/unipi/.pyenv/shims/unipi-control
2023-11-19 21:05:54,959 | INFO | [MODBUS] TCP client connected to localhost:502
2023-11-19 21:05:54,963 | INFO | [MODBUS] Serial client connected to /dev/extcomm/0/0
2023-11-19 21:05:54,964 | INFO | [MODBUS] Reading SPI boards
2023-11-19 21:05:54,979 | INFO | [MODBUS] Reading extensions
2023-11-19 21:05:56,010 | INFO | [CONFIG] 72 features initialized.

Thanks for any tips.

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.