diff --git a/config/lovelace/home_dashboard/00_home.yaml b/config/lovelace/home_dashboard/00_home.yaml index 6c87315..e2301f4 100644 --- a/config/lovelace/home_dashboard/00_home.yaml +++ b/config/lovelace/home_dashboard/00_home.yaml @@ -31,7 +31,7 @@ cards: cards: - type: custom:button-card template: small - entity: light.tuya_kitchen_main_lights + entity: light.tuya_kitchen_all_lights name: Kitchen - type: custom:button-card template: small diff --git a/config/lovelace/home_dashboard/01_living_room.yaml b/config/lovelace/home_dashboard/01_living_room.yaml index d3a2a62..79bd8d0 100644 --- a/config/lovelace/home_dashboard/01_living_room.yaml +++ b/config/lovelace/home_dashboard/01_living_room.yaml @@ -46,8 +46,16 @@ cards: variables: - light: light.light_lohas_2 - fade: switch.light_lohas_2_fade - - light.light_le_9 - - light.light_le_10 + - type: custom:decluttering-card + template: light_with_fade_and_switch + variables: + - light: light.light_lohas_3 + - fade: switch.light_lohas_3_fade + - type: custom:decluttering-card + template: light_with_fade_and_switch + variables: + - light: light.light_lohas_4 + - fade: switch.light_lohas_4_fade - type: custom:fold-entity-row head: type: custom:decluttering-card diff --git a/config/lovelace/home_dashboard/03_kitchen.yaml b/config/lovelace/home_dashboard/03_kitchen.yaml index 05e205c..df8219c 100644 --- a/config/lovelace/home_dashboard/03_kitchen.yaml +++ b/config/lovelace/home_dashboard/03_kitchen.yaml @@ -14,7 +14,9 @@ cards: title: Lights show_header_toggle: false entities: + - light.tuya_kitchen_all_lights - light.tuya_kitchen_main_lights + - light.tuya_kitchen_secondary_lights - type: divider - type: custom:fold-entity-row entity: light.kitchen_main_lights diff --git a/config/lovelace/home_dashboard/06_lights.yaml b/config/lovelace/home_dashboard/06_lights.yaml index 7302b1d..2414c8d 100644 --- a/config/lovelace/home_dashboard/06_lights.yaml +++ b/config/lovelace/home_dashboard/06_lights.yaml @@ -9,14 +9,12 @@ cards: icon: mdi:sofa show_header_toggle: false entities: - - light.tuya_living_room_main_lights - - type: divider - light.living_room_all_lights - light.living_room_main_lights - light.light_lohas_1 - light.light_lohas_2 - - light.light_le_9 - - light.light_le_10 + - light.light_lohas_3 + - light.light_lohas_4 - light.pc - type: entities @@ -37,12 +35,17 @@ cards: icon: mdi:chef-hat show_header_toggle: false entities: + - light.tuya_kitchen_all_lights - light.tuya_kitchen_main_lights + - light.tuya_kitchen_secondary_lights - type: divider - light.kitchen_main_lights - light.light_le_11 - light.light_le_12 - light.light_orbecco_1 + - light.kitchen_secondary_lights + - light.light_le_9 + - light.light_le_10 - type: entities title: Hallway @@ -60,5 +63,3 @@ cards: - light.light_le_6 - light.light_le_7 - light.light_le_8 - - diff --git a/config/packages/modules/lighting/groups.yaml b/config/packages/modules/lighting/groups.yaml index ab696e7..37fb972 100644 --- a/config/packages/modules/lighting/groups.yaml +++ b/config/packages/modules/lighting/groups.yaml @@ -1,17 +1,11 @@ light: - # Used only to set correct initial state of tuya_living_room_main_lights - - platform: group - name: Living room tuya lights - entities: - - light.light_le_9 - - light.light_le_10 - - platform: group name: Living room main lights entities: - light.light_lohas_1 - light.light_lohas_2 - - light.tuya_living_room_main_lights + - light.light_lohas_3 + - light.light_lohas_4 - platform: group name: Living room all lights @@ -40,6 +34,18 @@ light: - light.light_le_12 - light.light_orbecco_1 + - platform: group + name: Kitchen secondary lights + entities: + - light.light_le_9 + - light.light_le_10 + + - platform: group + name: Tuya Kitchen all lights + entities: + - light.tuya_kitchen_main_lights + - light.tuya_kitchen_secondary_lights + - platform: group name: Hallway entrance lights entities: @@ -69,7 +75,7 @@ light: entities: - light.living_room_all_lights - light.master_bedroom_main_lights - - light.tuya_kitchen_main_lights + - light.tuya_kitchen_all_lights - light.tuya_hallway_all_lights - platform: group @@ -77,10 +83,9 @@ light: entities: - light.living_room_all_lights - light.master_bedroom_all_lights - - light.tuya_kitchen_main_lights + - light.tuya_kitchen_all_lights - light.tuya_hallway_all_lights - homeassistant: customize: light.living_room_main_lights: @@ -91,6 +96,8 @@ homeassistant: icon: bha:ceiling-lamp-plafond light.kitchen_main_lights: icon: bha:ceiling-lamp-plafond + light.tuya_kitchen_all_lights: + icon: bha:ceiling-lamp-plafond light.hallway_entrance_lights: icon: bha:ceiling-lamp-plafond light.hallway_main_lights: diff --git a/config/packages/modules/lighting/mqtt.yaml b/config/packages/modules/lighting/mqtt.yaml index 685c842..38c374a 100644 --- a/config/packages/modules/lighting/mqtt.yaml +++ b/config/packages/modules/lighting/mqtt.yaml @@ -164,6 +164,60 @@ light: qos: 1 retain: false + - platform: mqtt + name: "light_lohas_3" + availability_topic: "tele/light_lohas_3/LWT" + command_topic: "cmnd/light_lohas_3/POWER" + state_topic: "tele/light_lohas_3/STATE" + state_value_template: "{{ value_json.POWER }}" + brightness_command_topic: "cmnd/light_lohas_3/Dimmer" + brightness_state_topic: "tele/light_lohas_3/STATE" + brightness_scale: 100 + on_command_type: "brightness" + brightness_value_template: "{{ value_json.Dimmer }}" + hs_command_topic: "cmnd/light_lohas_3/HSBColor" + hs_state_topic: "tele/light_lohas_3/STATE" + hs_value_template: "{{ value_json.HSBColor.split(',')[0:2]|join(',') }}" + color_temp_command_topic: "cmnd/light_lohas_3/CT" + color_temp_state_topic: "tele/light_lohas_3/STATE" + color_temp_value_template: "{{ value_json.CT }}" + rgb_command_topic: "cmnd/light_lohas_3/Color" + rgb_state_topic: "tele/pc_light/STATE" + rgb_value_template: "{{ value_json.Color.split(',')[0:3]|join(',') }}" + payload_on: "ON" + payload_off: "OFF" + payload_available: "Online" + payload_not_available: "Offline" + qos: 1 + retain: false + + - platform: mqtt + name: "light_lohas_4" + availability_topic: "tele/light_lohas_4/LWT" + command_topic: "cmnd/light_lohas_4/POWER" + state_topic: "tele/light_lohas_4/STATE" + state_value_template: "{{ value_json.POWER }}" + brightness_command_topic: "cmnd/light_lohas_4/Dimmer" + brightness_state_topic: "tele/light_lohas_4/STATE" + brightness_scale: 100 + on_command_type: "brightness" + brightness_value_template: "{{ value_json.Dimmer }}" + hs_command_topic: "cmnd/light_lohas_4/HSBColor" + hs_state_topic: "tele/light_lohas_4/STATE" + hs_value_template: "{{ value_json.HSBColor.split(',')[0:2]|join(',') }}" + color_temp_command_topic: "cmnd/light_lohas_4/CT" + color_temp_state_topic: "tele/light_lohas_4/STATE" + color_temp_value_template: "{{ value_json.CT }}" + rgb_command_topic: "cmnd/light_lohas_4/Color" + rgb_state_topic: "tele/pc_light/STATE" + rgb_value_template: "{{ value_json.Color.split(',')[0:3]|join(',') }}" + payload_on: "ON" + payload_off: "OFF" + payload_available: "Online" + payload_not_available: "Offline" + qos: 1 + retain: false + sensor: - platform: mqtt name: "PC light WiFi" @@ -235,6 +289,26 @@ sensor: unit_of_measurement: "%" value_template: "{{ value_json['Wifi'].RSSI }}" + - platform: mqtt + name: "light_lohas_3_wifi" + availability_topic: "tele/light_lohas_3/LWT" + device_class: signal_strength + payload_available: "Online" + payload_not_available: "Offline" + state_topic: "tele/light_lohas_3/STATE" + unit_of_measurement: "%" + value_template: "{{ value_json['Wifi'].RSSI }}" + + - platform: mqtt + name: "light_lohas_4_wifi" + availability_topic: "tele/light_lohas_4/LWT" + device_class: signal_strength + payload_available: "Online" + payload_not_available: "Offline" + state_topic: "tele/light_lohas_4/STATE" + unit_of_measurement: "%" + value_template: "{{ value_json['Wifi'].RSSI }}" + switch: - platform: mqtt name: "PC Light Fade" @@ -313,6 +387,28 @@ switch: state_topic: "stat/light_lohas_2/RESULT" value_template: "{{ value_json.Fade }}" + - platform: mqtt + name: "light_lohas_3_fade" + availability_topic: "tele/light_lohas_3/LWT" + command_topic: "cmnd/light_lohas_3/FADE" + icon: mdi:gradient + payload_available: "Online" + payload_not_available: "Offline" + qos: 1 + state_topic: "stat/light_lohas_3/RESULT" + value_template: "{{ value_json.Fade }}" + + - platform: mqtt + name: "light_lohas_4_fade" + availability_topic: "tele/light_lohas_4/LWT" + command_topic: "cmnd/light_lohas_4/FADE" + icon: mdi:gradient + payload_available: "Online" + payload_not_available: "Offline" + qos: 1 + state_topic: "stat/light_lohas_4/RESULT" + value_template: "{{ value_json.Fade }}" + automation: - alias: Lighting · Sync Tasmota states on start-up initial_state: true diff --git a/config/packages/modules/lighting/tuya.yaml b/config/packages/modules/lighting/tuya.yaml index c376353..cf6cd3d 100644 --- a/config/packages/modules/lighting/tuya.yaml +++ b/config/packages/modules/lighting/tuya.yaml @@ -9,27 +9,14 @@ # Light groups in Tuya. Name: "tuya_{{scene_name}}_lights_state" input_boolean: - tuya_living_room_main_lights_state: tuya_kitchen_main_lights_state: + tuya_kitchen_secondary_lights_state: tuya_hallway_main_lights_state: tuya_hallway_entrance_lights_state: light: - platform: template lights: - tuya_living_room_main_lights: - friendly_name: Living room main lights (scene) - value_template: "{{ is_state('input_boolean.tuya_living_room_main_lights_state', 'on') }}" - icon_template: bha:ceiling-lamp-plafond - turn_on: - service: input_boolean.turn_on - data: - entity_id: input_boolean.tuya_living_room_main_lights_state - turn_off: - service: input_boolean.turn_off - data: - entity_id: input_boolean.tuya_living_room_main_lights_state - tuya_kitchen_main_lights: friendly_name: Kitchen main lights (scene) value_template: "{{ is_state('input_boolean.tuya_kitchen_main_lights_state', 'on') }}" @@ -43,6 +30,19 @@ light: data: entity_id: input_boolean.tuya_kitchen_main_lights_state + tuya_kitchen_secondary_lights: + friendly_name: Kitchen secondary lights (scene) + value_template: "{{ is_state('input_boolean.tuya_kitchen_secondary_lights_state', 'on') }}" + icon_template: bha:ceiling-lamp-plafond + turn_on: + service: input_boolean.turn_on + data: + entity_id: input_boolean.tuya_kitchen_secondary_lights_state + turn_off: + service: input_boolean.turn_off + data: + entity_id: input_boolean.tuya_kitchen_secondary_lights_state + tuya_hallway_main_lights: friendly_name: Hallway main lights (scene) value_template: "{{ is_state('input_boolean.tuya_hallway_main_lights_state', 'on') }}" @@ -69,15 +69,14 @@ light: data: entity_id: input_boolean.tuya_hallway_entrance_lights_state - # Try to keep input_booleans consistent. automation: - alias: Lighting · Tuya · Update kitchen lights trigger: platform: state entity_id: - - input_boolean.tuya_living_room_main_lights_state - input_boolean.tuya_kitchen_main_lights_state + - input_boolean.tuya_kitchen_secondary_lights_state - input_boolean.tuya_hallway_main_lights_state - input_boolean.tuya_hallway_entrance_lights_state action: @@ -95,14 +94,15 @@ automation: event: start action: - delay: 00:00:03 - - service_template: "input_boolean.turn_{{ states('light.living_room_tuya_lights') }}" - data: - entity_id: input_boolean.tuya_living_room_main_lights_state - service_template: "input_boolean.turn_{{ states('light.kitchen_main_lights') }}" data: entity_id: input_boolean.tuya_kitchen_main_lights_state + - service_template: "input_boolean.turn_{{ states('light.living_room_tuya_lights') }}" + data: + entity_id: input_boolean.tuya_kitchen_secondary_lights_state + - service_template: "input_boolean.turn_{{ states('light.hallway_main_lights') }}" data: entity_id: input_boolean.tuya_hallway_main_lights_state diff --git a/config/packages/modules/system.yaml b/config/packages/modules/system.yaml index 808f1d9..ebd4e2d 100644 --- a/config/packages/modules/system.yaml +++ b/config/packages/modules/system.yaml @@ -69,7 +69,7 @@ automation: Lights: Living room: {{ states('light.living_room_all_lights') }} Master bedroom: {{ states('light.master_bedroom_all_lights') }} - Kitchen: {{ states('light.kitchen_main_lights') }} + Kitchen: {{ states('light.kitchen_all_lights') }} Hallway: {{ states('light.hallway_all_lights') }} - alias: IFTTT · Call service diff --git a/config/packages/routines/bedtime.yaml b/config/packages/routines/bedtime.yaml index 3076be6..c540702 100644 --- a/config/packages/routines/bedtime.yaml +++ b/config/packages/routines/bedtime.yaml @@ -30,10 +30,7 @@ script: - media_player.nvidia_shield - media_player.living_room_tv - service: light.turn_off - entity_id: - - light.living_room_all_lights - - light.tuya_hallway_all_lights - - light.tuya_kitchen_main_lights + entity_id: light.ceiling_lights automation: - alias: Routine · Bedtime · Toggle on bedside switch hold diff --git a/config/tablet-lovelace.yaml b/config/tablet-lovelace.yaml index d93379a..6c3f5a5 100644 --- a/config/tablet-lovelace.yaml +++ b/config/tablet-lovelace.yaml @@ -58,7 +58,7 @@ views: cards: - type: custom:button-card template: small - entity: light.tuya_kitchen_main_lights + entity: light.tuya_kitchen_all_lights name: Kitchen - type: custom:button-card template: small @@ -165,12 +165,12 @@ views: cards: - type: horizontal-stack cards: - - type: custom:decluttering-card - template: sonos_media_player_small - variables: - - player: media_player.kitchen + - type: custom:decluttering-card + template: sonos_media_player_small + variables: + - player: media_player.kitchen - - type: custom:decluttering-card - template: sonos_media_player_small - variables: - - player: media_player.bathroom + - type: custom:decluttering-card + template: sonos_media_player_small + variables: + - player: media_player.bathroom