Coder Social home page Coder Social logo

python-lacrosse's Introduction

Pure Python Jeelink LaCrosse Library

BuildStatus PyPiVersion Python versions Coveralls Maintainability

Requirements

This library works with the Jeelink USB RF adapter and the Arduino sketch hosted on the FHEM website.

Tested Devices

  • Technoline TX 29IT
  • Technoline TX 29DTH-IT

Command Line Tool

# pylacrosse -h
usage: LaCrosse sensor CLI tool. [-h] [-v] [-d DEVICE] [-f FREQUENCY_RFM1]
                                 [-F FREQUENCY_RFM2] [-t TOGGLE_INTERVAL_RFM1]
                                 [-T TOGGLE_INTERVAL_RFM2]
                                 [-m TOGGLE_MASK_RFM1] [-M TOGGLE_MASK_RFM2]
                                 [-r DATARATE_RFM1] [-R DATARATE_RFM2]
                                 {scan,info,led} ...

optional arguments:
  -h, --help            show this help message and exit
  -v                    be more verbose
  -d DEVICE, --device DEVICE
                        set local device e.g. '/dev/ttyUSB0' or
                        set remote device e.g. 'rfc2217://[IP]:[PORT]'
                        default: '/dev/ttyUSB0'
  -f FREQUENCY_RFM1     set the frequency for RFM1
  -F FREQUENCY_RFM2     set the frequency for RFM2
  -t TOGGLE_INTERVAL_RFM1
                        set the toggle interval for RFM1
  -T TOGGLE_INTERVAL_RFM2
                        set the toggle interval for RFM2
  -m TOGGLE_MASK_RFM1   set the toggle mask for RFM1
  -M TOGGLE_MASK_RFM2   set the toggle mask for RFM2
  -r DATARATE_RFM1      set the datarate for RFM1
  -R DATARATE_RFM2      set the datarate for RFM2

Commands:
  {scan,info,led}
    scan                Show all received sensors
    info                Get configuration info
    led                 Set traffic LED state

The LaCrosse sensor generates the ID every time the battery is changed.

Use the cli tool pylacrosse to find your device:

# pylacrosse -d /dev/ttyUSB0 scan
id=40 t=16.000000 h=69 nbat=0 name=unknown
id=16 t=18.700000 h=60 nbat=0 name=unknown
id=0 t=17.400000 h=65 nbat=0 name=unknown

You can generate a file with know devices at ~/.lacrosse/known_sensors.ini

[0]
name = Kitchen
[16]
name = Livingroom
[40]
name = Bedroom

then the tool will print the defined names

# pylacrosse -d /dev/ttyUSB0 scan
id=40 t=16.000000 h=69 nbat=0 name=Bedroom
id=16 t=18.700000 h=60 nbat=0 name=Livingroom
id=0 t=17.400000 h=65 nbat=0 name=Kitchen

Using remote serial port with ser2net

You can also use ser2net to connect to a remote JeeLink Adapter. This can be useful, if you use a Docker container or if you can not attach a JeeLink adapter to your host running pylacrosse. On your remote device install ser2net and add the following line to your ser2net.conf file:

20001:telnet:0:/dev/ttyUSB0:57600 remctl banner

Restart the ser2net daemon and connect to your remote host using pylacrosse command line tool:

# pylacrosse -d rfc2217://[REMOTE_IP]]:20001 scan
id=40 t=16.000000 h=69 nbat=0 name=Bedroom
id=16 t=18.700000 h=60 nbat=0 name=Livingroom
id=0 t=17.400000 h=65 nbat=0 name=Kitchen

python-lacrosse's People

Contributors

fabaff avatar hthiery avatar legacycode avatar scop avatar smpj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-lacrosse's Issues

Support for TX35DTH-IT

Hi,
I am using your library as part of the home-assistant system I installed and wanted to include my TX35DTH Lacrosse sensors.
I had to modify the FHEM Sketch for the JeeLink Stick to use the 9579kbps datarate as default but as soon as it was flashed, the sensors work flawless with your library.
Probably you can add a way to make the library configurable and send an appropriate command to the stick if another bitrate or frequency is required (similar to FHEM). This could also add the Toogle command as described in the FHEM documentation.

Thanks for your work!

Unversioned egg-info

The release is missing for the egg-info.

   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/PKG-INFO
   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/SOURCES.txt
   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/dependency_links.txt
   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/entry_points.txt
   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/requires.txt
   /usr/lib/python3.8/site-packages/pylacrosse-unknown-py3.8.egg-info/top_level.txt

Would be nice to have a new release after it's fixed as this is an issue for Fedora RPM package. Thanks.

LacrosseGateway

Is there any chance you could add support for the LacrosseGateway (LGW) ? And the EC 3000 ?
The LGW sends data over a TCP socket instead of the serial port. And the EC 3000 is just an additional emitting on a different frequency.
I can support by sending you a LGW if needed.

Thanks for considering

Lacrosse TX25-IT two sensors with one ID

I've bought a TX25-IT. The device has an indoor and an outdoor sensor. It sends the values with one ID. First it sends the indoor temperature and after that the outdoor temperature and so on. Is it possible to get two entities in Home Assistant?

Not showing all sensors

Hi,
i switched from a former implementation on fhem to home assistant and not all of my lacrosse sensors are showing up. In my old setup i realized that the ids are sometimes not only integers (e.g. 3E). When using the CLI only 2 of the 4 are showing up. I tried to debug your code and had a look and the regexp and couldn't figure out what's going wrong. do you have an idea?

LED call & wait

I am trying to run this on a windows machine, I have got the py code rather than installed the package

firstly in clitool line 91 the call to lacrosse.led_config(state)
should be to led_mode_state(state)
the command to set the blue led should be 1l (lowercase L) not 1a

if I run with parameters -d /COM3 led on nothing happens
putting a time.sleep(3) at the start of led_mode_state() the blue light comes on

If I run -d /COM3 info the data returned is 'b\r\n' and so all info shows as nothing
running '-d /COM3 scan' nothing gets returned.
I assume it is a timing issue but don't have the experience or knowledge to get any further.

Serial connection only over relay (socat)

A JeeLink is connected to /dev/ttyUSB0.

Everything described below is executed with a user has full access to /dev/ttyUSB0:

When I try to scan the sensors using the following command, there is no response from pylacrosse:
pylacrosse -r 1 -d /dev/ttyUSB0 scan

To monitor the behavior, I created a relay with socat:
socat /dev/ttyUSB0,raw,echo=0 SYSTEM:'tee in.txt |socat - "PTY,link=/tmp/ttyUSB0,raw,echo=0,waitslave" |tee out.txt'

Started pylacrosse again using the relay:

pylacrosse -r 1  -d /tmp/ttyUSB0 scan
id=16 t=-0.100000 h=85 nbat=0 name=unknown
id=32 t=0.700000 h=83 nbat=0 name=unknown

Strangely now pylacrosse is displaying my sensors...

Terminal programs (tested with picoterm and here with pythons minicom) are also working:

python -m serial.tools.miniterm /dev/ttyUSB0 57600
--- Miniterm on /dev/ttyUSB0  57600,8,N,1 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
โ€

[LaCrosseITPlusReader.10.1s (RFM69CW f:868300 r:17241)]
1r
v

[LaCrosseITPlusReader.10.1s (RFM69CW f:868300 r:9579)]
OK 9 43 1 4 116 53
OK 9 16 1 3 231 85

--- exit ---

Info:The commands "1r" and "v" were not echoed and added manually.

The info-command also works with pylacrosse (for /dev/ttyUSB0 and /tmp/ttyUSB0):

pylacrosse -d /dev/ttyUSB0 info
name:     LaCrosseITPlusReader
version:  10.1s
rfm1name: RFM69CW
rfm1frequency: 868300
rfm1datarate: 17241
rfm1toggleinterval: None
rfm1togglemask: None

Used versions:

  • pylacrosse: 0.3.1 (as shown in version.py)
  • python: 3.7.1

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.