diff --git a/button_card_templates.yaml b/button_card_templates.yaml index 8681be6d..f591821d 100644 --- a/button_card_templates.yaml +++ b/button_card_templates.yaml @@ -1065,41 +1065,6 @@ - width: 4em - margin: 4px - ################################################# - # # - # VACUUM MAP OVERLAY BUTTONS # - # # - ################################################# - - vacuum_map: - show_label: false - show_icon: false - name: > - [[[ return variables.area; ]]] - tap_action: - action: call-service - service: input_select.select_option - service_data: - entity_id: input_select.roborock_zone - option: > - [[[ return variables.area; ]]] - styles: - card: - - padding: 3em - - background: none - name: - - font-size: 0.9em - - letter-spacing: 0.003em - - color: '#aeb0b0' - - background: '#191c1d80' - - padding: 0.48em 0.78em 0.48em 0.78em - - border-radius: 0.6em - - overflow: visible - extra_styles: | - #ripple { - display: none; - } - ################################################# # # # ICONS # diff --git a/configuration.yaml b/configuration.yaml index 27ceb6a4..58dd713c 100755 --- a/configuration.yaml +++ b/configuration.yaml @@ -16,27 +16,27 @@ default_config: lovelace: mode: yaml resources: - [ { url: /hacsfiles/bar-card/bar-card.js, type: module }, - { url: /hacsfiles/button-card/button-card.js, type: module }, - { url: /hacsfiles/kiosk-mode/kiosk-mode.js, type: module }, - { url: /hacsfiles/light-entity-card/light-entity-card.js, type: module }, - { url: /hacsfiles/light-popup-card/light-popup-card.js, type: module }, - { url: /hacsfiles/lovelace-card-mod/card-mod.js, type: module }, - { url: /hacsfiles/lovelace-layout-card/layout-card.js, type: module }, - { url: /hacsfiles/lovelace-slider-entity-row/slider-entity-row.js, type: module }, - { url: /hacsfiles/lovelace-valetudo-map-card/valetudo-map-card.js, type: module }, - { url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js, type: module }, - { url: /hacsfiles/swipe-card/swipe-card.js, type: module }, - - { url: '/local/calendar-card.js?v=3.109.1', type: module }, - { url: '/local/custom_icons.js?v=28082021', type: module }, - { url: /local/font.css, type: css } ] + [ { url: /hacsfiles/bar-card/bar-card.js, type: module }, + { url: /hacsfiles/button-card/button-card.js, type: module }, + { url: /hacsfiles/kiosk-mode/kiosk-mode.js, type: module }, + { url: /hacsfiles/light-entity-card/light-entity-card.js, type: module }, + { url: /hacsfiles/light-popup-card/light-popup-card.js, type: module }, + { url: /hacsfiles/lovelace-card-mod/card-mod.js, type: module }, + { url: /hacsfiles/lovelace-layout-card/layout-card.js, type: module }, + { url: /hacsfiles/lovelace-slider-entity-row/slider-entity-row.js, type: module }, + { url: /hacsfiles/lovelace-xiaomi-vacuum-map-card/xiaomi-vacuum-map-card.js, type: module }, + { url: /hacsfiles/mini-graph-card/mini-graph-card-bundle.js, type: module }, + { url: /hacsfiles/swipe-card/swipe-card.js, type: module }, + + { url: '/local/calendar-card.js?v=3.109.1', type: module }, + { url: '/local/custom_icons.js?v=28082021', type: module }, + { url: /local/font.css, type: css } ] logger: default: warning logs: homeassistant.components.websocket_api: fatal - homeassistant.components.bluetooth_tracker.device_tracker: fatal + homeassistant.components.camera: fatal recorder: db_url: !secret recorder_db_url @@ -49,14 +49,12 @@ person: - device_tracker.mattias_iphone_ios - device_tracker.mattias_iphonedetect - device_tracker.mattias_iphone_unifi - - device_tracker.mattias_bluetooth - name: Sanja id: sanja device_trackers: - device_tracker.sanja_iphonedetect - device_tracker.sanjas_iphone_unifi - - device_tracker.sanja_bluetooth device_tracker: - platform: iphonedetect @@ -130,12 +128,6 @@ ios: - identifier: start_watchtower title: Uppdatera -notify: - - platform: file - name: vacuum_last_cleaned - filename: vacuum_last_cleaned.txt - timestamp: true - lock: - platform: template name: Dator @@ -147,3 +139,47 @@ lock: unlock: service: input_boolean.turn_off entity_id: input_boolean.computer_lock + +camera: + - platform: xiaomi_cloud_map_extractor + host: !secret xiaomi_vacuum_host + token: !secret xiaomi_vacuum_token + username: !secret xiaomi_cloud_username + password: !secret xiaomi_cloud_password + name: vacuum_map + country: de + colors: + color_robo: [224,224,224] + color_charger: [27,117,27] + color_path: [30,80,113] + color_goto_path: [30,80,113] + color_map_wall_v2: [30,30,30] + color_obstacle: [30,30,30] + color_virtual_walls: [255,0,0,60] + color_no_go_zones_outline: [255,0,0,60] + color_no_go_zones: [255,0,0,28] + color_scan: [0,0,0,0] + color_map_inside: [0,0,0,0] + color_map_outside: [0,0,0,0] + color_grey_wall: [0,0,0,0] + color_map_wall: [0,0,0,0] + room_colors: + 1: [42,46,48] + 2: [42,46,48] + 16: [42,46,48] + 17: [42,46,48] + 18: [42,46,48] + draw: + - all + map_transformation: + scale: 2 + trim: + top: 16 + right: 22 + bottom: 25 + left: 21 + sizes: + charger_radius: 10 + vacuum_radius: 10 + attributes: + - calibration_points diff --git a/include/automation.yaml b/include/automation.yaml index 7942378e..64f0d2ac 100644 --- a/include/automation.yaml +++ b/include/automation.yaml @@ -126,6 +126,25 @@ automation: data: entity_id: light.badrum + - alias: disable_vacuum_map + id: '9857945964478' + initial_state: true + trigger: + - platform: state + entity_id: vacuum.morty + condition: + - condition: template + value_template: > + {{ trigger.to_state.state != trigger.from_state.state }} + action: + - service: > + {% if trigger.to_state.state in ['unavailable', 'unknown', 'docked'] %} + camera.turn_off + {% else %} + camera.turn_on + {% endif %} + entity_id: camera.vacuum_map + #################################################### # # # NOTIFICATIONS # @@ -184,6 +203,10 @@ automation: url: https://www.home-assistant.io/latest-release-notes/ push: category: ios_hass + - service: homeassistant.update_entity + entity_id: + - sensor.hass_release_notes + - sensor.hass_release_notes_rc - alias: ios_notify_hass_update_action id: '0694774018396' @@ -262,30 +285,15 @@ automation: action: - service: homeassistant.update_entity entity_id: - - sensor.netdata_imac_cpu_system - - sensor.netdata_imac_cpu_user - - sensor.netdata_imac_ram_free - - sensor.netdata_imac_disk_system - - sensor.netdata_imac_disk_macintosh_hd - - sensor.netdata_imac_uptime + - sensor.imac_cpu + - sensor.imac_mem + - sensor.imac_system_ssd + - sensor.imac_macintosh_hd + - sensor.imac_uptime - sensor.imac_ip - sensor.monitors_volume - binary_sensor.monitors_mute_state - - alias: update_hass_release_notes - id: '4289040658246' - initial_state: true - trigger: - - platform: state - entity_id: - - sensor.hass_version_latest - - sensor.hass_version_latest_beta - action: - - service: homeassistant.update_entity - entity_id: - - sensor.hass_release_notes - - sensor.hass_release_notes_rc - - alias: update_synology_latest_version_tag id: '3362185698381' initial_state: true @@ -419,279 +427,6 @@ automation: - service: switch.turn_off entity_id: switch.wemo_fan - #################################################### - # # - # FAN 2 # - # # - #################################################### - - # - alias: sovrum_anslut_turn_off - # id: '1050805589188' - # initial_state: true - # trigger: - # - platform: state - # entity_id: fan.sovrum_anslut - # from: 'off' - # to: 'on' - # for: - # hours: "{{ states('input_number.sovrum_anslut_timer') | int }}" - # action: - # - service: switch.turn_off - # entity_id: fan.sovrum_anslut - - # - alias: sovrum_anslut_turn_on_temp - # id: '0099808622760' - # initial_state: true - # trigger: - # - platform: numeric_state - # entity_id: sensor.sensor_hall_temperature - # above: 24 - # condition: - # condition: and - # conditions: - # - condition: time - # after: '20:00:00' - # before: '07:00:00' - # - condition: state - # entity_id: - # - person.matte - # - person.sanja - # state: home - # action: - # - condition: state - # entity_id: fan.sovrum_anslut - # state: 'off' - # - service: fan.turn_on - # entity_id: fan.sovrum_anslut - - # - alias: sovrum_anslut_oscillate - # id: '9897303821028' - # initial_state: true - # trigger: - # - platform: state - # entity_id: input_boolean.sovrum_anslut_oscillate - # action: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_fan_swing - - # - alias: sovrum_anslut_speed - # id: '9292376382008' - # mode: queued - # initial_state: true - # trigger: - # - platform: state - # entity_id: fan.sovrum_anslut - # action: - # - choose: - # - conditions: > - # {{ trigger.from_state.attributes.speed == 'high' and trigger.to_state.attributes.speed == 'medium' or - # trigger.from_state.attributes.speed == 'medium' and trigger.to_state.attributes.speed == 'low' or - # trigger.from_state.attributes.speed == 'low' and trigger.to_state.attributes.speed == 'high' }} - # sequence: - # - repeat: - # count: 2 - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_fan_speed - # - conditions: > - # {{ trigger.from_state.attributes.speed == 'high' and trigger.to_state.attributes.speed == 'low' or - # trigger.from_state.attributes.speed == 'medium' and trigger.to_state.attributes.speed == 'high' or - # trigger.from_state.attributes.speed == 'low' and trigger.to_state.attributes.speed == 'medium' }} - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_fan_speed - - # ###temp - # - alias: sovrum_anslut_speed_fix1_sync - # mode: queued - # initial_state: true - # trigger: - # - platform: template - # value_template: > - # {{ is_state('binary_sensor.gosund_fan', 'off') and not is_state('input_number.sovrum_anslut_speed', '0') }} - # action: - # - service: automation.turn_off - # target: - # entity_id: automation.sovrum_anslut_speed - # - service: input_number.set_value - # data: - # entity_id: input_number.sovrum_anslut_speed - # value: 0 - # - service: automation.turn_on - # target: - # entity_id: automation.sovrum_anslut_speed - - # - alias: sovrum_anslut_speed_fix2_restore - # mode: queued - # initial_state: true - # trigger: - # - platform: template - # value_template: > - # {{ is_state('binary_sensor.gosund_fan', 'on') and is_state('input_number.sovrum_anslut_speed', '0') }} - # action: - # - service: automation.turn_off - # target: - # entity_id: automation.sovrum_anslut_speed - # - service: input_number.set_value - # data: - # entity_id: input_number.sovrum_anslut_speed - # value: 33 - # - service: automation.turn_on - # target: - # entity_id: automation.sovrum_anslut_speed - - #################################################### - # # - # AIR PURIFIER # - # # - #################################################### - - # - alias: air_purifier_speed - # id: '3692857919366' - # mode: queued - # initial_state: true - # trigger: - # - platform: state - # entity_id: input_number.air_purifier_speed - # action: - # - choose: - # - conditions: - # - condition: template - # value_template: > - # {% set from_1 = ( trigger.from_state.state | int > 0 and trigger.from_state.state | int <= 25 ) %} - # {% set to_2 = ( trigger.to_state.state | int > 25 and trigger.to_state.state | int <= 50 ) %} - # {% set from_2 = ( trigger.from_state.state | int > 25 and trigger.from_state.state | int <= 50 ) %} - # {% set to_3 = ( trigger.to_state.state | int > 50 and trigger.to_state.state | int <= 75 ) %} - # {% set from_3 = ( trigger.from_state.state | int > 50 and trigger.from_state.state | int <= 75 ) %} - # {% set to_4 = ( trigger.to_state.state | int > 75 and trigger.to_state.state | int <= 100 ) %} - - # {{ from_1 and to_2 or from_2 and to_3 or from_3 and to_4 }} - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_speed_up - # - conditions: - # - condition: template - # value_template: > - # {% set from_1 = ( trigger.from_state.state | int > 0 and trigger.from_state.state | int <= 25 ) %} - # {% set to_3 = ( trigger.to_state.state | int > 50 and trigger.to_state.state | int <= 75 ) %} - - # {{ from_1 and to_3 }} - # sequence: - # - repeat: - # count: 2 - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_speed_up - # - conditions: - # - condition: template - # value_template: > - # {% set from_2 = ( trigger.from_state.state | int > 25 and trigger.from_state.state | int <= 50 ) %} - # {% set to_1 = ( trigger.to_state.state | int > 0 and trigger.to_state.state | int <= 25 ) %} - # {% set from_3 = ( trigger.from_state.state | int > 50 and trigger.from_state.state | int <= 75 ) %} - # {% set to_2 = ( trigger.to_state.state | int > 25 and trigger.to_state.state | int <= 50 ) %} - # {% set from_4 = ( trigger.from_state.state | int > 75 and trigger.from_state.state | int <= 100 ) %} - # {% set to_3 = ( trigger.to_state.state | int > 50 and trigger.to_state.state | int <= 75 ) %} - - # {{ from_2 and to_1 or from_3 and to_2 or from_4 and to_3 }} - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_speed_down - # - conditions: - # - condition: template - # value_template: > - # {% set from_3 = ( trigger.from_state.state | int > 50 and trigger.from_state.state | int <= 75 ) %} - # {% set to_1 = ( trigger.to_state.state | int > 0 and trigger.to_state.state | int <= 25 ) %} - # {% set from_4 = ( trigger.from_state.state | int > 75 and trigger.from_state.state | int <= 100 ) %} - # {% set to_2 = ( trigger.to_state.state | int > 25 and trigger.to_state.state | int <= 50 ) %} - - # {{ from_3 and to_1 or from_4 and to_2 }} - # sequence: - # - repeat: - # count: 2 - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_speed_down - # - conditions: - # - condition: template - # value_template: > - # {% set to_4 = ( trigger.to_state.state | int > 75 and trigger.to_state.state | int <= 100 ) %} - - # {{ to_4 }} - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_turbo - # - conditions: - # - condition: template - # value_template: > - # {% set from_4 = ( trigger.from_state.state | int > 75 and trigger.from_state.state | int <= 100 ) %} - # {% set to_1 = ( trigger.to_state.state | int > 0 and trigger.to_state.state | int <= 25 ) %} - - # {{ from_4 and to_1 }} - # sequence: - # - repeat: - # count: 3 - # sequence: - # - service: remote.send_command - # data: - # entity_id: remote.broadlink_remote - # command: !secret ir_purifier_speed_down - - # ###temp - # - alias: air_purifier_speed_fix1_sync - # mode: queued - # initial_state: true - # trigger: - # - platform: template - # value_template: > - # {{ is_state('binary_sensor.gosund_air_purifier', 'off') and not is_state('input_number.air_purifier_speed', '0') }} - # action: - # - service: automation.turn_off - # target: - # entity_id: automation.air_purifier_speed - # - service: input_number.set_value - # data: - # entity_id: input_number.air_purifier_speed - # value: 0 - # - service: automation.turn_on - # target: - # entity_id: automation.air_purifier_speed - - # - alias: air_purifier_speed_fix2_restore - # mode: queued - # initial_state: true - # trigger: - # - platform: template - # value_template: > - # {{ is_state('binary_sensor.gosund_air_purifier', 'on') and is_state('input_number.air_purifier_speed', '0') }} - # action: - # - service: automation.turn_off - # target: - # entity_id: automation.air_purifier_speed - # - service: input_number.air_purifier_speed - # data: - # entity_id: input_number.air_purifier_speed - # value: 25 - # - service: automation.turn_on - # target: - # entity_id: automation.air_purifier_speed - # ### - #################################################### # # # TABLET # @@ -738,27 +473,6 @@ automation: # # #################################################### - - alias: hdmi_input_select - id: '9559814521978' - mode: parallel - initial_state: true - trigger: - - platform: state - entity_id: input_select.hdmi - - platform: state - entity_id: input_select.hdmi2 - action: - - service: media_player.select_source - data: - entity_id: > - {% if trigger.entity_id == 'input_select.hdmi' %} - media_player.sony_bravia_tv - {% elif trigger.entity_id == 'input_select.hdmi2' %} - media_player.samsung_tv - {% endif %} - source: > - {{ states(trigger.entity_id) }} - - alias: turn_on_tv_fail_safe id: '0703991107325' mode: parallel @@ -788,11 +502,6 @@ automation: {% elif trigger == 'media_player.samsung_tv' %} media_player.sovrum {% endif %} - # - delay: - # seconds: 1 - # - repeat: - # count: 2 - # sequence: - service: remote.send_command data: entity_id: > @@ -847,75 +556,28 @@ automation: - service: tts.cloud_say data: entity_id: media_player.c2080cea_6627150a - message: > - {{ ['Tvätten är färdig', 'Tvätten är klar', 'Dags att gå ner!'] | random }} - language: sv-SE - - service: notify.mobile_app_mattias_iphone_ios - data: - message: > + message: &laundry > {{'\U0001F9FA'}} {{ ['Tvätten är färdig', 'Tvätten är klar', 'Dags att gå ner'] | random }} - - service: shell_command.imac_notify_laundry - - delay: - seconds: 3 - - #################################################### - # # - # VACUUM # - # # - #################################################### - - - alias: vacuum_last_cleaned - id: '8482831137092' - initial_state: true - trigger: - - platform: state - entity_id: vacuum.valetudo_robot - from: cleaning - to: returning - action: - - service: notify.vacuum_last_cleaned - data: - message: '' - - - alias: roborock_speed - id: '0054872718027' - initial_state: true - trigger: - - platform: state - entity_id: input_select.roborock_speed - action: - - service: vacuum.set_fan_speed - data: - entity_id: vacuum.valetudo_robot - fan_speed: > - {% if is_state(trigger.entity_id, 'Tyst') %} low - {% elif is_state(trigger.entity_id, 'Standard') %} medium - {% elif is_state(trigger.entity_id, 'Medium') %} high - {% elif is_state(trigger.entity_id, 'Turbo') %} max - {% elif is_state(trigger.entity_id, 'Av') %} off - {% endif %} - - - alias: roborock_speed_update - id: '3154087574817' - initial_state: true - trigger: - - platform: state - entity_id: vacuum.valetudo_robot - - platform: homeassistant - event: start - action: - - service: input_select.select_option - data: - entity_id: input_select.roborock_speed - option: > - {% set entity_id = 'vacuum.valetudo_robot' %} - {% if is_state_attr(entity_id, 'fan_speed', 'low') %} Tyst - {% elif is_state_attr(entity_id, 'fan_speed', 'medium') %} Standard - {% elif is_state_attr(entity_id, 'fan_speed', 'high') %} Medium - {% elif is_state_attr(entity_id, 'fan_speed', 'max') %} Turbo - {% elif is_state_attr(entity_id, 'fan_speed', 'off') - or state_attr(entity_id, 'fan_speed') == None %} Av - {% endif %} + language: sv-SE + - choose: + - conditions: > + {{ is_state('switch.computer_imac', 'on') }} + sequence: + - service: shell_command.imac_notify_laundry + - choose: + - conditions: > + {{ is_state('person.matte', 'home') }} + sequence: + - service: notify.mobile_app_mattias_iphone_ios + data: + message: *laundry + - choose: + - conditions: > + {{ is_state('person.sanja', 'home') }} + sequence: + - service: notify.mobile_app_sanja_iphone + data: + message: *laundry #################################################### # # diff --git a/include/customize.yaml b/include/customize.yaml index d8e406cf..b3599493 100644 --- a/include/customize.yaml +++ b/include/customize.yaml @@ -89,23 +89,34 @@ homeassistant: friendly_name: Systemhälsa sensor.template_nas_vpn: friendly_name: VPN + select.hdmi_bravia: + friendly_name: Källa + icon: custom:hdmi-source + select.hdmi_samsung: + friendly_name: Källa + icon: custom:hdmi-source #sidebar_vacuum.yaml - vacuum.valetudo_robot: + vacuum.morty: friendly_name: Roborock S5 icon: custom:roborock-vacuum sensor.vacuum_last_cleaned: friendly_name: Senast städat icon: mdi:calendar-clock device_class: timestamp - sensor.template_roborock_filter: + sensor.template_vacuum_filter: friendly_name: Filter - sensor.template_roborock_mainbrush: + sensor.template_vacuum_mainbrush: friendly_name: Huvudborste - sensor.template_roborock_sidebrush: + sensor.template_vacuum_sidebrush: friendly_name: Sidoborste - sensor.template_roborock_sensors: + sensor.template_vacuum_sensors: friendly_name: Sensorer + sensor.template_vacuum_lastclean: + friendly_name: Senast städat + select.vacuum_speed: + friendly_name: Rengöringsläge + icon: mdi:format-list-bulleted #sidebar_information.yaml switch.watchtower: @@ -143,23 +154,23 @@ homeassistant: friendly_name: Tänd Tv-lampa # studio_dator.yaml - sensor.template_imac_cpu: + sensor.imac_cpu: friendly_name: Processor icon: mdi:chip - sensor.template_imac_mem: + sensor.imac_mem: friendly_name: Minne icon: mdi:memory automation.macos_notification_motion_hall: friendly_name: Mottag notiser icon: mdi:bell - sensor.template_imac_uptime: + sensor.imac_uptime: friendly_name: Senaste omstart icon: mdi:update device_class: timestamp - sensor.template_imac_system_ssd: + sensor.imac_system_ssd: friendly_name: System SSD icon: custom:imac-ssd - sensor.template_imac_macintosh_hd: + sensor.imac_macintosh_hd: friendly_name: Macintosh HD icon: mdi:harddisk diff --git a/include/homekit.yaml b/include/homekit.yaml index 0e4f0ba6..52db1ebc 100644 --- a/include/homekit.yaml +++ b/include/homekit.yaml @@ -20,7 +20,7 @@ homekit: - script.home_leave - script.home_arrive - script.samsung_tv_energy_saving - - vacuum.valetudo_robot + - vacuum.morty - fan.climate_fan_only entity_config: switch.deltaco_sh_p01: @@ -45,7 +45,7 @@ homekit: name: Hemma script.samsung_tv_energy_saving: name: Eko - vacuum.valetudo_robot: + vacuum.morty: name: Morty fan.climate_fan_only: name: AC Fläkt diff --git a/include/input.yaml b/include/input.yaml index 662a22bf..77bf8f54 100644 --- a/include/input.yaml +++ b/include/input.yaml @@ -9,10 +9,6 @@ input_boolean: laundry_display: - sovrum_anslut_oscillate: - name: Oscillera - icon: mdi:arrow-left-right - computer_lock: name: Avstängningslås icon: custom:lock @@ -41,28 +37,6 @@ input_number: max: 12 unit_of_measurement: h - sovrum_anslut_timer: - name: Stäng efter - icon: mdi:timer-outline - initial: 12 - min: 1 - max: 12 - unit_of_measurement: h - - sovrum_anslut_speed: - name: Fläkthastighet - initial: 0 - min: 0 - max: 100 - unit_of_measurement: '%' - - air_purifier_speed: - name: Hastighet - initial: 0 - min: 0 - max: 100 - unit_of_measurement: '%' - input_select: #################################################### @@ -71,59 +45,6 @@ input_select: # # #################################################### - hdmi: - name: Källa - options: - - HDMI 1 - - HDMI 2/MHL - - HDMI 3 - - HDMI 4 - initial: HDMI 1 - icon: custom:hdmi-source - - hdmi2: - name: Källa - options: - - TV - - HDMI - initial: HDMI - icon: custom:hdmi-source - - roborock_speed: - name: Rengöringsläge - icon: mdi:format-list-bulleted - options: - - Tyst - - Standard - - Medium - - Turbo - - Av - - sovrum_anslut_speed: - name: Fläkthastighet - options: - - Tyst - - Medium - - Max - - air_purifier_speed: - name: Hastighet - options: - - Tyst - - Låg - - Hög - - Turbo - - roborock_zone: - initial: Ingen vald - options: - - Ingen vald - - Hall - - Kök - - Vardagsrum - - Studio - - Sovrum - conditional_media: initial: Senast nedladdat options: diff --git a/include/script.yaml b/include/script.yaml index a353481a..87b1a2a4 100644 --- a/include/script.yaml +++ b/include/script.yaml @@ -14,34 +14,6 @@ script: message: Startar om Home Assistant container... - service: shell_command.ha_dockermon_restart_container - zone_cleaning: - sequence: - - condition: not - conditions: - - condition: state - entity_id: input_select.roborock_zone - state: Ingen vald - - service: vacuum.stop - entity_id: vacuum.valetudo_robot - - delay: - seconds: 2 - - service: mqtt.publish - data: - topic: valetudo/robot/ZoneCleaningCapability/start/set - payload_template: > - {% set input = states('input_select.roborock_zone') %} - {% if input == 'Hall' %} - ["c1d8cb12-a5c0-4c9d-9706-32d6a5c68e11"] - {% elif input == 'Kök' %} - ["3d568085-1b0f-44b6-8423-66abf77ea005"] - {% elif input == 'Vardagsrum' %} - ["7a87e3b2-73be-4b7d-8313-5b51f24cde0c"] - {% elif input == 'Studio' %} - ["e75f6ab1-5d8b-4f72-b922-9fc47d5f5d02"] - {% elif input == 'Sovrum' %} - ["1c586206-b624-4804-86a4-baa02f2c04bb"] - {% endif %} - samsung_tv_energy_saving: alias: Eko-läge icon: mdi:leaf diff --git a/include/sensor.yaml b/include/sensor.yaml index 47df6c7d..72c3c626 100644 --- a/include/sensor.yaml +++ b/include/sensor.yaml @@ -19,10 +19,6 @@ sensor: source: container beta: true - - platform: file - file_path: vacuum_last_cleaned.txt - name: vacuum_last_cleaned - - platform: filesize file_paths: - /config/home-assistant.log @@ -52,34 +48,6 @@ sensor: - time - date - - platform: netdata - host: !secret netdata_host - port: !secret netdata_port - name: netdata_imac - resources: - cpu_user: - data_group: system.cpu - element: user - cpu_system: - data_group: system.cpu - element: system - ram_free: - data_group: system.ram - element: free - uptime: - data_group: system.uptime - element: uptime - disk_system: - data_group: disk_space./ - element: avail - disk_macintosh_hd: - data_group: disk_space./Volumes/Macintosh HD - element: avail - scan_interval: 86400 - # code /usr/local/etc/netdata/netdata.conf - # bind to = 0.0.0.0 - # http://localhost:19999/api/v1/allmetrics?format=json - - platform: unifigateway username: !secret unifi_username password: !secret unifi_password @@ -90,8 +58,8 @@ sensor: - wan - platform: rest - name: valetudo_version_latest - resource: https://api.github.com/repos/Hypfer/Valetudo/releases/latest + name: esphome_version_latest + resource: https://api.github.com/repos/esphome/esphome/releases/latest authentication: basic username: !secret github_username password: !secret github_access_token @@ -99,13 +67,6 @@ sensor: {{ value_json.tag_name }} scan_interval: 86400 - - platform: rest - name: esphome_version_latest - resource: https://api.github.com/repos/esphome/esphome/releases/latest - value_template: > - {{ value_json.tag_name }} - scan_interval: 86400 - - platform: scrape name: synology_dsm_latest resource: https://www.synology.com/en-global/releaseNote/DSM @@ -260,3 +221,34 @@ sensor: name: monitors_volume command: !secret monitors_update_volume scan_interval: 86400 + + - platform: command_line + name: imac_system_ssd + command: !secret imac_system_ssd + unit_of_measurement: '%' + scan_interval: 86400 + + - platform: command_line + name: imac_macintosh_hd + command: !secret imac_macintosh_hd + unit_of_measurement: '%' + scan_interval: 86400 + + - platform: command_line + name: imac_cpu + command: !secret imac_cpu + unit_of_measurement: '%' + scan_interval: 86400 + + - platform: command_line + name: imac_mem + command: !secret imac_mem + unit_of_measurement: '%' + scan_interval: 86400 + + - platform: command_line + name: imac_uptime + command: !secret imac_uptime + value_template: > + {{ value | int | timestamp_custom('%Y-%m-%dT%H:%M:%S') }} + scan_interval: 86400 diff --git a/include/switch.yaml b/include/switch.yaml index 4503cc60..e8de5c0b 100644 --- a/include/switch.yaml +++ b/include/switch.yaml @@ -55,7 +55,8 @@ switch: friendly_name: Tv icon_template: custom:tv value_template: > - {{ is_state('media_player.sony_bravia_tv', 'on') }} + {{ is_state('media_player.sony_bravia_tv', 'on') or + is_state('media_player.sony_bravia_tv', 'playing') }} turn_on: - service: remote.send_command data: diff --git a/include/template.yaml b/include/template.yaml index 9574fe46..2ac01fcd 100644 --- a/include/template.yaml +++ b/include/template.yaml @@ -6,6 +6,56 @@ template: # # #################################################### + select: + - name: vacuum_speed + state: > + {{ state_attr('vacuum.morty', 'fan_speed') }} + options: > + {{ state_attr('vacuum.morty', 'fan_speed_list') }} + select_option: + service: vacuum.set_fan_speed + target: + entity_id: vacuum.morty + data: + fan_speed: > + {{ option }} + + - name: hdmi_bravia + state: > + {% set entity_id = 'media_player.sony_bravia_tv' %} + {% if state_attr(entity_id, 'source') == None %} + {{ state_attr(entity_id, 'source_list')[1] }} + {% else %} + {{ state_attr(entity_id, 'source') }} + {% endif %} + options: > + {{ state_attr('media_player.sony_bravia_tv', 'source_list') }} + select_option: + service: media_player.select_source + target: + entity_id: media_player.sony_bravia_tv + data: + source: > + {{ option }} + + - name: hdmi_samsung + state: > + {% set entity_id = 'media_player.samsung_tv' %} + {% if state_attr(entity_id, 'source') == None %} + {{ state_attr(entity_id, 'source_list')[1] }} + {% else %} + {{ state_attr(entity_id, 'source') }} + {% endif %} + options: > + {{ state_attr('media_player.samsung_tv', 'source_list') }} + select_option: + service: media_player.select_source + target: + entity_id: media_player.samsung_tv + data: + source: > + {{ option }} + sensor: - unique_id: sidebar state: template @@ -108,7 +158,7 @@ template: {%- endif -%} vacuum: | - {% set entity_id = 'vacuum.valetudo_robot' %} + {% set entity_id = 'vacuum.morty' %} {%- if is_state(entity_id, 'cleaning') -%} Morty dammsuger {%- elif is_state(entity_id, 'returning') -%} @@ -219,13 +269,6 @@ template: {% if installed != latest %} ESPHome {{ installed + ' \u279e ' + latest }} {% endif %} - valetudo: > - {% set installed = device_attr(device_id('vacuum.valetudo_robot'), 'sw_version').split(' ')[0] %} - {% set latest = states('sensor.valetudo_version_latest') %} - {% set url = 'https://github.com/Hypfer/Valetudo/releases/latest' %} - {% if installed != latest %} - Valetudo {{ installed + ' \u279e ' + latest }} - {% endif %} playactor: > {% set installed = states('sensor.playactor_version_installed') %} {% set latest = states('sensor.playactor_version_latest') %} @@ -257,46 +300,6 @@ template: Synology DSM {{ installed + ' \u279e ' + latest }} {% endif %} - - unique_id: imac_cpu - icon: mdi:chip - unit_of_measurement: '%' - state: > - {{ ((states('sensor.netdata_imac_cpu_system') | float - + states('sensor.netdata_imac_cpu_user') | float)) | round(1) }} - - - unique_id: imac_mem - icon: mdi:memory - unit_of_measurement: '%' - state: > - {% set entity_id = states('sensor.netdata_imac_ram_free') | float %} - {% set capacity = 32000 %} - {{ (100 - (entity_id / capacity * 100)) | round(1) }} - - - unique_id: imac_system_ssd - icon: custom:imac-ssd - unit_of_measurement: '%' - state: > - {% set entity_id = states('sensor.netdata_imac_disk_system') | float %} - {% set convert_gb = 1.07374182 %} - {% set capacity = 255.85 %} - {{ 100 - (entity_id * convert_gb / capacity * 100) | round }} - - - unique_id: imac_macintosh_hd - icon: mdi:harddisk - unit_of_measurement: '%' - state: > - {% set entity_id = states('sensor.netdata_imac_disk_macintosh_hd') | float %} - {% set convert_gb = 1.07374182 %} - {% set capacity = 999.86 %} - {{ 100 - (entity_id * convert_gb / capacity * 100) | round }} - - - unique_id: imac_uptime - icon: mdi:update - device_class: timestamp - state: > - {% set seconds = states('sensor.netdata_imac_uptime') | int %} - {{ (as_timestamp(now()) - seconds) | timestamp_custom('%Y-%m-%dT%H:%M:%S') }} - - unique_id: dockermon_mem icon: mdi:memory state: > @@ -327,29 +330,35 @@ template: {{ prt('idle', 'Viloläge') }} {{ prt('Off', 'Av') }} - - unique_id: roborock_filter + - unique_id: vacuum_filter icon: custom:roborock-filter unit_of_measurement: '%' state: > - {{ (states('sensor.main_filter') | float / 60 / 150 * 100) | round }} + {{ (state_attr('vacuum.morty', 'filter_left') / 1.5) | round }} - - unique_id: roborock_mainbrush + - unique_id: vacuum_mainbrush icon: custom:roborock-mainbrush unit_of_measurement: '%' state: > - {{ (states('sensor.main_brush') | float / 60 / 300 * 100) | round }} + {{ (state_attr('vacuum.morty', 'main_brush_left') / 3) | round }} - - unique_id: roborock_sensors + - unique_id: vacuum_sensors icon: custom:roborock-sensor unit_of_measurement: '%' state: > - {{ (states('sensor.sensor_cleaning') | float / 60 / 30 * 100) | round }} + {{ (state_attr('vacuum.morty', 'sensor_dirty_left') / 0.3) | round }} - - unique_id: roborock_sidebrush + - unique_id: vacuum_sidebrush icon: custom:roborock-sidebrush unit_of_measurement: '%' state: > - {{ (states('sensor.right_brush') | float / 60 / 200 * 100) | round }} + {{ (state_attr('vacuum.morty', 'side_brush_left') / 2) | round }} + + - unique_id: vacuum_lastclean + icon: mdi:calendar-clock + device_class: timestamp + state: > + {{ state_attr('vacuum.morty', 'clean_stop') | replace(' ','T') }} - unique_id: fullykiosk_storage icon: mdi:sd diff --git a/popup/sidebar_vacuum.yaml b/popup/sidebar_vacuum.yaml index ef8c8de5..873e7f87 100644 --- a/popup/sidebar_vacuum.yaml +++ b/popup/sidebar_vacuum.yaml @@ -5,7 +5,7 @@ browser_mod: style: .: | :host .content { - width: calc(385px + 300px + 300px); + width: calc(385px + 510px); max-width: 90vw; } layout-card$grid-layout: @@ -39,26 +39,11 @@ browser_mod: #root { justify-content: space-evenly; } - $hui-picture-elements-card$: | - #root { - animation: fadein 0.9s both; - } - @keyframes fadein { - 0% { - opacity: 0; - } - 75% { - opacity: 0; - } - 100% { - opacity: 1; - } - } card: type: custom:layout-card layout_type: custom:grid-layout layout: - grid-template-columns: 385px repeat(2, 300px) + grid-template-columns: 385px 510px grid-template-rows: 1fr grid-template-areas: | "info map map" @@ -79,91 +64,93 @@ browser_mod: ################################################# - type: vertical-stack + view_layout: + grid-area: info cards: - - type: entities - view_layout: - grid-area: info - title: Inställningar - card_mod: - class: header + - type: entities + title: Inställningar + card_mod: + class: header + entities: + + - entity: vacuum.morty + + - entity: sensor.template_vacuum_lastclean + + - type: custom:bar-card + width: 55% + height: 2em + decimal: 0 + unit_of_measurement: '%' + positions: + icon: outside + indicator: 'off' + name: outside + severity: + - color: '#303435' + from: 11 + to: 100 + - color: '#6d2525' + from: 0 + to: 10 + entity_row: true entities: - - entity: vacuum.valetudo_robot - - - entity: sensor.vacuum_last_cleaned - - - type: custom:bar-card - width: 55% - height: 2em - decimal: 0 - unit_of_measurement: '%' - positions: - icon: outside - indicator: 'off' - name: outside - severity: - - color: '#303435' - from: 11 - to: 100 - - color: '#6d2525' - from: 0 - to: 10 - entity_row: true - entities: - - entity: vacuum.valetudo_robot - attribute: battery_level - name: Batteri - icon: mdi:battery - - - entity: sensor.template_roborock_filter - - - entity: sensor.template_roborock_mainbrush - - - entity: sensor.template_roborock_sidebrush - - - entity: sensor.template_roborock_sensors - - - entity: input_select.roborock_speed - - - type: horizontal-stack - cards: - - - type: custom:button-card - entity: vacuum.valetudo_robot - icon: mdi:play-pause - tap_action: - action: call-service - service: > - [[[ - return entity.state === 'docked' || entity.state === 'paused' - ? 'vacuum.start' - : 'vacuum.pause'; - ]]] - service_data: - entity_id: > - [[[ return entity.entity_id; ]]] - template: icon_only - - - type: custom:button-card - entity: vacuum.valetudo_robot - icon: mdi:battery-charging - tap_action: - action: call-service - service: vacuum.return_to_base - service_data: - entity_id: > - [[[ return entity.entity_id; ]]] - template: icon_only - - - type: custom:button-card - icon: mdi:delete-empty - tap_action: - action: call-service - service: mqtt.publish - service_data: - topic: valetudo/robot/GoToLocationCapability/go/set - payload: "c520da4d-7656-4bd1-8d08-62564559d222" - template: icon_only + - entity: vacuum.morty + attribute: battery_level + name: Batteri + icon: mdi:battery + + - entity: sensor.template_vacuum_filter + + - entity: sensor.template_vacuum_mainbrush + + - entity: sensor.template_vacuum_sidebrush + + - entity: sensor.template_vacuum_sensors + + - entity: select.vacuum_speed + + - type: horizontal-stack + cards: + + - type: custom:button-card + entity: vacuum.morty + icon: mdi:play-pause + tap_action: + action: call-service + service: > + [[[ + return entity.state === 'docked' || entity.state === 'paused' + ? 'vacuum.start' + : 'vacuum.pause'; + ]]] + service_data: + entity_id: > + [[[ return entity.entity_id; ]]] + template: icon_only + + - type: custom:button-card + entity: vacuum.morty + icon: mdi:battery-charging + tap_action: + action: call-service + service: vacuum.return_to_base + service_data: + entity_id: > + [[[ return entity.entity_id; ]]] + template: icon_only + + - type: custom:button-card + icon: mdi:delete-empty + tap_action: + action: call-service + service: vacuum.send_command + service_data: + entity_id: vacuum.morty + command: app_goto_target + params: [16821,23105] + template: icon_only ################################################# # # @@ -171,132 +158,30 @@ browser_mod: # # ################################################# - - type: picture-elements - title: Kartläggning + - type: vertical-stack view_layout: grid-area: map - image: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 45' /%3E" - card_mod: - class: header - elements: - - - type: custom:valetudo-map-card - entity: camera.map_data - title: null - rotate: 0 - crop: - top: 0 - bottom: 15 - left: 43 - right: 0 - min_height: 0 - map_scale: 2 - vacuum_icon: custom:roborock-vacuum-map - vacuum_color: rgb(224,224,224) - icon_scale: 1.1 - dock_icon: mdi:battery-charging - path_color: rgb(30,80,113) - path_width: 1.5 - floor_color: rgb(46,50,51) - segment_colors: rgb(46,50,51) - wall_color: rgba(25,30,30,0.564) - virtual_wall_color: rgba(255,0,0,0.125) - virtual_wall_width: 5 - no_go_area_color: rgba(255,0,0,0.082) - goto_target_icon: mdi:delete-empty - goto_target_color: rgb(30,80,113) - style: - top: 57% - left: 50% - width: 100% - - - type: custom:button-card - aspect_ratio: 1/1 - tap_action: - action: call-service - service: input_select.select_option - service_data: - entity_id: input_select.roborock_zone - option: Ingen vald - styles: - card: - - --mdc-ripple-color: none - - cursor: default - style: - top: 50% - left: 50% - width: 100% - - - type: custom:button-card - variables: - area: Vardagsrum - template: vacuum_map - style: - top: 12% - left: 74.5% - - - type: custom:button-card - variables: - area: Studio - template: vacuum_map - style: - top: 23.5% - left: 39.2% - - - type: custom:button-card - variables: - area: Hall - template: vacuum_map - style: - top: 51.5% - left: 56.7% - - - type: custom:button-card - variables: - area: Kök - template: vacuum_map - style: - top: 55.5% - left: 19% - - - type: custom:button-card - variables: - area: Sovrum - template: vacuum_map - style: - top: 81% - left: 24.5% - - - type: custom:button-card - entity: input_select.roborock_zone - name: Rengöringszon - label: > - [[[ return entity.state; ]]] - show_label: true - show_icon: false - styles: - card: - - background: '#FFFFFF10' - - border-radius: 0.6em - name: - - font-size: 0.75em - - color: '#FFFFFF40' - - margin-bottom: 0.2em - label: - - font-size: 1.05em - - padding: 0 0.8em 0.65em 0.8em - - color: > - [[[ - return entity.state == 'Ingen vald' - ? '#e0e1e170' - : '#e0e1e1'; - ]]] - tap_action: - action: call-service - service: script.turn_on - service_data: - entity_id: script.zone_cleaning - style: - top: 89.2% - left: 82.1% - width: 10.2em + cards: + - type: entities + title: Kartläggning + card_mod: + class: header + style: | + #states { + padding-bottom: 0; + } + entities: + - type: custom:xiaomi-vacuum-map-card + title: Kartläggning + view_layout: + grid-area: map + entity: vacuum.morty + map_camera: camera.vacuum_map + camera_calibration: true + zones: + - [[15250, 17400, 20050, 21000]] + - [[15000, 20800, 19100, 23950]] + - [[19050, 21050, 23050, 24950]] + - [[17900, 24050, 21550, 28650]] + - [[21600, 25000, 27600, 28800]] + language: se diff --git a/popup/sovrum_tv2.yaml b/popup/sovrum_tv2.yaml index f7209479..d36f3c71 100644 --- a/popup/sovrum_tv2.yaml +++ b/popup/sovrum_tv2.yaml @@ -28,7 +28,7 @@ browser_mod: - entity: script.samsung_tv_energy_saving - - entity: input_select.hdmi2 + - entity: select.hdmi_samsung - type: horizontal-stack cards: diff --git a/popup/studio_dator.yaml b/popup/studio_dator.yaml index 49b9ab65..2527545f 100644 --- a/popup/studio_dator.yaml +++ b/popup/studio_dator.yaml @@ -53,22 +53,22 @@ browser_mod: entity_row: true entities: - - entity: sensor.template_imac_cpu + - entity: sensor.imac_cpu tap_action: action: call-service service: homeassistant.update_entity service_data: - entity_id: sensor.template_imac_cpu + entity_id: sensor.imac_cpu - - entity: sensor.template_imac_mem + - entity: sensor.imac_mem tap_action: action: call-service service: homeassistant.update_entity service_data: - entity_id: sensor.template_imac_mem + entity_id: sensor.imac_mem - entity: automation.macos_notification_motion_hall - - entity: sensor.template_imac_uptime + - entity: sensor.imac_uptime - entity: sensor.template_imac_vpn tap_action: @@ -94,19 +94,19 @@ browser_mod: entity_row: true entities: - - entity: sensor.template_imac_system_ssd + - entity: sensor.imac_system_ssd tap_action: action: call-service service: homeassistant.update_entity service_data: - entity_id: sensor.template_imac_system_ssd + entity_id: sensor.imac_system_ssd - - entity: sensor.template_imac_macintosh_hd + - entity: sensor.imac_macintosh_hd tap_action: action: call-service service: homeassistant.update_entity service_data: - entity_id: sensor.template_imac_macintosh_hd + entity_id: sensor.imac_macintosh_hd - type: horizontal-stack cards: diff --git a/popup/vardagsrum_tv.yaml b/popup/vardagsrum_tv.yaml index 87d67ecc..00926fe4 100755 --- a/popup/vardagsrum_tv.yaml +++ b/popup/vardagsrum_tv.yaml @@ -28,7 +28,7 @@ browser_mod: - entity: automation.tv_on_lights - - entity: input_select.hdmi + - entity: select.hdmi_bravia - type: horizontal-stack cards: diff --git a/secrets [REDACTED].yaml b/secrets [REDACTED].yaml index 894399fb..71a8c1f2 100755 --- a/secrets [REDACTED].yaml +++ b/secrets [REDACTED].yaml @@ -18,8 +18,10 @@ spotify_client_secret: [REDACTED] tibber_token: Bearer [REDACTED] darksky_api_key: [REDACTED] -netdata_host: [REDACTED] -netdata_port: [REDACTED] +xiaomi_vacuum_host: [REDACTED] +xiaomi_vacuum_token: [REDACTED] +xiaomi_cloud_username: [REDACTED] +xiaomi_cloud_password: [REDACTED] github_username: [REDACTED] github_access_token: [REDACTED] @@ -71,6 +73,12 @@ imac_sleep: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USE imac_restart: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sudo /sbin/shutdown -r now imac_ip: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] dig +short myip.opendns.com @resolver1.opendns.com +imac_system_ssd: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df / | awk '{print $5}' | tail -n 1 | cut -d '%' -f1 +imac_macintosh_hd: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] df /Volumes/Macintosh\\ HD | awk '{ print $5 }' | tail -n 1 | cut -d '%' -f1 +imac_cpu: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] top -l 1 | awk '/CPU usage/ {printf("%.1f\n", $3)}' +imac_mem: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] ps -A -o %mem | awk '{ mem += $1} END {print mem}' +imac_uptime: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] sysctl -n kern.boottime | awk '{print $4}' | sed 's/,//g' + monitors_mute_on: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume with output muted"' monitors_mute_off: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "set volume without output muted"' monitors_mute_state: ssh -o StrictHostKeyChecking=no -i /config/.ssh/id_rsa [REDACTED USER@IP] 'osascript -e "output muted of (get volume settings)"' diff --git a/ui-lovelace.yaml b/ui-lovelace.yaml index 891eab8e..269055c7 100755 --- a/ui-lovelace.yaml +++ b/ui-lovelace.yaml @@ -122,6 +122,12 @@ views: - type: custom:button-card entity: media_player.sony_bravia_tv name: Tv + state_display: > + [[[ + if (variables.state == 'playing') { + return 'På'; + } + ]]] hold_action: !include popup/vardagsrum_tv.yaml template: