Coder Social home page Coder Social logo

pycul's Introduction

pycul

*** deprecated, since at least python 3.4 - not longer maintained ***

access CUL stick (based on http://culfw.de/) using Python3

CUL stick: http://shop.busware.de/product_info.php/cPath/1_35/products_id/29

usage of cul2mqtt.py:

change the folling setting depending on the local setup

  • cul_port = '/dev/ttyACM1'
  • cul_baud = 9600
  • mqtt_server = '192.168.2.36'
  • mqtt_port = 1883
  • mqtt_SubscribeTopic = 'smarthome/cul/to/#'
  • mqtt_PublishTopic = 'smarthome/cul/from/'
  • mqtt_user = '****'
  • mqtt_pass = '****'
  • mqtt_ca = '' ### not yet supported

after starting the script, CUL messages are send to stdout, e.g.

MQTT TX: Topic: FDC6900                             >> Message: FDC690000F2          [True]
FS20:    LichtKueche       FS20_Off                [raw:DC69-00-00-F2] (rssi:-81.0) DC690000F2
MQTT TX: Topic: FDC6902                             >> Message: FDC690211E4          [True]
FS20:    LichtKellerflur   FS20_On                 [raw:DC69-02-11-E4] (rssi:-88.0) DC690211E4
MQTT TX: Topic: K012321                             >> Message: K0123217937          [True]
S300TH:  1                 T:12.3 H:79.2                 [raw:0123217937] (rssi:-46.5)
MQTT TX: Topic: T162100                             >> Message: T162100A604F6        [True]
FHT80:   Erdgeschoss       FHT_ACTUATOR_4         2.0    [raw:1621-00-A6-04] (rssi:-79.0) 162100A604F6
MQTT TX: Topic: T162154                             >> Message: T1621546712F6        [True]
FHT80:   Erdgeschoss       FHT_ACTUATOR_18        7.0    [raw:1621-54-67-12] (rssi:-79.0) 1621546712F6
MQTT TX: Topic: T52FB7B                             >> Message: T52FB7B0234          [True]
FHT80TF: Multiraum         FHT80TF_WINDOW_CLOSED         [raw:52FB-7B-02-34] (rssi:-48.0) 52FB7B0234
...
MQTT RX: Topic: V                                   >> Message: .                    [False]
CUL:     sending V
MQTT TX: Topic: V 1.55                              >> Message: V 1.55 CUL868        [True]
CUL received: V 1.55 CUL868
...
MQTT RX: Topic: X                                   >> Message: T02                  [False]
CUL:     sending raw T02
MQTT TX: Topic: N/A                                 >> Message: N/A                  [True]
CUL received: N/A

controll CUL devices with mqtt messages:

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "smarthome/cul/to/$1" -m "$2

with $1 and $2: device starting with one of the following chars:

$1 description $2
V get Version of CUL stick refer to: http://culfw.de/commandref.html#cmd_V
X send raw command e.g. X21: , X00: , X61: , ... refer to: http://culfw.de/commandref.html#cmd_X
l control LED on the Stick with l00: LED on, l01: LED off, l02: LED blinking, refer to http://culfw.de/commandref.html#cmd_l
F  send message to FS20 device e.g. FABCDEF xx yy with ABDC = housecode, EF = device, xx = command, yy = timing, refer to http://culfw.de/commandref.html#cmd_F
T send message to FHT device t.b.d., refer to http://culfw.de/commandref.html#cmd_T

examples

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/V" -m ""
returns the Version of the CUL stick, e.g. V 1.55 CUL868

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/X" -m "X21"
sets the CUL stick to normal output mode

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/X" -m "X25"
sets the CUL stick to debugging mode

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/FDC69B1" -m "on"

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/FDC69B1" -m "toggle"

mosquitto_pub -h <hostname> -p <port> -u <username> -P <password> -t "/smarthome/cul/to/FDC69B1" -m "on-for-timer 120"

For more details on the CUL Stick, please check

pycul's People

Contributors

dirkclemens avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

pycul's Issues

RuntimeError: cannot reuse already awaited coroutine

Dear Dirk
I am trying to migrate my home automation devices from Fhem to Home Assistant and one big issue is how to include FS20,FHT,ESA devices in HA software. Luckly I found your python script which would solve my problem and you really did an excellent job. Unfortunately after I ran the script (python3 cul2mqtt.py) and got the error (see below). It is possible to help because my skills in python programming are very low specially with asyncio.

Kind regards

Andrej

CUL serial port opened:
SerialTransport(<_UnixSelectorEventLoop running=True closed=False debug=False>, <main.culRxTx object at 0x7f73bd7cbac0>, Serial<id=0x7f73bd7cb820, open=True>(port='/dev/ttyACM0', baudrate=9600, bytesize=8, parity='N', stopbits=1, timeout=0, xonxoff=False, rtscts=False, dsrdtr=False))
cul2mqtt.py:132: RuntimeWarning: coroutine 'sleep' was never awaited
asyncio.sleep(0.3)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
cul2mqtt.py:135: RuntimeWarning: coroutine 'sleep' was never awaited
asyncio.sleep(0.3)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
CUL init done.
starting loop
Traceback (most recent call last):
File "cul2mqtt.py", line 702, in
loop.run_until_complete(culSAIO)
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
RuntimeError: cannot reuse already awaited coroutine

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.