Skip to content

Commit

Permalink
Merge branch 'master' into e131
Browse files Browse the repository at this point in the history
  • Loading branch information
kylegordon committed Nov 29, 2022
2 parents 1be164a + 2b51fa3 commit 5ab4521
Show file tree
Hide file tree
Showing 88 changed files with 3,984 additions and 2,052 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/esphome-parallel.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
---
name: ESPHome

# yamllint disable-line rule:truthy
on:
pull_request:
push:
branches: [main]
schedule:
- cron: 0 12 * * *

jobs:
files: # Job that lists files
Expand Down
118 changes: 0 additions & 118 deletions .github/workflows/esphome.yaml.disabled

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
with:
config_file: .github/yamllint-config.yml
remarklint:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:
- name: Getting your configuration from GitHub
uses: actions/checkout@v1
Expand Down
10 changes: 6 additions & 4 deletions automation/craftroom_touch_toggle.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
alias: Craft Room light toggle
trigger:
- platform: state
entity_id: binary_sensor.craft_room_switch_touch_pad
to: 'on'

- platform: event
event_type: esphome.button_pressed
event_data:
device_name: craftroom_switch
click_type: single
action:
- service: switch.turn_on
entity_id: switch.craft_room_switch_relay
Expand Down
20 changes: 11 additions & 9 deletions configuration.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Inspired by https://github.com/bruhautomation/BRUH2-Home-Assistant-Configuration

homeassistant:
Expand Down Expand Up @@ -194,12 +195,12 @@ emulated_hue:
# https://www.home-assistant.io/components/emulated_hue/
listen_port: 80
expose_by_default: false
exposed_domains:
- switch
- light
- group
- input_boolean
- media_player
# exposed_domains:
# - switch
# - light
# - group
# - input_boolean
# - media_player
entities:
group.lightswitch_relays:
hidden: false
Expand Down Expand Up @@ -233,8 +234,6 @@ emulated_hue:
hidden: false
light.sideboard:
hidden: false
light.uplighter:
hidden: false
light.sofa_overhead:
hidden: false
light.dining_table_overhead:
Expand All @@ -257,6 +256,10 @@ emulated_hue:
hidden: false
input_boolean.night_view:
hidden: false
script.alexa_turn_on_the_lights:
hidden: false
script.alexa_turn_off_the_lights:
hidden: false

############
# Includes #
Expand All @@ -275,7 +278,6 @@ camera: !include cameras.yaml
zone: !include zones/places.yaml
shell_command: !include shell_commands.yaml
climate: !include climate.yaml
# image_processing: !include openalpr.yaml

# Merged Includes
automation: !include_dir_list automation
Expand Down
10 changes: 7 additions & 3 deletions custom_components/adaptive_lighting/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
NONE_STR,
VALIDATION_TUPLES,
)
from .switch import _supported_features
from .switch import _supported_features, validate

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -61,12 +61,12 @@ def validate_options(user_input, errors):
This is an extra validation step because the validators
in `EXTRA_VALIDATION` cannot be serialized to json.
"""
for key, (validate, _) in EXTRA_VALIDATION.items():
for key, (_validate, _) in EXTRA_VALIDATION.items():
# these are unserializable validators
value = user_input.get(key)
try:
if value is not None and value != NONE_STR:
validate(value)
_validate(value)
except vol.Invalid:
_LOGGER.exception("Configuration option %s=%s is incorrect", key, value)
errors["base"] = "option_error"
Expand All @@ -82,6 +82,7 @@ def __init__(self, config_entry: config_entries.ConfigEntry):
async def async_step_init(self, user_input=None):
"""Handle options flow."""
conf = self.config_entry
data = validate(conf)
if conf.source == config_entries.SOURCE_IMPORT:
return self.async_show_form(step_id="init", data_schema=None)
errors = {}
Expand All @@ -95,6 +96,9 @@ async def async_step_init(self, user_input=None):
for light in self.hass.states.async_entity_ids("light")
if _supported_features(self.hass, light)
]
for configured_light in data[CONF_LIGHTS]:
if configured_light not in all_lights:
all_lights.append(configured_light)
to_replace = {CONF_LIGHTS: cv.multi_select(sorted(all_lights))}

options_schema = {}
Expand Down
18 changes: 9 additions & 9 deletions custom_components/adaptive_lighting/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
"config": {
"step": {
"user": {
"title": "Scegli un nome per l'istanza Illuminazione Adattiva",
"title": "Scegli un nome per l'istanza di Illuminazione Adattiva",
"description": "Scegli un nome per questa istanza. Puoi eseguire più istanze di Illuminazione adattiva, ognuna delle quali può contenere più luci!",
"data": {
"name": "Nome"
}
}
},
"abort": {
"already_configured": "Questo dispositivo è già configurato"
"already_configured": "Questo dispositivo è già stato configurato"
}
},
"options": {
Expand All @@ -21,26 +21,26 @@
"description": "Tutte le opzioni per il componente Illuminazione Adattiva. I nomi delle opzioni corrispondono con le impostazioni YAML. Non sono mostrate opzioni se hai la voce adaptive-lighting definita nella tua configurazione YAML.",
"data": {
"lights": "luci",
"initial_transition": "initial_transition: Quando le luci vanno da 'off' a 'on'. (secondi)",
"initial_transition": "initial_transition: Quando le luci vengono accese (off -> on). (secondi)",
"sleep_transition": "sleep_transition: Quando 'sleep_state' cambia. (secondi)",
"interval": "interval: Tempo tra i cambiamenti dello switch. (secondi)",
"max_brightness": "max_brightness: Illuminazione massima delle luci durante un ciclo. (%)",
"max_brightness": "max_brightness: Luminosità massima delle luci durante un ciclo. (%)",
"max_color_temp": "max_color_temp: Gradazione più fredda del ciclo di temperatura del colore. (Kelvin)",
"min_brightness": "min_brightness: Illuminazione minima delle luci durante un ciclo. (%)",
"min_color_temp": "min_color_temp, Gradazione più calda del ciclo di temperatura del colore. (Kelvin)",
"min_brightness": "min_brightness: Luminosità minima delle luci durante un ciclo. (%)",
"min_color_temp": "min_color_temp: Gradazione più calda del ciclo di temperatura del colore. (Kelvin)",
"only_once": "only_once: Adatta le luci solo quando vengono accese.",
"prefer_rgb_color": "prefer_rgb_color: Usa 'rgb_color' al posto di 'color_temp' quando possibile.",
"separate_turn_on_commands": "separate_turn_on_commands: Separa i comandi per ogni attributo (color, brightness, etc.) in 'light.turn_on' (richiesto per alcune luci).",
"sleep_brightness": "sleep_brightness, Impostazione della luminosità per la modalità notturna. (%)",
"sleep_brightness": "sleep_brightness: Impostazione della luminosità per la modalità notturna. (%)",
"sleep_color_temp": "sleep_color_temp: Impostazione della temperatura colore per la modalità notturna. (Kelvin)",
"sunrise_offset": "sunrise_offset: Imposta quanto anticipare(-) o ritardare(+) l'alba nel ciclo (+/- secondi)",
"sunrise_time": "sunrise_time: Imposta manualmente l'ora dell'alba, se 'None', usa l'ora effettiva dell'alba alla tua posizione (HH:MM:SS)",
"sunset_offset": "sunset_offset: Imposta quanto anticipare(-) o ritardare(+) il tramonto nel ciclo (+/- secondi)",
"sunset_time": "sunset_time: Imposta manualmente l'ora del tramonto, se 'None', usa l'ora effettiva del tramonto alla tua posizione (HH:MM:SS)",
"take_over_control": "take_over_control: Se viene chiamato il servizio 'lights.turn_on' (non da Illuminazione Adattiva) quando una luce è già accesa, interrompi l'adattamento della luce finquando essa o l'interruttore non vengono riaccesi (off -> on.)",
"detect_non_ha_changes": "detect_non_ha_changes: rileva tutti i cambiamenti >10% applicati alle luci (anche fuori da HA), richiede che 'take_over_control' sia abilitato (chiama 'homeassistant.update_entity' ad ogni 'intervallo'!)",
"transition": "Tempo di transizione quando viene applicato un cambiamento alle luci (secondi)",
"adapt_delay": "Tempo di attesa tra l'accensione della luce, e Illuminazione Adattiva che applica i cambiamenti allo stato della luce. Potrebbe evitare lo sfarfallio."
"transition": "Tempo di transizione quando viene applicata una modifica alle luci (secondi)",
"adapt_delay": "Tempo di attesa tra l'accensione della luce, e Illuminazione Adattiva che applica le modifiche allo stato della luce. Potrebbe evitare sfarfallii."
}
}
},
Expand Down
69 changes: 35 additions & 34 deletions custom_components/alexa_media/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,40 +662,41 @@ async def process_notifications(login_obj, raw_notifications=None):
"notifications", {}
)
notifications = {"process_timestamp": dt.utcnow()}
for notification in raw_notifications:
n_dev_id = notification.get("deviceSerialNumber")
if n_dev_id is None:
# skip notifications untied to a device for now
# https://github.com/custom-components/alexa_media_player/issues/633#issuecomment-610705651
continue
n_type = notification.get("type")
if n_type is None:
continue
if n_type == "MusicAlarm":
n_type = "Alarm"
n_id = notification["notificationIndex"]
if n_type == "Alarm":
n_date = notification.get("originalDate")
n_time = notification.get("originalTime")
notification["date_time"] = (
f"{n_date} {n_time}" if n_date and n_time else None
)
previous_alarm = previous.get(n_dev_id, {}).get("Alarm", {}).get(n_id)
if previous_alarm and alarm_just_dismissed(
notification,
previous_alarm.get("status"),
previous_alarm.get("version"),
):
hass.bus.async_fire(
"alexa_media_alarm_dismissal_event",
event_data={"device": {"id": n_dev_id}, "event": notification},
if raw_notifications is not None:
for notification in raw_notifications:
n_dev_id = notification.get("deviceSerialNumber")
if n_dev_id is None:
# skip notifications untied to a device for now
# https://github.com/custom-components/alexa_media_player/issues/633#issuecomment-610705651
continue
n_type = notification.get("type")
if n_type is None:
continue
if n_type == "MusicAlarm":
n_type = "Alarm"
n_id = notification["notificationIndex"]
if n_type == "Alarm":
n_date = notification.get("originalDate")
n_time = notification.get("originalTime")
notification["date_time"] = (
f"{n_date} {n_time}" if n_date and n_time else None
)
previous_alarm = previous.get(n_dev_id, {}).get("Alarm", {}).get(n_id)
if previous_alarm and alarm_just_dismissed(
notification,
previous_alarm.get("status"),
previous_alarm.get("version"),
):
hass.bus.async_fire(
"alexa_media_alarm_dismissal_event",
event_data={"device": {"id": n_dev_id}, "event": notification},
)

if n_dev_id not in notifications:
notifications[n_dev_id] = {}
if n_type not in notifications[n_dev_id]:
notifications[n_dev_id][n_type] = {}
notifications[n_dev_id][n_type][n_id] = notification
if n_dev_id not in notifications:
notifications[n_dev_id] = {}
if n_type not in notifications[n_dev_id]:
notifications[n_dev_id][n_type] = {}
notifications[n_dev_id][n_type][n_id] = notification
hass.data[DATA_ALEXAMEDIA]["accounts"][email]["notifications"] = notifications
_LOGGER.debug(
"%s: Updated %s notifications for %s devices at %s",
Expand Down Expand Up @@ -758,7 +759,7 @@ async def update_bluetooth_state(login_obj, device_serial):
"media_player"
][device_serial]

if "bluetoothStates" in bluetooth:
if bluetooth is not None and "bluetoothStates" in bluetooth:
for b_state in bluetooth["bluetoothStates"]:
if device_serial == b_state["deviceSerialNumber"]:
# _LOGGER.debug("%s: setting value for: %s to %s",
Expand All @@ -781,7 +782,7 @@ async def update_dnd_state(login_obj) -> None:
"""Update the dnd state on ws dnd combo event."""
dnd = await AlexaAPI.get_dnd_state(login_obj)

if "doNotDisturbDeviceStatusList" in dnd:
if dnd is not None and "doNotDisturbDeviceStatusList" in dnd:
async_dispatcher_send(
hass,
f"{DOMAIN}_{hide_email(email)}"[0:32],
Expand Down
Loading

0 comments on commit 5ab4521

Please sign in to comment.