GithubHelp home page GithubHelp logo

concongo / pylacrossapi Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 27 KB

This Python API will allow you to get data from your Lacrosse Temperature and Humidity Device

License: MIT License

Python 100.00%
python api

pylacrossapi's Introduction

LA CROSSE MOBILE TX60U-IT API Wrapper

An easy way to monitor your LA CROSSE MOBILE Wireless Temperature and Humidity Sensor

Compatible with Python 3

Install

python setup.py install

Usage

Create Device

from pylacrossapi import lacrosse

<device> = lacrosse(<deviceid>,<Temp Unit -- (0) American (1) Metric -->,<timezone>)

Time Zone codes

"10": 'America/Denver', "4": 'America/Phoenix', "2": 'America/Chicago', "3": 'America/New_York', "8": 'America/Los_Angeles', "5": 'America/Anchorage', "6": 'Pacific/Honolulu', "7": 'America/Halifax', "9": 'America/Montreal', "1": 'America/Boise', "65": 'America/Adak', "55": 'America/Argentina/Buenos_Aires', "15": 'America/Aruba', "88": 'America/Atikokan', "26": 'America/Bogota', "37": 'America/Caracas', "69": 'America/Cayman', "81": 'America/Chihuahua', "70": 'America/Costa_Rica', "79": 'America/Creston', "29": 'America/Danmarkshavn', "36": 'America/Dawson', "27": 'America/Dawson_Creek', "100": 'America/Detroit', "16": 'America/Edmonton', "87": 'America/El_Salvador', "92": 'America/Fortaleza', "66": 'America/Glace_Bay', "82": 'America/Grenada', "38": 'America/Guayaquil', "12": 'America/Indiana/Indianapolis', "86": 'America/Indiana/Knox', "51": 'America/Indiana/Tell_City', "59": 'America/Indiana/Vincennes', "44": 'America/Indiana/Winamac', "97": 'America/Iqaluit', "30": 'America/Juneau', "39": 'America/Kentucky/Louisville', "32": 'America/Kentucky/Monticello', "42": 'America/La_Paz', "71": 'America/Lima', "74": 'America/Managua', "45": 'America/Matamoros', "47": 'America/Menominee', "53": 'America/Metlakatla', "95": 'America/Mexico_City', "22": 'America/Moncton', "94": 'America/Monterrey', "96": 'America/Noronha', "78": 'America/North_Dakota/Beulah', "34": 'America/North_Dakota/Center', "54": 'America/North_Dakota/New_Salem', "63": 'America/Port_of_Spain', "62": 'America/Puerto_Rico', "91": 'America/Rainy_River', "23": 'America/Regina', "19": 'America/Resolute', "20": 'America/Santiago', "52": 'America/Santo_Domingo', "25": 'America/Sao_Paulo', "41": 'America/Scoresbysund', "67": 'America/Shiprock', "72": 'America/Sitka', "46": 'America/St_Johns', "40": 'America/St_Kitts', "68": 'America/St_Thomas', "48": 'America/Swift_Current', "35": 'America/Thunder_Bay', "13": 'America/Tijuana', "17": 'America/Toronto', "85": 'America/Tortola', "18": 'America/Vancouver', "84": 'America/Whitehorse', "33": 'America/Winnipeg', "11": 'America/Yakutat', "50": 'America/Yellowknife', "58": 'Asia/Bahrain', "24": 'Asia/Dubai', "31": 'Asia/Hong_Kong', "89": 'Asia/Jerusalem', "57": 'Asia/Qatar', "43": 'Asia/Seoul', "80": 'Asia/Singapore', "77": 'Asia/Tokyo', "103": 'Asia/Vietnam', "98": 'Australia/Adelaide', "60": 'Australia/Brisbane', "49": 'Australia/Melbourne', "14": 'Australia/Perth', "76": 'Australia/Sydney', "102": 'Canada/Newfoundland', "93": 'Europe/Athens', "28": 'Europe/Berlin', "73": 'Europe/Brussels', "64": 'Europe/London', "99": 'Europe/London', "75": 'Europe/Moscow', "90": 'Europe/Oslo', "21": 'Europe/Rome', "56": 'Europe/Vatican', "83": 'Europe/Warsaw', "61": 'Europe/Zurich', "101": 'IndiaStandardTime', "104": 'Pacific/Auckland'

Example

device_id = 02839203

unit_measure = 1

time_zone = 37

device1 = lacrosse(device_id,unit_measure,time_zone)

Get Observations

device1.getObservation(n)

Where n is the number of observations from the most recent one

Returned Dictionary

The API returns an array of dict where each row is a measure and the dict has the following variables:

  • linkquality: It's the RF signal strength of the device to the hub
  • lowbattery: 0 or 1. It's a signal
  • ambient_temp: it is the temperature measure by the device in the unit specified
  • humidity: Percentage of the relative humidity
  • utctime: Time in UTC
  • device_type: returns the model
  • timestamp: returns the time of the observation on the specified timezone
  • probe_temp: if a probe is connected, returns the temperature measured

Example of Usage

from pylacrossapi import lacrosse

device_id = 02839203
unit_measure = 1
time_zone = 37
device1 = lacrosse(device_id,unit_measure,time_zone)

obs=device1.getObservation(3)
#Returns the last three observation

print obs[1]["ambient_temp"]
#Prints the second observation Temperature`

pylacrossapi's People

Contributors

concongo avatar legomaniac avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

legomaniac

pylacrossapi's Issues

Support for Python 3?

Hello @concongo !

I am very interested in using your module in Python 3. In fact, I already got it working with very minimal changes! I am hoping I could convince you to make those changes, and promote them to PyPi.

Line 1 and 2:
from urllib import request
from urllib import parse

Line 63:
data = parse.urlencode(params)

Line 66:
req = request.Request(self.__url_base + '?' + data, None, headers)

Line 68:
req = request.Request(self.__url_base, None, headers)

Line 70:
page = request.urlopen(req).read()

If you don't have the time to make these changes would you be willing to let me make a pull request and attempt to get the changes published to PyPi?

Thank you so much for your time!

Edit: I have made a pull request here - #2

@Legomaniac

Upload most recent changes to PyPi?

Hello concongo,

Thanks for your responsiveness with my pull requests!

I am hoping to use this module with a project that requires it to be available to pip at the time my code is loaded into the platform.

I see you merged my pull request to get rid of the limit on Python < 3.5, but I don't believe those changes have been uploaded to PyPi so pip is able to install without issue.

Do you have any availability to package the latest changes and upload them to pip to remove the limitation?

Thanks again for your support!

Legomaniac

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.