Add neopixelbus tests

This commit is contained in:
Otto Winter 2019-01-06 16:59:11 +01:00
parent 92439abeb4
commit 52dbd35118
No known key found for this signature in database
GPG key ID: DB66C0BE6013F97E
4 changed files with 36 additions and 19 deletions

View file

@ -49,7 +49,7 @@ def lib_deps(config):
CONF_HOMEASSISTANT_SERVICE = 'homeassistant.service' CONF_HOMEASSISTANT_SERVICE = 'homeassistant.service'
LOGGER_LOG_ACTION_SCHEMA = vol.Schema({ HOMEASSISTANT_SERVIC_ACTION_SCHEMA = vol.Schema({
cv.GenerateID(): cv.use_variable_id(APIServer), cv.GenerateID(): cv.use_variable_id(APIServer),
vol.Required(CONF_SERVICE): cv.string, vol.Required(CONF_SERVICE): cv.string,
vol.Optional(CONF_DATA): vol.Schema({ vol.Optional(CONF_DATA): vol.Schema({
@ -64,7 +64,7 @@ LOGGER_LOG_ACTION_SCHEMA = vol.Schema({
}) })
@ACTION_REGISTRY.register(CONF_HOMEASSISTANT_SERVICE, LOGGER_LOG_ACTION_SCHEMA) @ACTION_REGISTRY.register(CONF_HOMEASSISTANT_SERVICE, HOMEASSISTANT_SERVIC_ACTION_SCHEMA)
def homeassistant_service_to_code(config, action_id, arg_type, template_arg): def homeassistant_service_to_code(config, action_id, arg_type, template_arg):
for var in get_variable(config[CONF_ID]): for var in get_variable(config[CONF_ID]):
yield None yield None

View file

@ -54,9 +54,9 @@ def validate_method(value):
raise NotImplementedError raise NotImplementedError
if CORE.is_esp32: if CORE.is_esp32:
return cv.one_of(*ESP32_METHODS, upper=True, space='_') return cv.one_of(*ESP32_METHODS, upper=True, space='_')(value)
if CORE.is_esp8266: if CORE.is_esp8266:
return cv.one_of(*ESP8266_METHODS, upper=True, space='_') return cv.one_of(*ESP8266_METHODS, upper=True, space='_')(value)
raise NotImplementedError raise NotImplementedError

View file

@ -305,8 +305,8 @@ def gather_build_flags():
def get_ini_content(): def get_ini_content():
lib_deps = gather_lib_deps() + ['${common.lib_deps}'] lib_deps = gather_lib_deps()
build_flags = gather_build_flags() + ['${common.build_flags}'] build_flags = gather_build_flags()
if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES: if CORE.is_esp8266 and CORE.board in ESP8266_FLASH_SIZES:
flash_size = ESP8266_FLASH_SIZES[CORE.board] flash_size = ESP8266_FLASH_SIZES[CORE.board]
@ -326,11 +326,23 @@ def get_ini_content():
'platform': CORE.config[CONF_ESPHOMEYAML][CONF_ARDUINO_VERSION], 'platform': CORE.config[CONF_ESPHOMEYAML][CONF_ARDUINO_VERSION],
'board': CORE.board, 'board': CORE.board,
'framework': 'arduino', 'framework': 'arduino',
'lib_deps': lib_deps, 'lib_deps': lib_deps + ['${common.lib_deps}'],
'build_flags': build_flags, 'build_flags': build_flags + ['${common.build_flags}'],
'upload_speed': UPLOAD_SPEED_OVERRIDE.get(CORE.board, 115200), 'upload_speed': UPLOAD_SPEED_OVERRIDE.get(CORE.board, 115200),
} }
if 'esp32_ble_beacon' in CORE.config or 'esp32_ble_tracker' in CORE.config:
data['board_build.partitions'] = "partitions.csv"
partitions_csv = CORE.relative_build_path('partitions.csv')
if not os.path.isfile(partitions_csv):
with open(partitions_csv, "w") as f:
f.write("nvs, data, nvs, 0x009000, 0x005000,\n")
f.write("otadata, data, ota, 0x00e000, 0x002000,\n")
f.write("app0, app, ota_0, 0x010000, 0x190000,\n")
f.write("app1, app, ota_1, 0x200000, 0x190000,\n")
f.write("eeprom, data, 0x99, 0x390000, 0x001000,\n")
f.write("spiffs, data, spiffs, 0x391000, 0x00F000\n")
if CONF_BOARD_FLASH_MODE in CORE.config[CONF_ESPHOMEYAML]: if CONF_BOARD_FLASH_MODE in CORE.config[CONF_ESPHOMEYAML]:
flash_mode = CORE.config[CONF_ESPHOMEYAML][CONF_BOARD_FLASH_MODE] flash_mode = CORE.config[CONF_ESPHOMEYAML][CONF_BOARD_FLASH_MODE]
data['board_build.flash_mode'] = flash_mode data['board_build.flash_mode'] = flash_mode
@ -391,17 +403,6 @@ def write_platformio_project():
platformio_ini = CORE.relative_build_path('platformio.ini') platformio_ini = CORE.relative_build_path('platformio.ini')
content = get_ini_content() content = get_ini_content()
if 'esp32_ble_beacon' in CORE.config or 'esp32_ble_tracker' in CORE.config:
content += 'board_build.partitions = partitions.csv\n'
partitions_csv = CORE.relative_build_path('partitions.csv')
if not os.path.isfile(partitions_csv):
with open(partitions_csv, "w") as f:
f.write("nvs, data, nvs, 0x009000, 0x005000,\n")
f.write("otadata, data, ota, 0x00e000, 0x002000,\n")
f.write("app0, app, ota_0, 0x010000, 0x190000,\n")
f.write("app1, app, ota_1, 0x200000, 0x190000,\n")
f.write("eeprom, data, 0x99, 0x390000, 0x001000,\n")
f.write("spiffs, data, spiffs, 0x391000, 0x00F000\n")
write_gitignore() write_gitignore()
write_platformio_ini(content, platformio_ini) write_platformio_ini(content, platformio_ini)

View file

@ -771,6 +771,22 @@ light:
num_leds: 60 num_leds: 60
rgb_order: BRG rgb_order: BRG
name: "FastLED SPI Light" name: "FastLED SPI Light"
- platform: neopixelbus
name: "Neopixelbus Light"
gamma_correct: 2.8
color_correct: [0.0, 0.0, 0.0, 0.0]
default_transition_length: 10s
power_supply: atx_power_supply
effects:
- addressable_flicker:
name: Flicker Effect With Custom Values
update_interval: 16ms
intensity: 5%
type: GRBW
variant: SK6812
method: ESP32_I2S_0
num_leds: 60
pin: GPIO23
remote_transmitter: remote_transmitter:
- pin: 32 - pin: 32