Skip to content
This repository has been archived by the owner on Oct 5, 2024. It is now read-only.

Commit

Permalink
Fix bug #18
Browse files Browse the repository at this point in the history
  • Loading branch information
doudz committed Jul 30, 2018
1 parent b8c93db commit b6e6074
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion zigate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .const import *
from pydispatch import dispatcher

__version__ = '0.18.4'
__version__ = '0.18.5'

__all__ = ['ZiGate', 'ZiGateWiFi',
'dispatcher']
14 changes: 7 additions & 7 deletions zigate/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def action_move_level_onoff(self, addr, endpoint, onoff=OFF, level=0, transition
level between 0 - 100
'''
addr = self.__addr(addr)
level = int(level*254/100)
level = int(level*254//100)
data = struct.pack('!BHBBBBH', 2, addr, 1, endpoint, onoff, level, transition_time)
self.send_data(0x0081, data)

Expand Down Expand Up @@ -1112,7 +1112,7 @@ def actions_move_hue(self, addr, endpoint, hue, direction=0, transition=0):
transition in second
'''
addr = self.__addr(addr)
hue = hue*254//360
hue = int(hue*254//360)
data = struct.pack('!BHBBBBH', 2, addr, 1, endpoint,
hue, direction, transition)
self.send_data(0x00B0, data)
Expand All @@ -1126,8 +1126,8 @@ def actions_move_hue_saturation(self, addr, endpoint, hue, saturation=100, trans
transition in second
'''
addr = self.__addr(addr)
hue = hue*254//360
saturation = saturation*254//100
hue = int(hue*254//360)
saturation = int(saturation*254//100)
data = struct.pack('!BHBBBBH', 2, addr, 1, endpoint,
hue, saturation, transition)
self.send_data(0x00B6, data)
Expand All @@ -1150,8 +1150,8 @@ def actions_move_hue_rgb(self, addr, endpoint, rgb, transition=0):
hue, saturation, level = colorsys.rgb_to_hsv(*rgb)
hue = int(hue*360)
saturation = int(saturation*100)
level = int(level*254)
self.action_move_level_onoff(addr, endpoint, ON, level, transition)
level = int(level*100)
self.action_move_level_onoff(addr, endpoint, ON, level, 0)
self.actions_move_hue_saturation(addr, endpoint, hue, saturation, transition)

@register_actions(ACTIONS_COLOR)
Expand Down Expand Up @@ -1197,7 +1197,7 @@ def actions_move_temperature(self, addr, endpoint, temperature, transition=0):
temperature unit is kelvin
transition in second
'''
temperature = 1000000//temperature
temperature = int(1000000//temperature)
addr = self.__addr(addr)
data = struct.pack('!BHBBHH', 2, addr, 1, endpoint,
temperature, transition)
Expand Down

0 comments on commit b6e6074

Please sign in to comment.