No Description

Fabian Peter Hammerle 9596bd578f release v0.2.1 3 years ago
intertechno_cc1101_mqtt d5415225ae added option `--power-setting` 3 years ago
tests d5415225ae added option `--power-setting` 3 years ago
.dockerignore d0a34c14ff added dockerfile 3 years ago
.gitignore 538e5192ed mqtt client draft 3 years ago
.pylintrc 5ac6f8a2c2 refactor: added power_setting param to _run 3 years ago
CHANGELOG.md ab96bc49c1 release v0.2.1 3 years ago
Dockerfile dabcfcc7ae dockerfile: rename source dir 3 years ago
Makefile 685a4378c3 release v0.1.0 3 years ago
Pipfile f619e90e49 upgrade intertechno-cc1101 library to prepare for parametrization of power setting 3 years ago
Pipfile.lock 64e47b846c upgrade cc1101 library to fix deadlock on SPI device file occurring when exception gets raised while entering cc1101.CC1101's context 3 years ago
README.md 34c3188f60 publish home assistant discovery config 3 years ago
docker-compose.yml d5415225ae added option `--power-setting` 3 years ago
mypy.ini 538e5192ed mqtt client draft 3 years ago
setup.py f619e90e49 upgrade intertechno-cc1101 library to prepare for parametrization of power setting 3 years ago

README.md

intertechno-cc1101-mqtt

MQTT client controlling Intertechno Outlets via a CC1101 Transceiver

Compatible with Home Assistant's MQTT Switch platform.

Requirements

Setup

$ pip3 install --user --upgrade git+https://git.hammerle.me/fphammerle/intertechno-cc1101-mqtt

On Raspbian / Raspberry Pi OS, dependencies can optionally be installed via:

$ sudo apt-get install --no-install-recommends python3-spidev python3-paho-mqtt

Usage

$ intertechno-cc1101-mqtt --mqtt-host HOSTNAME_OR_IP_ADDRESS

Send ON or OFF to topic intertechno-cc1101/[ADDRESS]/[BUTTON_INDEX]/set.

$ mosquitto_pub -h MQTT_BROKER -t intertechno-cc1101/12345678/0/set -m ON

⚠️ Support for TLS is not implemented yet. Do not connect to brokers via unprotected networks (e.g., internet, wifi network).

Aliases

$  intertechno-cc1101-mqtt --mqtt-host HOSTNAME_OR_IP_ADDRESS --alias-file aliases.json

with aliases.json:

{"some-name": {"address": 12345678, "button-index": 0},
"another-name": {"address": 12345678, "button-index": 1},
"another_address": {"address": 21420815, "button-index": 0}}

Send ON or OFF to topic intertechno-cc1101/[ALIAS]/set.

$ mosquitto_pub -h MQTT_BROKER -t intertechno-cc1101/some-name/set -m ON

Home Assistant 🏡

Automatic Discovery

Home Assistant will detect devices specified in --alias-file aliases.json automatically, if connected to the same MQTT broker and MQTT discovery is enabled (enabled by default since version 0.117.0).

Manual Configuration

# https://www.home-assistant.io/docs/mqtt/broker/#configuration-variables
mqtt:
  broker: BROKER_HOSTNAME_OR_IP_ADDRESS
  # credentials, additional options…

# https://www.home-assistant.io/integrations/switch.mqtt/#configuration-variables
switch:
- platform: mqtt
  name: intertechno_smart_outlet
  command_topic: intertechno-cc1101/12345678/0/set
  # http://materialdesignicons.com/
  icon: mdi:light-switch

Docker 🐳

$ sudo docker build -t intertechno-cc1101-mqtt .
$ sudo docker run --name intertechno_cc1101_mqtt \
    --read-only --cap-drop ALL --security-opt no-new-privileges \
    --device /dev/spidev0.0 intertechno-cc1101-mqtt \
    intertechno-cc1101-mqtt --mqtt-host HOSTNAME_OR_IP_ADDRESS …

Docker Compose 🐙

  1. Clone this repository.
  2. Adapt command in docker-compose.yml.
  3. sudo docker-compose up --build