Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Deploy docs

on:
push:
branches: ["main","feat/documentation"]
paths:
- "documentation/**"

defaults:
run:
working-directory: documentation

jobs:
deploy-gh-pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: true

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: './documentation/package-lock.json'

- name: Build Blog
env:
NODE_OPTIONS: --max_old_space_size=4096
run: pnpm run build:vite

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: documentation/dist
14 changes: 11 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@ jobs:
build:
name: Docker build
runs-on: ubuntu-latest

environment: production
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: sguernion/rfxcom2mqtt
tags: |
type=raw,value=latest,enable={{is_default_branch}}

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -27,6 +34,7 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64, linux/arm64/v8, linux/arm/v7
tags: legobas/rfxcom2mqtt:latest
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.cache
.temp
yarn.lock
package-lock.json
dist
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
FROM node:latest

WORKDIR /usr/app
COPY package.json .
COPY ./src/package.json .
RUN npm install
COPY . .
RUN npm install -g ts-node typescript
COPY ./src .

CMD ["node", "rfxcom2mqtt.js"]
CMD ["ts-node", "index.ts"]
78 changes: 39 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,19 @@ RFXCOM to MQTT bridge for RFXtrx433 devices
All received RFXCOM events are published to the MQTT rfxcom2mqtt/devices/\<id\> topic.
It is up to the MQTT receiver to filter these messages or to have a register/learning/pairing mechanism.

## [Getting started](./docs/README.md)
The [documentation](./docs/README.md) provides you all the information needed to get up and running! Make sure you don't skip sections if this is your first visit, as there might be important details in there for you.

## Usage

<img align="left" height="100px" width="100px" src="https://user-images.githubusercontent.com/7738048/40914297-49e6e560-6800-11e8-8904-36cce896e5a8.png">

### [Home Assistant Integration](./docs/usage/integrations/home_assistant.md)

The easiest way to integrate Rfxcom2MQTT with Home Assistant is by
using [MQTT discovery](https://www.home-assistant.io/integrations/mqtt#mqtt-discovery).
This allows Rfxcom2MQTT to automatically add devices to Home Assistant.

### Configuration

See example **config.yml**
Expand All @@ -18,45 +29,7 @@ List of available commands:
[DeviceCommands](https://github.com/rfxcom/node-rfxcom/blob/master/DeviceCommands.md)


### Subscribe to topic **rfxcom2mqtt/devices** to receive incoming messages.

Example JSON message on topic `"rfxcom2mqtt/devices/0x5C02"`:

{
"title": "Bathroom Temp & Hum",
"type":"temperaturehumidity1",
"subtype": 13,
"id": "0x5C03",
"seqnbr": 12,
"temperature": 18,
"humidity": 74,
"humidityStatus": 3,
"batteryLevel": 9,
"rssi": 6
}

### Publish command examples (topic/payload)

rfxcom2mqtt/commmand/CucuDimmer
on

rfxcom2mqtt/commmand/CucuDimmer
off

rfxcom2mqtt/commmand/CucuDimmer
level 15

rfxcom2mqtt/commmand/Switch1 (lighting4, payload identifies device)
on

rfxcom2mqtt/commmand/Switch1
off

rfxcom2mqtt/commmand/Lights/Light1 (lighting2, unitName identifies device)
on

rfxcom2mqtt/commmand/Lights/Light1
off
### [MQTT Topics and Messages](./docs/usage/mqtt_topics_and_messages.md)

### Healthcheck

Expand All @@ -71,3 +44,30 @@ If installed in docker the container will try to restart try to reconnect to the
The [RFXCOM](https://github.com/rfxcom/node-rfxcom) Node library for the communication with the [RFXCOM](http://www.rfxcom.com) RFXtrx433 433.92MHz Transceiver.

The [MQTT.js](https://github.com/mqttjs/MQTT.js) library for sending and receiving MQTT messages.

## Development

```
nvm install 18.18
nvm use 18.18
npm install

ts-node src/dev.ts
```

### build docker image

Build a local image

```
docker-compose build
```

build multi Arch image

```
docker buildx build \
--platform linux/amd64,linux/arm/v7 \
--push \
-t sguernion/rfxcom2mqtt .
```
91 changes: 91 additions & 0 deletions config.sample.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@

loglevel: 'info'
healthcheck:
enabled: true
cron: '*/5 * * * *'
cacheState:
enable: true,
saveInterval: 5

homeassistant:
discovery: true
discovery_topic: homeassistant
discovery_device: rfxcom2mqtt

mqtt:
base_topic: rfxcom2mqtt
server: tcp://<IP ADDRESS>
username: <USERNAME>
password: <PASSWORD>
qos: 0
retain: false

rfxcom:
usbport: /dev/ttyUSB0
debug: false
transmit:
repeat: 4
lighting1:
- X10
- ARC
- ELRO
- PHILIPS_SBC
lighting2:
- AC
- HOMEEASY_EU
lighting3:
- KOPPLA
lighting4:
- PT2262
receive:
- temperaturehumidity1
- homeconfort
- lighting1
- lighting2
- lighting3
- lighting4
- remote
- security1

devices:
- id: '0x5C02'
friendlyName: 'Bathroom Temp & Hum'

- id: '0xB9459A'
friendlyName: 'Garden motion'

- id: '1001010/1'
name: 'CucuDimmer'
friendlyName: 'Kitchen Dimmer Light'
type: 'lighting2'

- id: '0x012E00FF'
friendlyName: 'Living Room switch'

- id: '0x00ED400F'
name: 'Lights'
units:
- unitCode: '1'
name: 'Light1'
friendlyName: 'Living Room'
- unitCode: '2'
name: 'Light2'
friendlyName: 'Kitchen'
- unitCode: '3'
name: 'Light3'
friendlyName: 'Garage'
- unitCode: '4'
name: 'Light4'
friendlyName: 'Garden'
type: 'lighting2'

- id: '0x3D090F'
name: 'Switch1'
command: 'on'
friendlyName: 'Living Room Lights on'
type: 'lighting4'
- id: '0x3D090E'
name: 'Switch1'
command: 'off'
friendlyName: 'Living Room Lights off'
type: 'lighting4'
80 changes: 0 additions & 80 deletions config.yml

This file was deleted.

8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ version: "3.8"

services:
rfxcom2mqtt:
image: legobas/rfxcom2mqtt
image: sguernion/rfxcom2mqtt
container_name: rfxcom2mqtt
build: /home/legobas/rfxcom2mqtt
build: ./
volumes:
- /home/legobas/data/rfxcom2mqtt:/app/data
- ./config:/app/data
devices:
- /dev/ttyUSB1:/dev/ttyUSB0
environment:
- TZ=Europe/Amsterdam
- TZ=Europe/Paris
restart: unless-stopped
Loading