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