Advertisement
skysurf_hf

Config. energy

Jan 1st, 2019
963
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 12.51 KB | None | 0 0
  1. homeassistant:
  2.  # Name of the location where Home Assistant is running
  3.   name: Home
  4.   # Location required to calculate the time the sun rises and sets
  5.   latitude: !secret latitude
  6.   longitude: !secret longitude
  7.   # Impacts weather/sunrise data (altitude above sea level in meters)
  8.   elevation: 84
  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. ## WHITELIST
  16.   whitelist_external_dirs:
  17.    - '/home/homeassistant/.homeassistant/script'
  18.     - '/home/homeassistant/.homeassistant/tts'
  19.     - '/home/pi/certbot'
  20.  
  21.   auth_providers: #combustiveis nao dar erro
  22.     - type: homeassistant
  23.     - type: legacy_api_password
  24.     - type: trusted_networks
  25.  
  26. # Customization file
  27.   customize: !include customize.yaml
  28.  
  29. # Show links to resources in log and frontend
  30. #introduction:
  31. api:
  32. # Enables the frontend
  33. frontend:
  34. # Enables configuration UI
  35. #ffmpeg:
  36.  # ffmpeg_bin: /usr/bin/ffmpeg
  37. http:
  38.  # Secrets are defined in the file secrets.yaml
  39.   # api_password: !secret http_password
  40.  
  41.   # Uncomment this if you are using SSL/TLS, running in Docker container, etc.
  42.   # base_url: example.duckdns.org:8123
  43.  
  44.   api_password: !secret http_password
  45.   ssl_certificate: /etc/letsencrypt/live/skysurf.duckdns.org/fullchain.pem
  46.   ssl_key: /etc/letsencrypt/live/skysurf.duckdns.org/privkey.pem
  47.   ip_ban_enabled: True
  48.   base_url: !secret meu_dns
  49.   login_attempts_threshold: 5
  50.   trusted_networks:
  51.        - 127.0.0.1
  52.         - 192.168.1.0/24
  53.  
  54. # Checks for available updates
  55. # Note: This component will send some information about your system to
  56. # the developers to assist with development of Home Assistant.
  57. # For more information, please see:
  58. # https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
  59. updater:
  60.  # Optional, allows Home Assistant developers to focus on popular components.
  61.   include_used_components: true
  62.  
  63. # Discover some devices automatically
  64. discovery:
  65.  
  66. # Enables support for tracking state changes over time
  67. history:
  68. # View all events in a logbook
  69. logbook:
  70. # Enables a map showing the location of tracked devices
  71. map:
  72. # Track the sun
  73. sun:
  74. #notificaçao
  75. notify:
  76.   - platform: pushbullet
  77.     name: noti_pushbullet
  78.     api_key: !secret API_Notificaao_pushbullet
  79. #html5 notificaçao  
  80.   - name: html5_notificaçao_chrome
  81.     platform: html5
  82.     gcm_api_key: !secret API_Notificao_gcm-server-key
  83.     gcm_sender_id: !secret API_Notificao_gcm-sender-id
  84.    
  85.  
  86. # Weather prediction
  87.  
  88. ############# SENSORES: ########
  89.  
  90. sensor:
  91.   - platform: yr
  92.   - platform: command_line
  93.     name: Dias para o certificado SSL expirar
  94.     unit_of_measurement: days
  95.     scan_interval: 10800
  96.     command: "ssl-cert-check -b -c /etc/letsencrypt/live/skysurf.duckdns.org/cert.pem | awk '{ print $NF }'"
  97.  
  98.   - platform: mqtt
  99.     state_topic: "zanzito/skysurf_phone/battery_level"
  100.     name: "Bateria Telemovel SkySurf"
  101.     unit_of_measurement: '%'
  102.     retain: true
  103.    
  104.   - platform: template
  105.     sensors:
  106.       skysurf_phone:
  107.         friendly_name: 'Estado skysurf'
  108.         value_template: >
  109.          {%- if is_state('device_tracker.skysurf_phone', 'not_home') -%}
  110.            Ausente
  111.           {%- endif -%}
  112.           {%- if is_state('device_tracker.skysurf_phone', 'home') -%}
  113.            Em Casa
  114.           {%- endif -%}      
  115.           {%- if is_state('device_tracker.skysurf_phone', 'notrabalho') -%}
  116.            No Trabalho
  117.           {%- endif -%}  
  118.    
  119.   #- platform: time_date
  120.  
  121.   - platform: version
  122.  
  123.   - platform: rest
  124.     name: "Last version"
  125.     resource: https://pypi.python.org/pypi/homeassistant/json
  126.     value_template: '{{ value_json.info.version }}'
  127.     scan_interval: 3600    
  128.  
  129. ############# RASPBERRY PI SENSORS #############
  130.  
  131.   - platform: systemmonitor
  132.     resources:
  133.       - type: disk_use
  134.         arg: /home
  135.       - type: disk_free
  136.         arg: /home
  137.       - type: processor_use
  138.       - type: last_boot
  139.       - type: since_last_boot
  140.       - type: memory_use
  141.       - type: memory_use_percent
  142.  
  143.  
  144.   - platform: command_line
  145.     name: CPU Temp
  146.     command: "cat /sys/class/thermal/thermal_zone0/temp"
  147.     unit_of_measurement: "°C"
  148.     value_template: '{{ value | multiply(0.001) | round(0) }}'
  149.  
  150. ############### SENSORES TOMADA INTELIGENTE DESUDIMIFICADOR #######
  151.  
  152.   - platform: mqtt
  153.     name: "Power"
  154.     state_topic: "tele/tomada_1_consu/SENSOR"
  155.     value_template: "{{ value_json.ENERGY.Power }}"
  156.     unit_of_measurement: "W"
  157.     icon: mdi:power-plug
  158.  
  159.   - platform: mqtt
  160.     name: "Voltage"
  161.     state_topic: "tele/tomada_1_consu/SENSOR"
  162.     value_template: "{{ value_json.ENERGY.Voltage }}"
  163.     unit_of_measurement: "V"
  164.     icon: mdi:flash
  165.  
  166.   - platform: mqtt
  167.     name: "Current"
  168.     state_topic: "tele/tomada_1_consu/SENSOR"
  169.     value_template: "{{ value_json.ENERGY.Current }}"
  170.     unit_of_measurement: "A"
  171.     icon: mdi:power-socket
  172.  
  173.  
  174.   - platform: mqtt
  175.     name: "Energy today"
  176.     state_topic: "tele/tomada_1_consu/SENSOR"
  177.     value_template: "{{ value_json.ENERGY.Today }}"
  178.     unit_of_measurement: "kWh"
  179.     icon: mdi:power-socket-eu
  180.  
  181.   - platform: mqtt
  182.     name: "Energy yesterday"
  183.     state_topic: "tele/tomada_1_consu/SENSOR"
  184.     value_template: "{{ value_json.ENERGY.Yesterday }}"
  185.     unit_of_measurement: "kWh"
  186.     icon: mdi:power-socket-eu
  187.  
  188.   - platform: mqtt
  189.     name: "Energy total"
  190.     state_topic: "tele/tomada_1_consu/SENSOR"
  191.     value_template: "{{ value_json.ENERGY.Total }}"
  192.     unit_of_measurement: "kWh"
  193.     icon: mdi:power-socket-eu
  194.  
  195.   - platform: mqtt
  196.     name: "Power Factor"
  197.     state_topic: "tele/tomada_1_consu/SENSOR"
  198.     value_template: "{{ value_json.ENERGY.Factor }}"
  199.     icon: mdi:percent
  200.  
  201.  # - platform: mqtt
  202.   #  name: "Temp"
  203.    # state_topic: "tele/sonoff/SENSOR"
  204.    # value_template: "{{ value_json.DS18B20.Temperature }}"
  205.    # unit_of_measurement: "°C"
  206.    # icon: mdi:thermometer
  207.  
  208. #############   medir energia em € ####################  
  209.   - platform: utility_meter
  210.     name: Electricidade
  211.     cycle: monthly
  212.     source: sensor.energy
  213.  
  214. ###### SWITCH TOMADA SONOFF DESUMIFICADOR ############
  215.  
  216. switch:
  217.   - platform: mqtt
  218.     name: "tomada 1 consumos sonoff"
  219.     state_topic: "stat/tomada_1_consu/POWER"
  220.     command_topic: "cmnd/tomada_1_consu/power"
  221.     availability_topic: "tele/tomada_1_consu/LWT"
  222.     payload_available: "Online"
  223.     payload_not_available: "Offline"
  224.     qos: 1
  225.     payload_on: "ON"
  226.     payload_off: "OFF"
  227.     retain: true  
  228.  
  229. ################### PREÇO COMBUSTIVEIS HA ####################
  230. #combustiveis
  231. shell_command:
  232. #test: touch /home/homeassistant/.homeassistant/hassteste.txt
  233.  # correr_combustiveis: 'bash /home/homeassistant/.homeassistant/script/fuel_info.sh -f "184685"'
  234. ######### som polly:
  235.   #play_sound: 'sudo /usr/bin/omxplayer /home/homeassistant/.homeassistant/tts/cf5fc48cf182c32ecfe3d12239125929c313b8fd_pt-pt_3358069112_amazon_polly.mp3'
  236.   # já da som na coluna é preciso ter o kodi ligado (mxplayer)
  237.  
  238. # renovar certificado automaticamente:
  239.   #renew_ssl: '/home/pi/certbot/certbot-auto renew --quiet --no-self-upgrade --standalone --preferred-challenges tls-sni-01 --tls-sni-01-port 8123 --pre-hook "sudo systemctl stop home-assistant@homeassistant.service" --post-hook "sudo systemctl start home-assistant@homeassistant.service"'
  240.   renew_ssl: 'bash /home/pi/certbot/certbot-auto renew --verbose --no-self-upgrade --standalone --preferred-challenges tls-sni-01 --tls-sni-01-port 8123 --pre-hook "sudo systemctl stop home-assistant@homeassistant.service" --post-hook "sudo systemctl start home-assistant@homeassistant.service"'
  241.  
  242. # update automatico do ha:
  243.   scriptupdate_ha: 'bash /home/homeassistant/.homeassistant/script/update_ha.sh'    
  244. # Text to speech
  245. tts:
  246.   - platform: google
  247.     #languague: PT
  248.  
  249.   - platform: amazon_polly
  250.     aws_access_key_id: !secret pooly_id
  251.     aws_secret_access_key: !secret polly_password
  252.     text_type: ssml
  253.     voice: Cristiano
  254.     #voice: Ines  #PT VOZES
  255.  
  256.  
  257. # Example base configuration.yaml entry
  258. conversation:
  259.  
  260. # Cloud
  261. cloud:
  262. group: !include groups.yaml
  263. #automation: !include automations.yaml
  264. script: !include scripts.yaml
  265. #sensor: !include sensors.yaml
  266.  
  267. #UTILIZAÇAO DO PACKAGE:
  268. #homeassistant:
  269. #  packages: !include_dir_named packages/
  270.   #config:
  271.  
  272. ############# MQTT: ########
  273.  
  274. mqtt:
  275.   broker: 127.0.0.1
  276.   discovery: true
  277.   discovery_prefix: homeassistant
  278.  
  279.   birth_message: #mqtt pen zinbee
  280.     topic: 'hass/status'
  281.     payload: 'online'
  282.   will_message:
  283.     topic: 'hass/status'
  284.     payload: 'offline'
  285.  
  286.  
  287. light:
  288.   - platform: yeelight
  289.     devices:
  290.       192.168.1.70:
  291.         name: Quarto Skysurf
  292.         use_music_mode: True #(defaults to False - True will help keep the communications open)
  293.         save_on_change: True #(defaults to True)
  294.        
  295.       192.168.1.69:
  296.         name: Quarto Cristina
  297.         use_music_mode: True #(defaults to False - True will help keep the communications open)
  298.         save_on_change: True #(defaults to True)
  299.        
  300.       192.168.1.111:
  301.         name: LedstripSala
  302.         use_music_mode: True #(defaults to False - True will help keep the communications open)
  303.         save_on_change: True #(defaults to True)
  304.  
  305. ## Example configuration.yaml entry
  306. #media_player:
  307.  
  308.  
  309. ############# MEDIA PLAYERS: ########
  310.  
  311.  
  312. ######   kodi:
  313. media_player:
  314.   - platform: kodi
  315.     host: 192.168.1.67 #telemovel s2
  316.     name: kodi
  317.     port: 8080
  318.     username: !secret kodi_user
  319.     password: !secret kodi_password
  320.     #turn_off_action: hibernate
  321.     method: System.Hibernate
  322.    
  323. ###########samsung tv media player
  324.   - platform: samsungtv
  325.     host: 192.168.1.50
  326.     port: 8001
  327.     mac: 40:16:3B:C8:7E:D9
  328.  
  329. ############# MEDIA PLAYER ALEXA: ########
  330.  
  331.   - platform: alexa
  332.     email: !secret email_alexa_amaz
  333.     password: !secret password_alexa
  334.     url: amazon.com
  335.    
  336.    
  337. automation: !include automations.yaml
  338.  
  339. ############# ZONAS: ########
  340.  
  341. zone:
  342.  - name: home
  343.    latitude: !secret latitude
  344.    longitude: !secret longitude
  345.    radius: 50
  346.    icon: mdi:home
  347.  
  348.  - name: notrabalho
  349.    latitude: !secret latitude_meutrabalho
  350.    longitude: !secret longitude_meutrabalho
  351.    radius: 200
  352.    icon: mdi:airplane
  353.  
  354. device_tracker:
  355.  
  356.   - platform: mqtt_json
  357.     devices:
  358.      skysurf_phone: zanzito/skysurf_phone/location
  359.     track_new_devices: True
  360.     interval_seconds: 10
  361.     consider_home: 20
  362.  
  363. config:
  364. ############# CAMERAS: ########
  365.  
  366. camera:
  367.  
  368.   - name: skysurf_cam
  369.     platform: generic
  370.     still_image_url: https://maps.googleapis.com/maps/api/staticmap?center={{ states.device_tracker.skysurf_phone.attributes.latitude }},{{ states.device_tracker.skysurf_phone.attributes.longitude }}&zoom=16&size=500x500&maptype=roadmap&markers=color:green%7Clabel:JA%7C{{ states.device_tracker.skysurf_phone.attributes.latitude }},{{ states.device_tracker.skysurf_phone.attributes.longitude }}&key=AIzaSyCi9RxsJfpO6hMEDUOVLbTqVAhOtfnLBfI
  371.     limit_refetch_to_url_change: true  
  372.  
  373. #camera:
  374. #  - platform: ffmpeg
  375.     #input: http://192.168.1.105:5000/onvif/device_service
  376.  #   input: rtsp://192.168.1.105:554/onvif1
  377.  #a FUNCIONAR:
  378.    # input: rtsp://192.168.1.105:554/onvif1                     FUNCIONA  ... ESTE
  379.     #input: -rtsp_transport tcp -i rtsp://192.168.1.105:554/onvif1
  380.   #- platform: onvif
  381.     #host: 192.168.1.105
  382.     #host: http://192.168.1.105:5000/onvif/device_service
  383.     #username: "@gmail.com"
  384.     #password: "*******"
  385.     #port: 554
  386.     #port: 5000
  387. #    name: Camera Loureço quarto
  388.  
  389.  
  390. ###################  RECORDER É O QUE GRAVA E NAO GRAVA NA BASE DE DADOS ###########
  391. #recorder:  ## https://www.home-assistant.io/components/recorder/
  392.  # purge_keep_days: 5      #GUARDA DURANTE 5 DIAS...
  393.  # exclude:      #  NAO GUARDA OS DOMINIOS E ENTIDADES:  
  394.  #   domains:
  395.  #     - automation
  396.  #     - updater
  397.  #     - systemmonitor
  398.   #  entities:
  399.   #    - sun.sun # Don't record sun data
  400.       #- sensor.last_boot # Comes from 'systemmonitor' sensor platform
  401.   #    - sensor.last_boot
  402.   ##    - sensor.processor_use
  403.    #   - sensor.CPU_Temp
  404.    #   - sensor.cpu_temperature
  405.     #  - sensor.disk_free_home
  406.     #  - sensor.disk_use_home
  407.      # - sensor.memory_use_percent
  408.      # - sensor.dias_para_o_certificado_ssl_expirar
  409.  
  410.   #include:  #GRAVA NA BASE DE DADOS:
  411.   #  domains:
  412.   #    - sensor
  413.   #    - switch
  414.  
  415. panel_iframe: #### MOSTRAR PAINEL DO LADO ESQ. NODE RED...
  416.   nodered:
  417.     title: 'Node-Red'
  418.     icon: 'mdi:shuffle-variant'
  419.     #url: 'http://192.168.1.100:1880/'
  420.     url: 'https://skysurf.duckdns.org:1880/'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement