Overview
| Comment: | Preliminary support for lyh light bulbs |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
69fdf8915c69fa901392d88b41ecc89b |
| User & Date: | rkeene on 2020-05-07 19:21:51.005 |
| Other Links: | manifest | tags |
Context
|
2020-05-07
| ||
| 19:23 | limitlessled_rf v0.11 check-in: 0684b03720 user: rkeene tags: 0.11, trunk | |
| 19:21 | Preliminary support for lyh light bulbs check-in: 69fdf8915c user: rkeene tags: trunk | |
|
2020-05-02
| ||
| 15:11 | limitlessled_rf v0.10 check-in: abd184fa63 user: rkeene tags: 0.10, trunk | |
Changes
Modified limitlessled_rf/__init__.py
from [a379ee4165]
to [6b581856ff].
1 2 3 4 5 6 7 |
#! /usr/bin/env python3
import random
import time
class Remote:
_remote_type_alias_map = {
| | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#! /usr/bin/env python3
import random
import time
class Remote:
_remote_type_alias_map = {
'fut089': 'rgbcct'
}
_remote_type_parameters_map = {
'rgbw': {
'retries': 10,
'delay': 0.1,
'channels': [9, 40, 71],
'syncword': [0x258B, 0x147A],
'zones': [1, 2, 3, 4],
'features': [
'can_set_brightness',
'has_brightness',
'has_white',
'has_color'
],
'brightness_range': [0, 25],
|
| ︙ | ︙ | |||
53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
'retries': 10,
'delay': 0.1,
'channels': [4, 39, 74],
'syncword': [0x55AA, 0x050A],
'brightness_range': [0, 9],
'temperature_output_range': [0, 9],
'temperature_input_range': [6500, 3000],
'features': [
'has_max_brightness',
'has_brightness',
'has_temperature',
'is_white'
],
'button_map': {
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
'retries': 10,
'delay': 0.1,
'channels': [4, 39, 74],
'syncword': [0x55AA, 0x050A],
'brightness_range': [0, 9],
'temperature_output_range': [0, 9],
'temperature_input_range': [6500, 3000],
'zones': [1, 2, 3, 4],
'features': [
'has_max_brightness',
'has_brightness',
'has_temperature',
'is_white'
],
'button_map': {
'on': 0x05,
'off': 0x09,
'max': 0x15,
'night': 0x19,
'zone_on:1': 0x08,
'zone_on:2': 0x0D,
'zone_on:3': 0x07,
'zone_on:4': 0x02,
'zone_max:1': 0x18,
'zone_max:2': 0x1D,
'zone_max:3': 0x17,
'zone_max:4': 0x12,
'zone_off:1': 0x0B,
'zone_off:2': 0x03,
'zone_off:3': 0x0A,
'zone_off:4': 0x06,
'zone_night:1': 0x1B,
'zone_night:2': 0x13,
'zone_night:3': 0x1A,
'zone_night:4': 0x16,
'brightness_up': 0x0C,
'brightness_down': 0x04,
'temperature_up': 0x0E,
'temperature_down': 0x0F
}
},
'lyh_cct': {
'retries': 10,
'delay': 0.1,
'channels': [24],
'syncword': [0x6F67, 0xA118],
'message_length': 14,
'format_config': {
'crc_enabled': 0,
'packet_length_encoded': 0,
'auto_term_tx': 0
},
'brightness_range': [0, 9],
'temperature_output_range': [0, 9],
'temperature_input_range': [6500, 3000],
'zones': [1, 2, 3],
'features': [
'has_max_brightness',
'has_brightness',
'has_temperature',
'is_white'
],
'button_map': {
|
| ︙ | ︙ | |||
88 89 90 91 92 93 94 |
'brightness_down': 0x04,
'temperature_up': 0x0E,
'temperature_down': 0x0F
}
}
}
_remote_type_parameters_map_unimplemented = {
| | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
'brightness_down': 0x04,
'temperature_up': 0x0E,
'temperature_down': 0x0F
}
}
}
_remote_type_parameters_map_unimplemented = {
'rgbcct': {
'channels': [8, 39, 70],
'syncword': [0x1809, 0x7236]
},
'rgb': {
'channels': [3, 38, 73],
'syncword': [0xBCCD, 0x9AAB]
},
|
| ︙ | ︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# If the button name has a zone, split it out into its own parameter
if button_info['button'].find(':') != -1:
button_name_zone = button_info['button'].split(':')
button_info['button'] = button_name_zone[0]
button_info['zone'] = int(button_name_zone[1])
return button_info
def _compute_button_message_cct(self, button_info):
remote_id = button_info['remote_id']
message_id = button_info['message_id']
# Header consists of magic (0x5A), follow by 16-bit remote ID
header = [0x5A, (remote_id >> 8) & 0xff, remote_id & 0xff]
| > > > > > > > > > > > > > > > > | 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# If the button name has a zone, split it out into its own parameter
if button_info['button'].find(':') != -1:
button_name_zone = button_info['button'].split(':')
button_info['button'] = button_name_zone[0]
button_info['zone'] = int(button_name_zone[1])
return button_info
def _compute_button_message_lyh_cct(self, button_info):
# XXX
return None
def _parse_button_message_lyh_cct(self, button_message):
return {'raw': button_message}
return None
def _pair_lyh_cct(self, zone):
# XXX
return None
def _unpair_lyh_cct(self, zone):
# XXX
return None
def _compute_button_message_cct(self, button_info):
remote_id = button_info['remote_id']
message_id = button_info['message_id']
# Header consists of magic (0x5A), follow by 16-bit remote ID
header = [0x5A, (remote_id >> 8) & 0xff, remote_id & 0xff]
|
| ︙ | ︙ | |||
535 536 537 538 539 540 541 | return color def raw_send_button(self, button_info): return self._send_button(button_info) def raw_read_button(self): channel = self._config['channels'][0] | | > > > > > | | 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 |
return color
def raw_send_button(self, button_info):
return self._send_button(button_info)
def raw_read_button(self):
channel = self._config['channels'][0]
self._radio.set_syncword(self._config['syncword'], submit_queue = None)
self._radio.start_listening(channel)
# Some protocols are not length encoded, specify the length instead
length = self._config.get('message_length', None)
format_config = self._config.get('format_config', None)
data = self._radio.receive(channel = channel, wait = True, wait_time = 0.1, length = length, format_config = format_config)
message = self._parse_button_message(data)
return message
def set_brightness(self, brightness, zone = None):
if 'has_brightness' not in self._config['features']:
return False
|
| ︙ | ︙ | |||
683 684 685 686 687 688 689 | 'button': 'zone_white', 'zone': zone } return self._send_button(message) # Methods to query remote identity and state def get_zone_ids(self): | < < | < < < < < < < | | 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 |
'button': 'zone_white',
'zone': zone
}
return self._send_button(message)
# Methods to query remote identity and state
def get_zone_ids(self):
return self._config('zones', [1, 2, 3, 4])
def get_type(self):
return self._type
def get_id(self):
return self._id
def get_message_id(self):
return self._message_id
def get_brightness_range(self):
# Brightness is always a fixed range
return [0, 255]
def get_temperature_range(self):
# If the remote has no control over the temperature this
# query gets a null response
return self._config.get('temperature_input_range', None)
|