Code Monkey home page Code Monkey logo

rf_intertechno's Introduction

RF InterTechno Decoder

A small tool to decode the packets received by RFSwitch: https://github.com/wguerlich/RFSwitch RFSwitch is a small tool that detects the Intertechno RF signals from an CC1101/CC1100 tranceiver that is connected directly to a Raspberry PI by SPI. RFSwitch does not decode the RF symbols though.

This small Typescript based Node Server decodes the RF Symbols based on Javascript Code from wguerlich: wguerlich/RFSwitch#1

Install Instructions:

  1. Install node and npm
  • The code was tested with node v8.12.0 and npm 6.4.1
  • This versions are not included in Raspbian apt. Search the web for install instructions for node binaries.
  • The code wil likely not work with node versions before 8.5
  1. Install Typescript:
  • npm install -g typescript
  1. Install Packages:
  • npm install
  1. Compile Typescript:
  • tsc

Run the server by:

  • sudo node server

Sudo is required as RFSwitch otherwise cannot connect to SPI

Edit config/config.json as you like -> Set the URL of your MQTT Server

The received button presses are by default transmitted as topic "intertechno_event" over MQTT. You can change the topic in the config.

------------------------------------------------------

In case you want to run this as a service:

  1. Copy rfintertechno.service to /etc/systemd/system/rfintertechno.service
  • sudo cp rfintertechno.service /etc/systemd/system/rfintertechno.service
  • sudo systemctl daemon-reload
  • sudo systemctl enable rfintertechno.service
  • Edit the path to yours!!!
  1. Edit the sudoers file
  • sudo visudo -f /etc/sudoers.d/smarthome
  • Add this line: root ALL = NOPASSWD:/usr/bin/node /home/pi/RF_InterTechno/server
  • (the path must match the line in service)

rf_intertechno's People

Contributors

thmang82 avatar

Stargazers

 avatar

Watchers

 avatar

rf_intertechno's Issues

Username and Password for MQTT

Hey
Can you please add username and password for MQTT.
Well i got it to work , Can you add this guide for next person.
git clone https://github.com/wguerlich/RFSwitch

1# Install Node.js
sudo apt-get install -y nodejs git make g++ gcc

2# Verify that the correct nodejs and npm (automatically installed with nodejs)

version has been installed

node --version # Should output v8.X.X (at time of writing v8.11.2)
npm --version # Should output > 5.X.X (at time of writing 5.6.0)

3# Clone RF_InterTechno repository
sudo git clone https://github.com/thmang82/RF_InterTechno

4#Install Typescript:
cd /RF_InterTechno
sudo npm install -g typescript

5# Install dependencies
cd RF_InterTechno
npm install

6#Compile Typescript:
tsc

If everything went correctly the output of npm install is similar to (the number of packages and seconds is probably different on your device):

replace mqtt_service.ts
with info

node-pre-gyp info ok
#Edit nano /home/pi/RF_InterTechno/config/config.json

{
    "log_std_out": true,
    "log_to_file": false,
    "log_path": "/home/pi/RF_Intertechno/log/RfInterTechno.log",

    "repeat_inside_ms": 600,
    
    "conf_path_rfswitch": "/home/pi/RFSwitch/",
    "conf_exec_rfswitch": "/home/pi/RFSwitch/RFSwitch",
    "mqtt": {
        "url": "mqtt://localhost",
        "topic": "intertechno_event",
        "options" : {
            "user": "my_username",
            "password": "my_password"
        }
    }
}

Save the file and exit.
6.
Change mqtt_service.ts

import { logger } from "./logger";

const mqtt = require('mqtt');
var conf   = require('./../../config/config.json');

class MqttClass {
    private client: any;
    private connected = false;

    constructor(){
        this.client = mqtt.connect(conf.mqtt.url, conf.mqtt.options);

        this.client.on('connect', () => {
            this.connected = true;
            logger.log('MQTT: connect');
            // this.client.subscribe('RfInterTechnoControl/#')
        })
        this.client.on('reconnect', () => {
            logger.log('MQTT: reconnect');
        })
        this.client.on('error', (error) => {
            logger.log('MQTT: error: ', error);
        })
        this.client.on('close', () => {
            this.connected = false;
            logger.log('MQTT: close');
        })
        this.client.on('offline', () => {
            logger.log('MQTT: offline');
        })
        
        this.client.on('message', (topic, message) => {
            let message_str = message.toString();
            let topic_elems = topic.split("/");
        })
    }

    public sentMsg = (topic: string, message: string): boolean => {
        if (this.connected){
            this.client.publish(topic, message);
            logger.log("MQTT: sentMsg()");
            return true;
        } else {
            logger.log("MQTT: sentMsg() - OFFLINE");
            return false;
        }
    }
    
    public getIsConnected(): boolean {
        return <boolean> this.client.connected;
    }
    
}

export const mqttService: MqttClass = new MqttClass();
  1. Starting RF_InterTechno
    Now that we have setup everything correctly we can start RF_InterTechno.

cd /home/pi/RF_Intertechno/

Must start with Sudo else wont get spidev0 acess.

sudo npm start

decoded_v3: nosync <= Not Ok

hey
Iam running Raspberry pie 2 B , using CC1101 with the pinouts from wiringpi and i get this error.

[email protected] start /home/pi/RF_InterTechno
node server.js

Logger - dir_base_path: /home/pi/RF_InterTechno/src/utils
Packet Analyzer - MQTT Topic: undefined
Start RFSwitch ...
Starting app with cmd: /home/pi/RFSwitch/RFSwitch [] in dir: /home/pi/RFSwitch/
After App Starting -> PID: 8280
decoded_v3: nosync <= Not Ok
decoded_v3: nosync <= Not Ok

CC1101<->Raspi

Vdd    -    3.3V (P1-01)
SI     -    MOSI (P1-19)
SO     -    MISO (P1-21)
CS     -    SS   (P1-24)
SCLK   -    SCK  (P1-23)
GDO2   -    GPIO (P1-22)
GDO0   -    not used in this demo
GND    -    P1-25

My CC1101 works i tried it with CC debugger with SmartRF studio and also wiringpi.

pi@raspberrypi:~/CC1101 $sudo ./TX_Demo -v -a1 -r3 -i1000 -t5 -c1 -f434 -m100
 Raspberry CC1101 SPI Library test
> Init CC1100...
> Partnumber: 0x00
> Version   : 0x14
> ...done!
> Mode: 3
> Frequency: 2
> Channel: 1
> My_Addr: 1
> Config Register:
> 0x07 0x2E 0x80 0x07 0x57 0x43 0x3E 0x0E 0x45 0x01
> 0x01 0x08 0x00 0x10 0xB0 0x71 0x5B 0xF8 0x13 0xA0
> 0xF8 0x47 0x07 0x0C 0x18 0x1D 0x1C 0xC7 0x00 0xB2
> 0x02 0x26 0x09 0xB6 0x04 0xEC 0x2B 0x19 0x11 0x51
> 0x00 0x59 0x7F 0x3C 0x81 0x3F 0x0B
> PaTable:
> 0x6C 0x1C 0x06 0x3A 0x51 0x85 0xC8 0xC0
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x01
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x02
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x03
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x04
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x05
> TX_FIFO: 0x06 0x03 0x01 0x00 0x00 0x03 0xE8
>  #:0x06

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.