enocean
Advanced tools
| Metadata-Version: 1.0 | ||
| Name: enocean | ||
| Version: 0.50.0 | ||
| Version: 0.50.1 | ||
| Summary: EnOcean serial protocol implementation | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/kipe/enocean |
| # -*- encoding: utf-8 -*- | ||
| from __future__ import print_function, unicode_literals, division, absolute_import | ||
| import logging | ||
| import datetime | ||
@@ -10,3 +11,3 @@ import threading | ||
| import Queue as queue | ||
| from enocean.protocol.packet import Packet | ||
| from enocean.protocol.packet import Packet, UTETeachInPacket | ||
| from enocean.protocol.constants import PACKET, PARSE_RESULT, RETURN_CODE | ||
@@ -64,3 +65,3 @@ | ||
| while True: | ||
| status, self._buffer, packet = Packet.parse_msg(self._buffer, communicator=self) | ||
| status, self._buffer, packet = Packet.parse_msg(self._buffer) | ||
| # If message is incomplete -> break the loop | ||
@@ -72,2 +73,9 @@ if status == PARSE_RESULT.INCOMPLETE: | ||
| if status == PARSE_RESULT.OK and packet: | ||
| packet.received = datetime.datetime.now() | ||
| if isinstance(packet, UTETeachInPacket) and self.teach_in: | ||
| response_packet = packet.create_response_packet(self.base_id) | ||
| self.logger.info('Sending response to UTE teach-in.') | ||
| self.send(response_packet) | ||
| if self.__callback is None: | ||
@@ -74,0 +82,0 @@ self.receive.put(packet) |
@@ -9,3 +9,7 @@ # -*- encoding: utf-8 -*- | ||
| RESERVED = 0x00 | ||
| # RADIO == RADIO_ERP1 | ||
| # Kept for backwards compatibility reasons, for example custom packet | ||
| # generation shouldn't be affected... | ||
| RADIO = 0x01 | ||
| RADIO_ERP1 = 0x01 | ||
| RESPONSE = 0x02 | ||
@@ -18,3 +22,8 @@ RADIO_SUB_TEL = 0x03 | ||
| RADIO_MESSAGE = 0x09 | ||
| # RADIO_ADVANCED == RADIO_ERP2 | ||
| # Kept for backwards compatibility reasons | ||
| RADIO_ADVANCED = 0x0A | ||
| RADIO_ERP2 = 0x0A | ||
| RADIO_802_15_4 = 0x10 | ||
| COMMAND_2_4 = 0x11 | ||
@@ -21,0 +30,0 @@ |
+104
-1
| <?xml version="1.0" encoding="utf-8"?> | ||
| <telegrams version="2.6.4" major_version="2" minor_version="6" revision="4"> | ||
| <telegram rorg="0xF6" type="RPS" description="RPS Telegram"> | ||
| <profiles func="0x01" description="Switch Buttons"> | ||
| <profile type="0x01" description="Push Button"> | ||
| <data> | ||
| <enum description="Status of the push button" shortcut="PB" offset="3" size="1"> | ||
| <item description="Released" value="0" /> | ||
| <item description="Pressed" value="1" /> | ||
| </data> | ||
| </profile> | ||
| </profiles> | ||
| <profiles func="0x02" description="Rocker Switch, 2 Rocker"> | ||
@@ -612,2 +621,96 @@ <profile type="0x02" description="Light and Blind Control - Application Style 2"> | ||
| </profile> | ||
| <profile description="Temperature Sensor, Set Point and Occupancy Control" type="0x05"> | ||
| <data> | ||
| <value shortcut="SP" description="Set Point (linear)" offset="8" size="8" unit="%"> | ||
| <range> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </scale> | ||
| </value> | ||
| <value shortcut="TMP" description="Temperature (linear)" offset="16" size="8" unit="°C"> | ||
| <range> | ||
| <min>255</min> | ||
| <max>0</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>40</max> | ||
| </scale> | ||
| </value> | ||
| <enum shortcut="OCC" description="Occupancy Button" offset="31" size="1"> | ||
| <item description="Button pressed" value="0" /> | ||
| <item description="Button released" value="1" /> | ||
| </enum> | ||
| </data> | ||
| </profile> | ||
| <profile description="Temperature Sensor, Set Point and Day/Night Control" type="0x06"> | ||
| <data> | ||
| <value shortcut="SP" description="Set Point (linear)" offset="8" size="8" unit="%"> | ||
| <range> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </scale> | ||
| </value> | ||
| <value shortcut="TMP" description="Temperature (linear)" offset="16" size="8" unit="°C"> | ||
| <range> | ||
| <min>255</min> | ||
| <max>0</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>40</max> | ||
| </scale> | ||
| </value> | ||
| <enum shortcut="SLSW" description="Slide switch" offset="31" size="1"> | ||
| <item description="Position I / Night / Off" value="0" /> | ||
| <item description="Position O / Day / On" value="1" /> | ||
| </enum> | ||
| </data> | ||
| </profile> | ||
| <profile description="Temperature and Humidity Sensor, Set Point and Occupancy Control" type="0x10"> | ||
| <data> | ||
| <value shortcut="SP" description="Set Point (linear)" offset="0" size="8" unit=""> | ||
| <range> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>255</max> | ||
| </scale> | ||
| </value> | ||
| <value shortcut="HUM" description="Rel. Humidity (linear)" offset="8" size="8" unit="%"> | ||
| <range> | ||
| <min>0</min> | ||
| <max>250</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>100</max> | ||
| </scale> | ||
| </value> | ||
| <value shortcut="TMP" description="Temperature (linear)" offset="16" size="8" unit="°C"> | ||
| <range> | ||
| <min>0</min> | ||
| <max>250</max> | ||
| </range> | ||
| <scale> | ||
| <min>0</min> | ||
| <max>40</max> | ||
| </scale> | ||
| </value> | ||
| <enum shortcut="OCC" description="Occupancy Button" offset="31" size="1"> | ||
| <item description="Button pressed" value="0" /> | ||
| <item description="Button released" value="1" /> | ||
| </enum> | ||
| </data> | ||
| </profile> | ||
| <profile description="Temperature and Humidity Sensor and Set Point" type="0x12"> | ||
@@ -686,3 +789,3 @@ <data> | ||
| </enum> | ||
| <enum shortcut="CTM" description="Controller mode" offset="25" size="1"> | ||
| <enum shortcut="CTM" description="Controller mode" offset="25" size="2"> | ||
| <item description="Heating" value="1" /> | ||
@@ -689,0 +792,0 @@ <item description="Cooling" value="2" /> |
@@ -29,2 +29,4 @@ # -*- encoding: utf-8 -*- | ||
| self.received = None | ||
| if not isinstance(data, list) or data is None: | ||
@@ -96,3 +98,3 @@ self.logger.warning('Replacing Packet.data with default value.') | ||
| @staticmethod | ||
| def parse_msg(buf, communicator=None): | ||
| def parse_msg(buf): | ||
| ''' | ||
@@ -146,10 +148,6 @@ Parses message from buffer. | ||
| # If we got this far, everything went ok (?) | ||
| if packet_type == PACKET.RADIO: | ||
| if packet_type == PACKET.RADIO_ERP1: | ||
| # Need to handle UTE Teach-in here, as it's a separate packet type... | ||
| if data[0] == RORG.UTE: | ||
| packet = UTETeachIn(packet_type, data, opt_data, communicator=communicator) | ||
| # Send a response automatically, works only if | ||
| # - communicator is set | ||
| # - communicator.teach_in == True | ||
| packet.send_response() | ||
| packet = UTETeachInPacket(packet_type, data, opt_data) | ||
| else: | ||
@@ -177,3 +175,3 @@ packet = RadioPacket(packet_type, data, opt_data) | ||
| Currently only supports: | ||
| - PACKET.RADIO | ||
| - PACKET.RADIO_ERP1 | ||
| - RORGs RPS, BS1, BS4, VLD. | ||
@@ -187,4 +185,4 @@ | ||
| if packet_type != PACKET.RADIO: | ||
| # At least for now, only support PACKET.RADIO. | ||
| if packet_type != PACKET.RADIO_ERP1: | ||
| # At least for now, only support PACKET.RADIO_ERP1. | ||
| raise ValueError('Packet type not supported by this function.') | ||
@@ -310,3 +308,3 @@ | ||
| destination=None, sender=None, learn=False, **kwargs): | ||
| return Packet.create(PACKET.RADIO, rorg, rorg_func, rorg_type, direction, command, destination, sender, learn, **kwargs) | ||
| return Packet.create(PACKET.RADIO_ERP1, rorg, rorg_func, rorg_type, direction, command, destination, sender, learn, **kwargs) | ||
@@ -355,3 +353,3 @@ @property | ||
| class UTETeachIn(RadioPacket): | ||
| class UTETeachInPacket(RadioPacket): | ||
| # Request types | ||
@@ -377,6 +375,2 @@ TEACH_IN = 0b00 | ||
| def __init__(self, packet_type, data=None, optional=None, communicator=None): | ||
| self.__communicator = communicator | ||
| super(UTETeachIn, self).__init__(packet_type=packet_type, data=data, optional=optional) | ||
| @property | ||
@@ -395,3 +389,3 @@ def bidirectional(self): | ||
| def parse(self): | ||
| super(UTETeachIn, self).parse() | ||
| super(UTETeachInPacket, self).parse() | ||
| self.unidirectional = not self._bit_data[DB6.BIT_7] | ||
@@ -409,3 +403,3 @@ self.response_expected = not self._bit_data[DB6.BIT_6] | ||
| def _create_response_packet(self, sender_id, response=TEACHIN_ACCEPTED): | ||
| def create_response_packet(self, sender_id, response=TEACHIN_ACCEPTED): | ||
| # Create data: | ||
@@ -424,16 +418,5 @@ # - Respond with same RORG (UTE Teach-in) | ||
| return RadioPacket(PACKET.RADIO, data=data, optional=optional) | ||
| return RadioPacket(PACKET.RADIO_ERP1, data=data, optional=optional) | ||
| def send_response(self, response=TEACHIN_ACCEPTED): | ||
| if self.__communicator is None: | ||
| self.logger.error('Communicator not set, cannot send UTE teach-in response.') | ||
| return | ||
| if not self.__communicator.teach_in: | ||
| self.logger.info('Communicator not set to teach-in mode, not sending UTE teach-in response.') | ||
| return | ||
| self.logger.info('Sending response to UTE teach-in.') | ||
| self.__communicator.send( | ||
| self._create_response_packet(self.__communicator.base_id)) | ||
| class ResponsePacket(Packet): | ||
@@ -440,0 +423,0 @@ response = 0 |
@@ -39,3 +39,3 @@ #!/usr/bin/env python | ||
| packet = communicator.receive.get(block=True, timeout=1) | ||
| if packet.packet_type == PACKET.RADIO and packet.rorg == RORG.VLD: | ||
| if packet.packet_type == PACKET.RADIO_ERP1 and packet.rorg == RORG.VLD: | ||
| packet.select_eep(0x05, 0x00) | ||
@@ -45,7 +45,7 @@ packet.parse_eep() | ||
| print('%s: %s' % (k, packet.parsed[k])) | ||
| if packet.packet_type == PACKET.RADIO and packet.rorg == RORG.BS4: | ||
| if packet.packet_type == PACKET.RADIO_ERP1 and packet.rorg == RORG.BS4: | ||
| # parse packet with given FUNC and TYPE | ||
| for k in packet.parse_eep(0x02, 0x05): | ||
| print('%s: %s' % (k, packet.parsed[k])) | ||
| if packet.packet_type == PACKET.RADIO and packet.rorg == RORG.BS1: | ||
| if packet.packet_type == PACKET.RADIO_ERP1 and packet.rorg == RORG.BS1: | ||
| # alternatively you can select FUNC and TYPE explicitely | ||
@@ -57,3 +57,3 @@ packet.select_eep(0x00, 0x01) | ||
| print('%s: %s' % (k, packet.parsed[k])) | ||
| if packet.packet_type == PACKET.RADIO and packet.rorg == RORG.RPS: | ||
| if packet.packet_type == PACKET.RADIO_ERP1 and packet.rorg == RORG.RPS: | ||
| for k in packet.parse_eep(0x02, 0x02): | ||
@@ -60,0 +60,0 @@ print('%s: %s' % (k, packet.parsed[k])) |
+1
-1
| Metadata-Version: 1.0 | ||
| Name: enocean | ||
| Version: 0.50.0 | ||
| Version: 0.50.1 | ||
| Summary: EnOcean serial protocol implementation | ||
@@ -5,0 +5,0 @@ Home-page: https://github.com/kipe/enocean |
+1
-1
@@ -9,3 +9,3 @@ #!/usr/bin/env python | ||
| name='enocean', | ||
| version='0.50.0', | ||
| version='0.50.1', | ||
| description='EnOcean serial protocol implementation', | ||
@@ -12,0 +12,0 @@ author='Kimmo Huoman', |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
98961
3.59%1065
-0.09%