From a9e6f6d68ae8438bbb280a5d4c2a36ff7449b218 Mon Sep 17 00:00:00 2001 From: Georgi Gardev Date: Fri, 17 Jul 2020 16:13:34 +0300 Subject: [PATCH] Add living room opple --- config/advanced-lovelace.yaml | 1 - .../advanced_dashboard/08_automations.yaml | 45 ++++ .../advanced_dashboard/10_system.yaml | 2 + .../devices/bedroom/bedroom_opple.yaml | 20 +- .../living_room/living_room_opple.yaml | 246 ++++++++++++++++++ config/packages/modules/network.yaml | 2 + 6 files changed, 305 insertions(+), 11 deletions(-) create mode 100644 config/packages/devices/living_room/living_room_opple.yaml diff --git a/config/advanced-lovelace.yaml b/config/advanced-lovelace.yaml index 2e56d20..01d2f41 100644 --- a/config/advanced-lovelace.yaml +++ b/config/advanced-lovelace.yaml @@ -20,4 +20,3 @@ views: - !include lovelace/advanced_dashboard/10_system.yaml - !include lovelace/advanced_dashboard/12_test.yaml - !include lovelace/advanced_dashboard/13_dev.yaml - - !include lovelace/advanced_dashboard/14_zigbeemap.yaml diff --git a/config/lovelace/advanced_dashboard/08_automations.yaml b/config/lovelace/advanced_dashboard/08_automations.yaml index 06c25cb..57c4f3a 100644 --- a/config/lovelace/advanced_dashboard/08_automations.yaml +++ b/config/lovelace/advanced_dashboard/08_automations.yaml @@ -190,6 +190,51 @@ cards: - automation.wallmote_living_room_4_tap_toggle_ac - automation.wallmote_living_room_4_hold_toggle_titanium + - type: entities + title: Bedroom Opple (opple_1) + show_header_toggle: true + icon: mdi:light-switch + entities: + - automation.lighting_master_bedroom_opple_turn_off_lights_on_1_click + - automation.lighting_master_bedroom_opple_turn_on_lights_on_2_click + - automation.lighting_master_bedroom_opple_turn_off_all_lights_on_1_double + - automation.lighting_master_bedroom_opple_turn_on_all_lights_on_2_double + - automation.lighting_master_bedroom_opple_turn_off_all_ambient_lights_on_1_triple + - automation.lighting_master_bedroom_opple_turn_on_ambient_lights_on_2_triple + - automation.media_master_bedroom_opple_toggle_music_on_3_single + - automation.media_master_bedroom_opple_bring_tv_on_3_double + - automation.media_master_bedroom_opple_bring_bedroom_on_3_triple + - automation.media_master_bedroom_opple_next_song_on_3_release + - automation.media_master_bedroom_opple_play_chill_on_4_single + - automation.media_master_bedroom_opple_play_starred_on_4_double + - automation.media_master_bedroom_opple_play_retro_on_4_triple + - automation.climate_master_bedroom_opple_turn_off_purifier_on_5_single + - automation.climate_master_bedroom_opple_turn_on_purifier_on_6_single + + - type: entities + title: Living room Opple (opple_2) + show_header_toggle: true + icon: mdi:light-switch + entities: + - automation.lighting_living_room_opple_turn_off_lights_on_1_click + - automation.lighting_living_room_opple_turn_on_lights_on_2_click + - automation.lighting_living_room_opple_turn_off_all_lights_on_1_double + - automation.lighting_living_room_opple_turn_on_all_lights_on_2_double + - automation.lighting_living_room_opple_turn_off_all_ambient_lights_on_1_triple + - automation.lighting_living_room_opple_turn_on_ambient_lights_on_2_triple + - automation.media_living_room_opple_toggle_music_on_3_single + - automation.media_living_room_opple_bring_tv_on_3_double + - automation.media_living_room_opple_bring_bedroom_on_3_triple + - automation.media_living_room_opple_next_song_on_3_release + - automation.media_living_room_opple_play_chill_on_4_single + - automation.media_living_room_opple_play_starred_on_4_double + - automation.media_living_room_opple_play_retro_on_4_triple + - automation.climate_living_room_opple_turn_off_ac_on_5_single + - automation.climate_living_room_opple_ac_temp_down_on_5_double + - automation.climate_living_room_opple_turn_on_ac_on_6_single + - automation.climate_living_room_opple_ac_temp_up_on_6_double + - automation.media_living_room_opple_fireplace_on_6_triple_click + - type: entities title: Magic Cube show_header_toggle: false diff --git a/config/lovelace/advanced_dashboard/10_system.yaml b/config/lovelace/advanced_dashboard/10_system.yaml index adc63d8..84efd59 100644 --- a/config/lovelace/advanced_dashboard/10_system.yaml +++ b/config/lovelace/advanced_dashboard/10_system.yaml @@ -86,12 +86,14 @@ cards: - type: entities title: Zigbee2MQTT link quality entities: + - sensor.living_room_opple_lqi - sensor.desk_switch_lqi - sensor.living_room_right_window_lqi - type: divider - sensor.bedside_switch_lqi # - sensor.bed_led_lqi - sensor.bedroom_wall_switch_lqi + - sensor.bedroom_opple_lqi - sensor.bedroom_door_lqi - sensor.bedroom_left_window_lqi - sensor.bedroom_right_window_lqi diff --git a/config/packages/devices/bedroom/bedroom_opple.yaml b/config/packages/devices/bedroom/bedroom_opple.yaml index fb3abc7..6145326 100644 --- a/config/packages/devices/bedroom/bedroom_opple.yaml +++ b/config/packages/devices/bedroom/bedroom_opple.yaml @@ -125,7 +125,7 @@ automation: # Audio - - alias: Lighting · Master bedroom · Opple · Toggle music on 3 single + - alias: Media · Master bedroom · Opple · Toggle music on 3 single trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -137,7 +137,7 @@ automation: - service: media_player.media_play_pause entity_id: media_player.master_bedroom - - alias: Lighting · Master bedroom · Opple · Bring tv on 3 double + - alias: Media · Master bedroom · Opple · Bring tv on 3 double trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -148,7 +148,7 @@ automation: action: - service: script.sonos_join_tv - - alias: Lighting · Master bedroom · Opple · Bring bedroom on 3 triple + - alias: Media · Master bedroom · Opple · Bring bedroom on 3 triple trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -159,7 +159,7 @@ automation: action: - service: script.sonos_join_bedroom - - alias: Lighting · Master bedroom · Opple · Next song on 3 release + - alias: Media · Master bedroom · Opple · Next song on 3 release trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -171,7 +171,7 @@ automation: - service: media_player.play_next entity_id: media_player.master_bedroom - - alias: Lighting · Master bedroom · Opple · Play chill on 4 single + - alias: Media · Master bedroom · Opple · Play chill on 4 single trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -182,7 +182,7 @@ automation: action: - service: script.music_play - - alias: Lighting · Master bedroom · Opple · Play Starred on 4 double + - alias: Media · Master bedroom · Opple · Play Starred on 4 double trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -195,7 +195,7 @@ automation: data: playlist: 'Starred' - - alias: Lighting · Master bedroom · Opple · Play Retro on 4 triple + - alias: Media · Master bedroom · Opple · Play Retro on 4 triple trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -208,9 +208,9 @@ automation: data: playlist: 'Retro' - # Climate - - alias: Lighting · Master bedroom · Opple · Turn off purifier on 5 single + # Climate + - alias: Climate · Master bedroom · Opple · Turn off purifier on 5 single trigger: platform: mqtt topic: "z2m_deconz/opple_1" @@ -222,7 +222,7 @@ automation: - service: fan.turn_off entity_id: fan.philips_airpurifier - - alias: Lighting · Master bedroom · Opple · Turn on purifier on 6 single + - alias: Climate · Master bedroom · Opple · Turn on purifier on 6 single trigger: platform: mqtt topic: "z2m_deconz/opple_1" diff --git a/config/packages/devices/living_room/living_room_opple.yaml b/config/packages/devices/living_room/living_room_opple.yaml new file mode 100644 index 0000000..c03340d --- /dev/null +++ b/config/packages/devices/living_room/living_room_opple.yaml @@ -0,0 +1,246 @@ +sensor: + - platform: mqtt + name: "Living room Opple action" + state_topic: "z2m_deconz/opple_2" + availability_topic: "z2m_deconz/bridge/state" + icon: "mdi:gesture-double-tap" + value_template: "{{ value_json.action }}" + - platform: mqtt + name: "Living room Opple battery" + state_topic: "z2m_deconz/opple_2" + availability_topic: "z2m_deconz/bridge/state" + unit_of_measurement: "%" + device_class: "battery" + value_template: "{{ value_json.battery }}" + - platform: mqtt + name: "Living room Opple LQI" + state_topic: "z2m_deconz/opple_2" + availability_topic: "z2m_deconz/bridge/state" + icon: "mdi:signal" + unit_of_measurement: "lqi" + value_template: "{{ value_json.linkquality }}" + +automation: + + # Lights + - alias: Lighting · Living room · Opple · Turn off lights on 1 click + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_1_single' + action: + - service: light.turn_off + entity_id: light.living_room_main + + - alias: Lighting · Living room · Opple · Turn on lights on 2 click + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_2_single' + action: + - service: light.turn_on + entity_id: light.living_room_main + + - alias: Lighting · Living room · Opple · Turn off all lights on 1 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_1_double' + action: + - service: light.turn_off + entity_id: light.living_room + + - alias: Lighting · Living room · Opple · Turn on all lights on 2 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_2_double' + action: + - service: light.turn_on + entity_id: light.living_room + + - alias: Lighting · Living room · Opple · Turn off all ambient lights on 1 triple + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_1_triple' + action: + - service: light.turn_off + entity_id: light.living_room_ambient + + - alias: Lighting · Living room · Opple · Turn on ambient lights on 2 triple + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_2_triple' + action: + - service: light.turn_on + entity_id: light.living_room_ambient + + + # Audio + - alias: Media · Living room · Opple · Toggle music on 3 single + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_3_single' + action: + - service: media_player.media_play_pause + entity_id: media_player.living_room + + - alias: Media · Living room · Opple · Bring tv on 3 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_3_double' + action: + - service: script.sonos_join_tv + + - alias: Media · Living room · Opple · Bring bedroom on 3 triple + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_3_triple' + action: + - service: script.sonos_join_bedroom + + - alias: Media · Living room · Opple · Next song on 3 release + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_3_release' + action: + - service: media_player.play_next + entity_id: media_player.living_room + + - alias: Media · Living room · Opple · Play chill on 4 single + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_4_single' + action: + - service: script.music_play + + - alias: Media · Living room · Opple · Play Starred on 4 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_4_double' + action: + - service: script.music_play + data: + playlist: 'Starred' + + - alias: Media · Living room · Opple · Play Retro on 4 triple + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_4_triple' + action: + - service: script.music_play + data: + playlist: 'Retro' + + + # Climate + - alias: Climate · Living room · Opple · Turn off AC on 5 single + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_5_single' + action: + - service: climate.turn_off + entity_id: climate.toshiba_ac + + - alias: Climate · Living room · Opple · AC Temp down on 5 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_5_double' + action: + - service: climate.set_temperature + entity_id: climate.toshiba_ac + data_template: + temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int -1}}" + + - alias: Climate · Living room · Opple · Turn on AC on 6 single + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_6_single' + action: + - service: script.toshiba_ac_on_cool + + - alias: Climate · Living room · Opple · AC Temp up on 6 double + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_6_double' + action: + - service: climate.set_temperature + entity_id: climate.toshiba_ac + data_template: + temperature: "{{ state_attr('climate.toshiba_ac', 'temperature') | int +1}}" + + - alias: Media · Living room · Opple · Fireplace on 6 triple click + trigger: + platform: mqtt + topic: "z2m_deconz/opple_2" + condition: + - condition: state + entity_id: sensor.living_room_opple_action + state: 'button_6_triple' + action: + - service: script.tv_fireplace + diff --git a/config/packages/modules/network.yaml b/config/packages/modules/network.yaml index 566357a..b2c199e 100644 --- a/config/packages/modules/network.yaml +++ b/config/packages/modules/network.yaml @@ -117,12 +117,14 @@ sensor: value_template: "{{ now().strftime('%Y-%m-%d %H:%M:%S') }}" # again, if you change base_topic of Zigbee2mqtt, change json_attributes_topic accordingly json_attributes_topic: z2m_deconz/bridge/networkmap/raw + - platform: mqtt name: "Zigbee2MQTT Devices count" availability_topic: "z2m_deconz/bridge/state" state_topic: "z2m_deconz/bridge/config/devices" value_template: "{{ value_json | count }}" icon: "mdi:counter" + - platform: mqtt name: "Router 1 LQI" state_topic: "z2m_deconz/router_1"