Advertisement
famaia

Home Assistant Config

Jan 31st, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 15.36 KB | None | 0 0
  1. homeassistant:
  2.  # Name of the location where Home Assistant is running
  3.   name: Casa
  4.   # Location required to calculate the time the sun rises and sets
  5.   latitude: !secret zone_home_lat
  6.   longitude: !secret zone_home_long
  7.   # Impacts weather/sunrise data (altitude above sea level in meters)
  8.   elevation: 39
  9.   # metric for Metric, imperial for Imperial
  10.   unit_system: metric
  11.   # Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  12.   time_zone: Europe/Lisbon
  13.  
  14.  
  15.   # https://materialdesignicons.com
  16.   customize:
  17.     sun.sun:
  18.       friendly_name: Sol
  19.     sensor.badlogin:
  20.       friendly_name: 'Bad Logins'
  21.      
  22.     # Date & Time
  23.     sensor.date:
  24.       friendly_name: Data
  25.     sensor.time:
  26.       friendly_name: Hora
  27.  
  28.     group.Quarto_Adultos:
  29.       friendly_name: 'Quarto Adultos'
  30.     group.Quarto_Kids:
  31.       friendly_name: 'Quarto Kids'
  32.     group.tab_definicoes:
  33.       friendly_name: 'Definições'
  34.     group.AC_Info:
  35.       friendly_name: 'Ar condicionado'
  36.     group.AC_Settings:
  37.       friendly_name: 'Ar condicionado'
  38.     group.automacoes:
  39.       friendly_name: 'Automações'
  40.     input_slider.slider_temp_min:
  41.         friendly_name: 'Mínima'
  42.         icon: mdi:arrow-down-bold-circle-outline
  43.     input_slider.slider_temp_max:
  44.         friendly_name: 'Máxima'
  45.         icon: mdi:arrow-up-bold-circle-outline
  46.  
  47.        
  48.     # Xiaomi Gateway
  49.     sensor.temperature_158d00010bedca:
  50.       friendly_name: 'Temperatura'
  51.     sensor.humidity_158d00010bedca:
  52.       friendly_name: 'Humidade'
  53.       icon: mdi:water-percent
  54.     binary_sensor.magnet_158d00010026a9:
  55.       friendly_name: 'Porta'
  56.       icon: mdi:glassdoor
  57.     binary_sensor.motion_158d000129355b:
  58.       friendly_name: 'Movimento'
  59.       icon: mdi:run-fast
  60.      
  61.     # Weather Underground
  62.     sensor.PWS_weather:
  63.       friendly_name: 'Estado'
  64.     sensor.PWS_precip_1hr_metric:
  65.       friendly_name: 'Chuva'
  66.       icon: mdi:weather-rainy
  67.     sensor.PWS_temp_c:
  68.       friendly_name: 'Temperatura'
  69.     sensor.PWS_relative_humidity:
  70.       friendly_name: 'Humidade'
  71.       icon: mdi:water-percent
  72.  
  73.      
  74.     # Speedtest
  75.     sensor.speedtest_download:
  76.       friendly_name: 'WAN Download Speed'
  77.     sensor.speedtest_upload:
  78.       friendly_name: 'WAN Upload Speed'
  79.     sensor.speedtest_ping:
  80.       friendly_name: 'WAN Ping'
  81.    
  82.     # MEWaGO
  83.     sensor.geral_kwh:
  84.       friendly_name: 'Consumo energia'
  85.       icon: mdi:power-plug
  86.     sensor.cpu_hass:
  87.       friendly_name: 'BLUE CPU %'
  88.  
  89.  
  90.       # GPIO
  91.     switch.bomba:
  92.       icon: mdi:oil-temperature
  93.     switch.ventiladores:
  94.       icon: mdi:air-conditioner
  95.  
  96.     # Devices
  97.     switch.gray:
  98.       icon: mdi:desktop-tower
  99.     switch.green:
  100.       icon: mdi:desktop-tower
  101.     device_tracker.nexus_6p:
  102.       hidden: true
  103.  
  104.     input_boolean.aquecimento_nocturno:
  105.       friendly_name: 'Aquecimento nocturno'
  106.  
  107.     zone.escola_lara:
  108.       friendly_name: 'Escola Lara'
  109.     zone.escola_eva:
  110.       friendly_name: 'Escola Eva'
  111.     zone.escola_simao:
  112.       friendly_name: 'Escola Simão'
  113.  
  114.  
  115.  
  116.      
  117. # Show links to resources in log and frontend
  118. # introduction:
  119.  
  120. # Enables the frontend
  121. frontend:
  122. http:
  123.  # Uncomment this to add a password (recommended!)
  124.   api_password: !secret http_password
  125.   server_port: 443
  126.   ssl_certificate: /etc/letsencrypt/live/famaia.ddns.net/fullchain.pem
  127.   ssl_key: /etc/letsencrypt/live/famaia.ddns.net/privkey.pem
  128.   ip_ban_enabled: True
  129.   login_attempts_threshold: 5
  130.  
  131. logger:
  132.   default: info
  133.   logs:
  134.     homeassistant.components.http: warning
  135.    
  136.    
  137. # Checks for available updates
  138. updater:
  139. # Discover some devices automatically
  140. discovery:
  141. # Allows you to issue voice commands from the frontend in enabled browsers
  142. conversation:
  143. # Enables support for tracking state changes over time.
  144. history:
  145. # View all events in a logbook
  146. logbook:
  147. # Track the sun
  148. sun:
  149. # Text to speech
  150. tts:
  151.   platform: google
  152.  
  153. # MySQL Database
  154. recorder:
  155.   db_url: !secret db_url
  156.  
  157.  
  158. mqtt:
  159.   broker: m20.cloudmqtt.com
  160.   port: 29716
  161.   username: !secret mqtt_username
  162.   password: !secret mqtt_password
  163.  
  164.  
  165.  
  166.  
  167. ####################################################################################
  168. ### Web Links
  169. ####################################################################################
  170.  
  171.  
  172. weblink:
  173.   entities:
  174.     - name: Router Linksys
  175.       url: https://10.12.12.253
  176.  
  177. ####################################################################################
  178. ### Sensors
  179. ####################################################################################
  180.  
  181. sensor datetime:
  182.   - platform: time_date
  183.     display_options:
  184.      - 'date'
  185.       - 'time'
  186.      
  187. sensor speedtest:
  188.   - platform: speedtest
  189.     monitored_conditions:
  190.      - ping
  191.       - download
  192.       - upload
  193.      
  194. sensor wunderground:
  195.   - platform: wunderground
  196.     api_key: !secret wunderground
  197.     monitored_conditions:
  198.      - relative_humidity
  199.       - temp_c
  200.       - weather
  201.       - precip_1hr_metric
  202. #      - location
  203. #      - feelslike_c
  204.  
  205. sensor pi_hole:
  206.   - platform: pi_hole
  207.  
  208. sensor geral_kwh:
  209.   - platform: command_line
  210.     name: Geral kWh
  211.     command: "/opt/maia/hass_energy"
  212.     unit_of_measurement: "kWh"
  213.      
  214.  
  215. sensor bad_attempt:
  216.   - platform: command_line
  217.     name: badlogin
  218.     command: grep -c 'Login attempt' /root/.homeassistant/home-assistant.log      
  219.  
  220.    
  221. sensor cpu_hass:
  222.   - platform: command_line
  223.     name: CPU HASS
  224.     command: '/opt/maia/hass_cpu'
  225.     unit_of_measurement: "%"
  226.  
  227.  
  228.    
  229.  
  230.      
  231. ####################################################################################
  232. ### Zones
  233. ### Get coordinates at http://www.gps-coordinates.net
  234. ####################################################################################
  235.  
  236. zone zone_deec:
  237.   name: DEEC
  238.   latitude: !secret zone_deec_lat
  239.   longitude: !secret zone_deec_long
  240.   radius: 200
  241.   icon: mdi:worker
  242.  
  243. zone zone_isec:
  244.   name: ISEC
  245.   latitude: !secret zone_isec_lat
  246.   longitude: !secret zone_isec_long
  247.   radius: 150
  248.   icon: mdi:worker
  249.  
  250. zone zone_escola_lara:
  251.   name: escola_lara
  252.   latitude: !secret zone_lara_lat
  253.   longitude: !secret zone_lara_long
  254.   radius: 150
  255.   icon: mdi:school
  256.  
  257. zone zone_escola_eva:
  258.   name: escola_eva
  259.   latitude: !secret zone_eva_lat
  260.   longitude: !secret zone_eva_long
  261.   radius: 150
  262.   icon: mdi:school
  263.  
  264. zone zone_escola_simao:
  265.   name: escola_simao
  266.   latitude: !secret zone_simao_lat
  267.   longitude: !secret zone_simao_long
  268.   radius: 150
  269.   icon: mdi:school
  270.  
  271.  
  272. ####################################################################################
  273. ### Notifications
  274. ####################################################################################
  275.  
  276. notify:
  277.   - name: famaia
  278.     platform: simplepush
  279.     device_key: !secret simplepush
  280.    
  281.  
  282. ####################################################################################
  283. ### Devices
  284. ####################################################################################
  285.  
  286. device_tracker:
  287.   - platform: ping
  288.     hosts:
  289.       Nexus_6P: 10.12.12.21
  290.   - platform: owntracks
  291.     max_gps_accuracy: 200
  292.     waypoints: True
  293.     waypoint_whitelist:
  294.      - jon
  295.       - ram
  296.  
  297.  
  298. switch:
  299.   - platform: rpi_gpio
  300.     ports:
  301.       17: Bomba
  302.       27: Ventiladores
  303.    
  304.      
  305. light:
  306.   - platform: yeelight
  307.     devices:
  308.       10.12.12.41:
  309.         name: Lâmpada Sala
  310.        
  311. aqara:
  312.    gateway_password: !secret xiaomi_home_gateway
  313.  
  314. # Wan on LAN
  315. switch pc_gray:
  316.   - platform: wake_on_lan
  317.     name: "GRAY"
  318.     mac_address: "00-23-54-35-5E-3B"
  319.     host: 10.12.12.1
  320.    
  321. switch pc_green:
  322.   - platform: wake_on_lan
  323.     name: "GREEN"
  324.     mac_address: "00-24-21-7A-A8-8B"
  325.     host: 10.12.12.10  
  326.  
  327.  
  328.    
  329. ####################################################################################
  330. ### Virtual Inputs
  331. ####################################################################################
  332.  
  333. input_boolean:
  334.   aquecimento_nocturno:
  335.     name: aquecimento_nocturno
  336.     initial: on
  337.     icon: mdi:weather-night
  338.    
  339.    
  340. input_slider:
  341.   slider_temp_min:
  342.     name: Temperatura_Minima
  343.     initial: 18
  344.     min: 17
  345.     max: 23
  346.     step: 0.5
  347.  
  348.   slider_temp_max:
  349.     name: Temperatura_Maxima
  350.     initial: 20
  351.     min: 17
  352.     max: 23
  353.     step: 0.5
  354.  
  355.    
  356. sensor ac_state_min:
  357.   - platform: template
  358.     sensors:
  359.       ac_state_min:
  360.         value_template: '{{ states.input_slider.slider_temp_min.state }}'
  361.         friendly_name: 'Setpoint Mínimo'
  362.         unit_of_measurement: 'ºC'
  363.        
  364. sensor ac_state_max:
  365.   - platform: template
  366.     sensors:
  367.       ac_state_max:
  368.         value_template: '{{ states.input_slider.slider_temp_max.state }}'
  369.         friendly_name: 'Setpoint Máximo'
  370.         unit_of_measurement: 'ºC'
  371.  
  372.        
  373. ####################################################################################
  374. ### Groups
  375. ####################################################################################
  376.  
  377. group:
  378.   default_view:
  379.     view: yes
  380.     entities:
  381.      - device_tracker.twbghzzp_maianexus6p
  382.       - device_tracker.twbghzzp_patuxaa5
  383.       - group.Geral
  384.       - group.Rua
  385.       - group.AC_Info
  386.       - group.Sala
  387.       - group.Quarto_Adultos
  388.       - group.Quarto_Kids
  389.       - group.Hall
  390.       - group.Garagem
  391.   Servidor:
  392.     name: 'Definições'
  393.     view: yes
  394.     entities:
  395.      - sensor.cpu_hass
  396.       - sensor.badlogin
  397.       - sensor.speedtest_download
  398.       - sensor.speedtest_upload
  399.       - sensor.speedtest_ping
  400.       - sensor.pihole
  401.       - group.Automacoes
  402.       - group.Devices
  403.       - group.AC_Settings
  404.   Devices:
  405.    - weblink.Router_Linksys
  406.   Geral:
  407.    - sensor.date
  408.     - sensor.time
  409.     - sensor.geral_kwh
  410.   Rua:
  411.    - sun.sun
  412.     - sensor.PWS_weather
  413.     - sensor.PWS_temp_c
  414.     - sensor.PWS_relative_humidity
  415.     - sensor.PWS_precip_1hr_metric
  416.   AC_Info:
  417.    - switch.Bomba
  418.     - switch.Ventiladores
  419.     - sensor.ac_state_min
  420.     - sensor.temperature_158d00010bedca
  421.     - sensor.ac_state_max
  422.   AC_Settings:
  423.    - input_slider.slider_temp_min
  424.     - sensor.temperature_158d00010bedca
  425.     - input_slider.slider_temp_max
  426.   Sala:
  427.    - light.Lampada_Sala
  428.     - sensor.temperature_158d00010bedca
  429.     - sensor.humidity_158d00010bedca
  430. #    - switch.switch_one_click_158d00013e4c7f
  431.   Quarto_Kids:
  432.    - binary_sensor.motion_158d000129355b
  433.   Quarto_Adultos:
  434.    - media_player.Quarto
  435.   Hall:
  436.    - binary_sensor.magnet_158d00010026a9
  437.   Garagem:
  438.    - switch.gray
  439.     - switch.green
  440.   Automacoes:
  441.    - input_boolean.aquecimento_nocturno
  442.  
  443.    
  444. ####################################################################################
  445. ### Scenes
  446. ####################################################################################
  447.  
  448. scene:
  449.   - name: AC_On
  450.     entities:
  451.       switch.bomba:
  452.         state: on
  453.       switch.ventiladores:
  454.         state: on
  455.   - name: AC_Off
  456.     entities:
  457.       switch.bomba:
  458.         state: on
  459.       switch.ventiladores:
  460.         state: on
  461.  
  462.  
  463. ####################################################################################
  464. ### Automation
  465. ####################################################################################
  466.  
  467. automation:
  468.   - alias: 'Update Available Notifications'
  469.     trigger:
  470.       platform: state
  471.       entity_id: updater.updater
  472.     action:
  473.       service: notify.famaia
  474.       data:
  475.         message: 'Update for Home Assistant is available.'
  476.      
  477.   - alias: 'Em casa. Muito frio'
  478.     hide_entity: true
  479.     trigger:
  480.       platform: template
  481.       value_template: "{% if (states.sensor.temperature_158d00010bedca.state < states.input_slider.slider_temp_min.state) %}true{% endif %}"
  482.     condition:
  483.       condition: and
  484.       conditions:
  485.         - condition: time
  486.           after: '08:01:00'
  487.           before: '23:59:00'      
  488.         - condition: state
  489.           entity_id: switch.Bomba
  490.           state: 'off'
  491.         - condition: or
  492.           conditions:
  493.             - condition: state
  494.               entity_id: 'device_tracker.twbghzzp_maianexus6p'
  495.               state: 'home'
  496.             - condition: state
  497.               entity_id: 'device_tracker.twbghzzp_patuxaa5'
  498.               state: 'home'
  499.     action:
  500.       - service: switch.turn_on
  501.         entity_id: switch.bomba
  502.       - service: switch.turn_on
  503.         entity_id: switch.ventiladores
  504.       - service: notify.famaia
  505.         data:
  506.           message: 'Em casa e temperatura < setpoint {{ states.input_slider.slider_temp_min.state | float }}º, ligando ar condicionado.'
  507.          
  508.   # Aquecimento concluído, dentro ou fora de casa, a qualquer hora
  509.   - alias: 'Aquecimento concluido'
  510.     hide_entity: true
  511.     trigger:
  512.       platform: template
  513.       value_template: "{% if (states.sensor.temperature_158d00010bedca.state > states.input_slider.slider_temp_max.state) %}true{% endif %}"
  514.     condition:
  515.       - condition: state
  516.         entity_id: switch.Bomba
  517.         state: 'on'
  518.     action:
  519.       - service: switch.turn_off
  520.         entity_id: switch.bomba
  521.       - service: switch.turn_off
  522.         entity_id: switch.ventiladores
  523.       - service: notify.famaia
  524.         data:
  525.           message: 'Temperatura > setpoint {{ states.input_slider.slider_temp_max.state | float }}º, desligando ar condicionado.'
  526.          
  527.   - alias: 'Nocturno. Muito frio'
  528.     hide_entity: true
  529.     trigger:
  530.       platform: template
  531.       value_template: "{% if (states.sensor.temperature_158d00010bedca.state < states.input_slider.slider_temp_min.state) %}true{% endif %}"
  532.     condition:
  533.       condition: and
  534.       conditions:
  535.         - condition: state
  536.           entity_id: switch.Bomba
  537.           state: 'off'
  538.         - condition: state
  539.           entity_id: input_boolean.aquecimento_nocturno
  540.           state: 'on'
  541.         - condition: time
  542.           after: '00:00:00'
  543.           before: '08:00:00'
  544.     action:
  545.       - service: switch.turn_on
  546.         entity_id: switch.bomba
  547.       - service: switch.turn_on
  548.         entity_id: switch.ventiladores
  549.       - service: notify.famaia
  550.         data:
  551.           message: 'Aquecimento nocturno activo e temperatura < setpoint {{ states.input_slider.slider_temp_min.state | float }}º, ligando ar condicionado.'
  552.  
  553.   - alias: 'Patuxa na Escola da Lara'
  554.     trigger:
  555.       platform: zone
  556.       entity_id: device_tracker.twbghzzp_patuxaa5
  557.       zone: zone.escola_lara
  558.       event: enter
  559.     action:
  560.       - service: notify.famaia
  561.         data:
  562.           message: 'Patuxa está na Escola da Lara'
  563.   - alias: 'Patuxa na Escola da Eva'
  564.     trigger:
  565.       platform: zone
  566.       entity_id: device_tracker.twbghzzp_patuxaa5
  567.       zone: zone.escola_eva
  568.       event: enter
  569.     action:
  570.       - service: notify.famaia
  571.         data:
  572.           message: 'Patuxa está na Escola da Eva'
  573.   - alias: 'Patuxa na Escola do Simao'
  574.     trigger:
  575.       platform: zone
  576.       entity_id: device_tracker.twbghzzp_patuxaa5
  577.       zone: zone.escola_simao
  578.       event: enter
  579.     action:
  580.       - service: notify.famaia
  581.         data:
  582.           message: 'Patuxa está na Escola do Simão'
  583.  
  584.   - alias: 'Sala | Switch Long Pressed'
  585.     trigger:
  586.       platform: state
  587.       entity_id: switch.switch_long_press_158d00013e4c7f
  588.       to: 'on'
  589.     condition:
  590.       - condition: state
  591.         entity_id: switch.Bomba
  592.         state: 'off'
  593.     action:
  594.       - service: scene.turn_on
  595.         entity_id: scene.AC_on
  596.       - service: notify.famaia
  597.         data:
  598.           message: 'Botão sala pressionado longamente, ligando ar condicionado.'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement