Git Product home page Git Product logo

python-lightify's People

Contributors

andreasofthings avatar bachp avatar deisi avatar fastjames avatar mikma avatar oleksandrberchenko avatar olimpiurob avatar tchellomello avatar tfriedel avatar

Stargazers

 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  avatar  avatar  avatar

python-lightify's Issues

add support for external LogHandler

This is a minor feature request to support an external LogHandler in order to output logging info for debugging/etc.. I am using this library with a home-grown plugin for Indigo Domotics ( https://github.com/rbdubz3/sylvania-lightify-indigo ).

See sample code snippets below - updated constructor plus new method to allow changing the log level:

class Lightify:
""" main osram lightify class
"""
def init(self, host, new_device_types=None, loghandler=None):
.......
.......
.......
'max_temp': 6500
}
}
}}
"""
self.__device_types = DEVICE_TYPES.copy()
self.__device_types.update(new_device_types or {})

    self.__logger = logging.getLogger(MODULE)
    self.__logger.setLevel(logging.INFO)
    if loghandler is not None:
        self.__logger.addHandler(loghandler)
    else:
        self.__logger.addHandler(logging.NullHandler())
    self.__logger.info("Initializing python %s, version=%s", MODULE, __version__)

    # a sequence number used to number commands sent to the gateway
    self.__seq = 0

.......
.......
.......

def set_loglevel(self, debugLevel):
    self.__logger.setLevel(debugLevel)
    level_str = 'NOTSET'
    if debugLevel == logging.DEBUG:
        level_str = 'DEBUG'
    elif debugLevel == logging.INFO:
        level_str = 'INFO'
    elif debugLevel == logging.WARNING:
        level_str = 'WARNING'
    elif debugLevel == logging.ERROR:
        level_str = 'ERROR'
    elif debugLevel == logging.CRITICAL:
        level_str = 'CRITICAL'
    self.__logger.info("set_loglevel to '%s'", level_str)

Unknown device type id: 0

I'm getting the following error with Home-Assistant 0.102.3 & 0.103.0 and my Osram Lightify Gateway (current FW).

2019-12-12 01:29:53 INFO (SyncWorker_5) [homeassistant.loader] Loaded osramlightify from homeassistant.components.osramlightify
2019-12-12 01:29:54 INFO (MainThread) [homeassistant.components.light] Setting up light.osramlightify
2019-12-12 01:29:54 WARNING (SyncWorker_16) [lightify] Unknown device type id: 0. Please report to https://github.com/tfriedel/python-lightify
2019-12-12 01:29:54 INFO (SyncWorker_16) [lightify] Initializing lightify, version=1.0.7.2

Removed from PyPi?

Is this just a PyPi error or something on my end?

https://pypi.org/project/lightify/

returns a 404 and pip install lightify

(homeassistant3.8) homeassistant@ubuntu:~/.homeassistant/custom_components$ pip install lightify==1.0.72
ERROR: Could not find a version that satisfies the requirement lightify==1.0.72 (from versions: none)
ERROR: No matching distribution found for lightify==1.0.72
WARNING: You are using pip version 20.2.1; however, version 21.0.1 is available.
You should consider upgrading via the '/srv/homeassistant3.8/bin/python3.8 -m pip install --upgrade pip' command.

Unknown devices types 105, 115, 77

A large number of errors/warnings in my Indigo Domotics setup which uses python lightify version 1.0.7.1.. Below is the dump of indigo plugin log along with Warnings from the lightify plugin (reference messages 'LightifyDirect Warning'

Error Block 1


Sylvania Lightify Starting concurrent thread
LightifyDirect Warning Couldn't unpack light status packet:
LightifyDirect Warning struct.error: unpack requires a string argument of length 50
LightifyDirect Warning payload: 060000000000000000
Sylvania Lightify Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 297, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.2/Plugins/SylvaniaLightify.indigoPlugin/Contents/Server Plugin/lightify/init.py", line 1309, in update_group_list
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa4 in position 2: invalid start byte

Sylvania Lightify Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Sylvania Lightify Starting concurrent thread
LightifyDirect Warning Unknown device type id: 105. Please report to https://github.com/tfriedel/python-lightify
LightifyDirect Warning Unknown device type id: 115. Please report to https://github.com/tfriedel/python-lightify
LightifyDirect Warning Unknown device type id: 77. Please report to https://github.com/tfriedel/python-lightify
LightifyDirect Warning Couldn't unpack light status packet:
LightifyDirect Warning struct.error: unpack requires a string argument of length 50
LightifyDirect Warning payload: 61204c6967687473000000000a004d656469612054560000000000000000
Sylvania Lightify Error Error in plugin execution runConcurrentThread:

Traceback (most recent call last):
File "plugin.py", line 297, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.2/Plugins/SylvaniaLightify.indigoPlugin/Contents/Server Plugin/lightify/init.py", line 1309, in update_group_list
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa4 in position 2: invalid start byte

Sylvania Lightify Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
****** End Error Block 1

NOTE - no new devices were actually added to my system so I suspect this is something different. There were a large number of recurring errors prior to the above Warnings about missing device types.. The errors were as seen below - potentially some type of memory corruption in my system with python? From what I can tell, the python utf8 errors in 'Error Block 2' persisted throughout the night repeatedly while the ones listed above for the missing device types in 'Error Block 1' occurred just once this morning - triggered via motion sensor as I entered a room.

Error Block 2


Traceback (most recent call last):
File "plugin.py", line 297, in runConcurrentThread
File "/Library/Application Support/Perceptive Automation/Indigo 7.2/Plugins/SylvaniaLightify.indigoPlugin/Contents/Server Plugin/lightify/init.py", line 1309, in update_group_list
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_8.py", line 16, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0xa4 in position 2: invalid start byte

Sylvania Lightify Error plugin runConcurrentThread function returned or failed (will attempt again in 10 seconds)
Sylvania Lightify Starting concurrent thread
Sylvania Lightify Error Error in plugin execution runConcurrentThread:
***** End Error Block 2

Anyhow, thought I'd pass along in case it is of any value

Add light.alpha() method

I can use the various accessor methods for all properties, except alpha. For alpha I need to to use raw_values tuple, would be nice to add aplha() to the Light class to avoid need to handle raw_values(), e.g. to avoid something like this:

			# Alpha is only available from raw_values()
			(onoff, lum, temp, red, green, blue, alpha) = light.raw_values()

			# if online is false then override on to be false, the light can't be on if it's not even powered on 
			state = {
				"online": light.reachable(),
				"lastSeen": light.last_seen(),
				"on": (light.reachable() and light.on()),
				"lum": light.lum(),
				"temp": light.temp(),
				"colour": {
					"red": light.red(),
					"green": light.green(),
					"blue": light.blue()
				},
				"alpha": alpha
			}

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.