Configuración Inicial

This commit is contained in:
dfcarvajal
2019-04-17 09:36:19 +00:00
commit 2d46ec2369
26 changed files with 1149 additions and 0 deletions

20
.gitignore vendored Normal file
View File

@@ -0,0 +1,20 @@
*
# Lista blanca
!*.yaml
!*.yaml_disable
!.gitignore
!*.md
!www
!www/**
!packages
# Folders ignoradas.
.storage
.cloud
.google.token
# Fijamos las que queremos ignorar por credenciales
ip_bans.yaml
secrets.yaml
known_devices.yaml

92
automations.yaml Normal file
View File

@@ -0,0 +1,92 @@
- id: '1548745063240'
alias: Persianas
trigger:
# - event: sunrise
# offset: 01:00:00
# platform: sun
- event: sunset
offset: 00:15:00
platform: sun
condition: []
action:
- data:
entity_id:
- cover.persina_habitacion_principal
- cover.persina_habitacion_noha
- cover.persina_habitacion_mia
- cover.persina_habitacion_estudio
- cover.persina_salon_fase_dos
- cover.persina_salon_piscina
service: cover.close_cover
initial_state: 'on'
- id: '1550093153747'
alias: TEST - Notificaciones
trigger:
- entity_id: binary_sensor.movimiento_habitacion_estudio
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data:
message: saliendo de casa
service: notify.telegram_diego
- id: '1550094029238'
alias: Notificación a Isabel saliendo de casa al trabajo
initial_state: 'on'
trigger:
- entity_id: binary_sensor.puerta_entrada
from: 'off'
platform: state
to: 'on'
condition:
- after: 06:00
condition: time
- before: 06:25
condition: time
- condition: state
entity_id: binary_sensor.workday_sensor
state: 'on'
action:
- data:
message: Diego esta saliendo de casa
service: notify.telegram_isabel
- id: '1551289584925'
alias: Luz del Tendedero Encender
trigger:
- entity_id: binary_sensor.puerta_tendedero
from: 'off'
platform: state
to: 'on'
condition:
condition: or
conditions:
- condition: sun
after: sunset
- condition: sun
before: sunrise
action:
- service: homeassistant.turn_on
data:
entity_id:
- light.luz_tendedero
data_template:
brightness_pct: "{% if 7 < now().strftime('%H')|int and now().strftime('%H')|int\
\ < 23 -%}\n 40\n{%- else -%}\n 80\n{%- endif %}\n"
initial_state: 'on'
- id: '1551289639270'
alias: Luz del Tendedero Apagar
initial_state: 'on'
trigger:
- entity_id: binary_sensor.puerta_tendedero
from: 'on'
platform: state
to: 'off'
condition:
- condition: state
entity_id: light.luz_tendedero
state: 'on'
action:
- data:
entity_id: light.luz_tendedero
service: light.turn_off

379
configuration.yaml Normal file
View File

@@ -0,0 +1,379 @@
homeassistant:
# Name of the location where Home Assistant is running
name: Hogar
# Location required to calculate the time the sun rises and sets
latitude: !secret hogar_latitud
longitude: !secret hogar_longitud
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: !secret hogar_elevacion
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: !secret hogar_zonahoraria
# Customization file
customize: !include customize.yaml
packages: !include_dir_named packages
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
http:
base_url: alacenaha.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
ignore:
- yeelight
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# Sustituye a history
recorder:
purge_keep_days: 90
db_url: !secret db_url
# View all events in a logbook
logbook:
logger:
default: warning
logs:
miflora: debug
btlewrap: debug
bluepy: debug
homeassistant.components.mqtt: error
homeassistant.components.zwave: error
homeassistant.components.yeelight: debug
weather:
# Enables a map showing the location of tracked devices
map:
system_health:
# Track the sun
sun:
# Sensors
#sensor:
# Weather prediction
# - platform: yr
#mqtt: !include mqtt.yaml
# Text to speech
tts:
- platform: google
# Cloud
cloud:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
switch:
- platform: rest
name: "General Luces"
scan_interval: 30
resource: http://10.10.1.153/relay/0
body_on: 'turn=on'
body_off: 'turn=off'
timeout: 60
is_on_template: '{{ value_json.ison == true}}'
headers:
content-type: application/x-www-form-urlencoded
- platform: rest
name: "General Persianas"
scan_interval: 30
resource: http://10.10.1.153/relay/1
body_on: 'turn=on'
body_off: 'turn=off'
timeout : 60
is_on_template: '{{ value_json.ison == true}}'
headers:
content-type: application/x-www-form-urlencoded
- platform: rest
name: "General Caldera"
scan_interval: 30
resource: http://10.10.1.153/relay/2
body_on: 'turn=on'
body_off: 'turn=off'
timeout : 60
is_on_template: '{{ value_json.ison == true}}'
headers:
content-type: application/x-www-form-urlencoded
- platform: rest
name: "Coche Eléctrico"
scan_interval: 30
resource: http://10.10.1.153/relay/3
body_on: 'turn=on'
body_off: 'turn=off'
timeout : 60
is_on_template: '{{ value_json.ison == true}}'
headers:
content-type: application/x-www-form-urlencoded
- platform: xiaomi_miio
name: Xiaomi Strip 1
host: 10.10.1.145
token: fe3b88c2fdf9d129e30c8cd945ed4461
- platform: xiaomi_miio
name: Xiaomi Strip 2
host: 10.10.1.146
token: 3e1fea7691567cf1d5241f02ebb989ee
zwave:
usb_path: /dev/ttyACM1
google_assistant:
project_id: homeassistant-8c53b
api_key: AIzaSyDhRdUJU0pHmxxVP0IYu-BKNKDrf1_ivlM
expose_by_default: true
exposed_domains:
- switch
- light
- media_player
entity_config:
light.yeelight_ceiling_7c49ebae71f9:
expose: true
name: Luz Habitación Estudio
binary_sensor:
- platform: mqtt
name: "Puerta Entrada" #Puerta de Entrada
payload_on: "A2670A"
payload_off: "A2670E"
device_class: opening
state_topic: "sonoffbridge/tele/RESULT"
value_template: "{{value_json.RfReceived.Data}}"
- platform: mqtt
name: "Puerta Tendedero"
payload_on: "0D7F0A"
payload_off: "0D7F0E"
device_class: opening
state_topic: "sonoffbridge/tele/RESULT"
value_template: "{{value_json.RfReceived.Data}}"
- platform: mqtt
name: "Movimiento Habitación Estudio"
payload_on: "2A00BC"
payload_off: "2A00BCoff"
device_class: motion
state_topic: "sonoffbridge/tele/RESULT"
value_template: "{{value_json.RfReceived.Data}}"
off_delay: 8
- platform: mqtt
name: "Movimiento Pasillo Habitaciones"
payload_on: "5D559C"
payload_off: "5D559Coff"
device_class: motion
state_topic: "sonoffbridge/tele/RESULT"
value_template: "{{value_json.RfReceived.Data}}"
off_delay: 8
- platform: workday
country: ES
province: MAD
workdays: [mon, tue, wed, thu, fri]
sensor:
- platform: sql
db_url: !secret db_url
queries:
- name: db_size
query: "SELECT (pg_database_size('homeassistant')/1024/1024) as db_size;"
column: db_size
unit_of_measurement: MB
scan_interval: 120
- platform: mqtt
name: "Consumo General Luces"
state_topic: "shellies/shelly4pro-061E6E/relay/0/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Consumo General Persianas"
state_topic: "shellies/shelly4pro-061E6E/relay/1/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Consumo General Calefacción"
state_topic: "shellies/shelly4pro-061E6E/relay/2/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Consumo General Coche Eléctrico"
state_topic: "shellies/shelly4pro-061E6E/relay/3/power"
unit_of_measurement: "W"
- platform: mqtt
name: "Energia General Luces"
state_topic: "shellies/shelly4pro-061E6E/relay/0/energy"
unit_of_measurement: "KWh"
value_template: "{{ value | multiply(0.01) | float | round(2)}}"
- platform: mqtt
name: "Energia General Persianas"
state_topic: "shellies/shelly4pro-061E6E/relay/1/energy"
unit_of_measurement: "KWh"
value_template: "{{ value | multiply(0.01) | float | round(2)}}"
- platform: mqtt
name: "Energia General Calefacción"
state_topic: "shellies/shelly4pro-061E6E/relay/2/energy"
unit_of_measurement: "KWh"
value_template: "{{ value | multiply(0.01) | float | round(2)}}"
- platform: mqtt
name: "Energia General Coche Eléctrico"
state_topic: "shellies/shelly4pro-061E6E/relay/3/energy"
unit_of_measurement: "KWh"
value_template: "{{ value | multiply(0.01) | float | round(2)}}"
#Sensor del horno
# - platform: mqtt
# name: "Consumo Horno Actual"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{value_json['ENERGY'].Power }}"
# qos: 1
# unit_of_measurement : "W"
# - platform: mqtt
# name: "Voltaje Horno"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{ value_json['ENERGY'].Voltage }}"
# qos: 1
# unit_of_measurement : "V"
# - platform: mqtt
# name: "Amperios Horno"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{ value_json['ENERGY'].Current }}"
# qos: 1
# unit_of_measurement : "A"
# - platform: mqtt
# name: "Consumo Horno Hoy"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{ value_json['ENERGY'].Today }}"
# qos: 1
# unit_of_measurement : "kWh"
# - platform: mqtt
# name: "Consumo Horno Ayer"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{ value_json['ENERGY'].Yesterday }}"
# qos: 1
# unit_of_measurement : "kWh"
# - platform: mqtt
# name: "Consumo Horno Total"
# state_topic: "tele/SonoffHorno/SENSOR"
# value_template: "{{ value_json['ENERGY'].Total }}"
# qos: 1
# unit_of_measurement : "kWh"
#Sensor Usos Varios 2
# - platform: mqtt
# name: "Consumo Usos Varios 2 Actual"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{value_json['ENERGY'].Power }}"
# qos: 1
# unit_of_measurement : "W"
# - platform: mqtt
# name: "Voltaje Usos Varios 2"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{ value_json['ENERGY'].Voltage }}"
# qos: 1
# unit_of_measurement : "V"
# - platform: mqtt
# name: "Amperios Usos Varios 2"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{ value_json['ENERGY'].Current }}"
# qos: 1
# unit_of_measurement : "A"
# - platform: mqtt
# name: "Consumo Usos Varios 2 Hoy"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{ value_json['ENERGY'].Today }}"
# qos: 1
# unit_of_measurement : "kWh"
# - platform: mqtt
# name: "Consumo Usos Varios 2 Ayer"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{ value_json['ENERGY'].Yesterday }}"
# qos: 1
# unit_of_measurement : "kWh"
# - platform: mqtt
# name: "Consumo Usos Varios 2 Total"
# state_topic: "tele/Sonoffuv2/SENSOR"
# value_template: "{{ value_json['ENERGY'].Total }}"
# qos: 1
# unit_of_measurement : "kWh"
light:
- platform: xiaomi_miio
name: Luz Entrada Dormitorio
host: 10.10.1.191
token: f7a017cf2a7df0f64f3866d091ec24e1
model: philips.light.downlight
- platform: xiaomi_miio
name: Luz Habitaciones Pasillo
host: 10.10.1.192
token: f6743cf3e3639ac42870bed17dfc5fc0
model: philips.light.downlight
- platform: xiaomi_miio
name: Luz Estudio Pasillo
host: 10.10.1.193
token: 7026ea559226f23e1ed3bff25adac20d
model: philips.light.downlight
- platform: xiaomi_miio
name: Luz Entrada Pasillo
host: 10.10.1.194
token: 1f7148e6ecadea293937b34565f2035c
model: philips.light.downlight
- platform: xiaomi_miio
name: Luz Tendedero
host: 10.10.1.195
token: 7b7b7720161907220116d261372161fb
model: philips.light.downlight
- platform: yeelight
devices:
10.10.1.161:
name: Luz Habitacion Estudio
10.10.1.162:
name: Luz Habitacion Noha
10.10.1.163:
name: Luz Habitacion Mia
10.10.1.164:
name: Luz Habitacion Principal

26
customize.yaml Normal file
View File

@@ -0,0 +1,26 @@
light.yeelight_ceiling_7c49ebae71f9:
friendly_name: Luz Habitación Estudio
light.yeelight_ceiling_7c49ebb85735:
friendly_name: Luz Habitación Mia
light.yeelight_ceiling_7c49ebb86489:
friendly_name: Luz Habitación Noha
light.yeelight_ceiling3_04cf8c78add6:
friendly_name: Luz Habitación Principal
sun.sun:
friendly_name: Sol
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_current:
friendly_name: Consumo en Amperios
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power:
friendly_name: Consumo en Wattios
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power_factor:
friendly_name: Factor de Potencia
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_voltage:
friendly_name: General Voltaje
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_energy:
friendly_name: Potencia Reactiva
sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_energy_2:
friendly_name: Potencia Activa
switch.light_led_cabecero:
friendly_name: Luz Cabecero Principal
assumed_state: false
icon: mdi:lightbulb

0
groups.yaml Normal file
View File

10
packages/broadlink.yaml Normal file
View File

@@ -0,0 +1,10 @@
switch:
- platform: broadlink
host: 10.10.1.152
mac: '34:EA:34:E4:6A:2E'
timeout: 15
switches:
light_led_cabecero:
command_on: 'sgC0AQkKCQkJLAkJCSwJLAgKCQkJLAkJCSwJCQksCQkJKwoAAVkJWwkJCCwJCgksCCwJCgkrCQkKKwkKCAoJKwkKCSsJLAkKCQkJLAkrCQoJCQksCQkJLAkJCSwJCQksCSwICgkJCSwJCggsCQkJLAkJCSwJLAkJCSwJCQkKCCwJCQksCSwJCQorCQoICgksCAoJKworCQoJCQkrCgkJLAkJCSwJCQgsCQABWglaCQoJKwkKCCwJLAkJCSwJCQksCQkJCggsCQkJLAksCQkKCQksCSsJCggKCSwICgksCAoJLAgKCSwILAkJCgkJLAkJCSwJCQksCQkJLAksCAoJKwkKCQkJLAkJCSwJKwkKCSwJCQkJCSwJCggsCSwJCQkKCSsJCQksCQoILAkJCSwJAAFaCVoJCQksCQkJLAkrCQoJKwkKCSsJCgkJCSwJCQksCSsJCgkKCSsJLAkJCQoILQgKCCwJCggsCQoILAksCQkJCQktCQkJLAgKCSwICgksCCwJCggsCQoJCQksCQkJLAgsCQoJLAgKCQkJLAkJCSwJLAgKCQkJLAkJCSwJCQksCQkJLAgABdwAAAAA'
command_off: 'sgCCAQkKCSsJCgkJCSwJCQksCSsJCgkJCSwJLAgKCQkJLAkKCCwJCQksCQkJLAksCAoJCQktCAoJLAkJCSwICgksCSsJCggsCQoICgksCQkJLAgsCQoJKwkKCQkJLAkJCSwJCQksCQkJLAkJCSwJCQksCQkJLAkAAVoIWwkJCSwJCQksCSsJCgkrCQoILAkKCQkJLAkJCSwILAkKCQkJLAksCQkJCQksCQkJLAkJCSwJCggsCSwICgkJCS0JCQksCQkJLAgKCSwILAkKCCwJCgkJCSwJCQkrCSwJCgksCAoJCQksCQkJLAkJCSwJCQksCQkJLAkJCSwJCQksCQABWghbCQkJLAkJCSwJKwkKCSsJCgksCAoJCQksCQkJLAkrCQoJCQksCSwJCQkJCSwJCQksCQoILAkKCCwJLAkJCQoILQkJCSwICgksCAoJLAkrCQoJKwkKCAoJLAkJCSwILAkKCSwICgkJCSwJCQksCQkJLAkJCSwJCQksCQkJLAkJCSwJAAXcAAAAAAAA'

76
packages/citroen.yaml Normal file
View File

@@ -0,0 +1,76 @@
sensor:
- platform: command_line
command: !secret citroen_status
name: citroen_status
json_attributes:
- signals
- location
- updatedAt
value_template: ''
scan_interval: 300
- platform: template
sensors:
citroen_bateria:
friendly_name: 'Citroen Batería'
value_template: >-
{% for signals in states.sensor.citroen_status.attributes.signals -%}
{% if signals.name == "BatteryVoltage" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'V'
citroen_velocidad:
friendly_name: 'Citroen Velocidad'
value_template: >-
{% for signals in states.sensor.citroen_status.attributes.signals -%}
{% if signals.name == "GpsSpeed" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'Km/h'
citroen_combustible:
friendly_name: 'Citroen Gasolina'
value_template: >-
{% for signals in states.sensor.citroen_status.attributes.signals -%}
{% if signals.name == "FuelLevel" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'L'
citroen_kilometros:
friendly_name: 'Citroen Total Km'
value_template: >-
{% for signals in states.sensor.citroen_status.attributes.signals -%}
{% if signals.name == "Odometer" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'km'
citroen_revoluciones:
friendly_name: 'Citroen Revoluciones por Minuto'
value_template: >-
{% for signals in states.sensor.citroen_status.attributes.signals -%}
{% if signals.name == "EngineSpeed" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'tr/min'
citroen_fecha_update:
friendly_name: 'Citroen Actualización'
value_template: "{{ as_timestamp(states.sensor.citroen_status.attributes.updatedAt) | timestamp_custom('%D %-I:%M %P') }}"
citroen_latitud:
friendly_name: 'Citroen Latitud'
value_template: '{{ states.sensor.citroen_status.attributes.location.latitude }}'
citroen_longitud:
friendly_name: 'Citroen Longitud'
value_template: '{{ states.sensor.citroen_status.attributes.location.longitude }}'
camera:
name: Posición Citroen
platform: generic
still_image_url: !secret camara_citroen
limit_refetch_to_url_change: true

View File

@@ -0,0 +1,2 @@
device_tracker:
- platform: bluetooth_tracker

73
packages/energia.yaml Normal file
View File

@@ -0,0 +1,73 @@
sensor:
- platform: sql
db_url: !secret db_url
scan_interval: 600
queries:
- name: Coste Ayer TDH
query: "SELECT ayer, MAX(avr_day_0_12) as avr_1, MAX(avr_day_12_22) as avr_2, MAX(avr_day_22_23) as avr_3, (MAX(avr_day_0_12)+MAX(avr_day_12_22)+MAX(avr_day_22_23)) as total, MAX(avr_day_full) as TotalFull
FROM
((SELECT DATE(created) as ayer, (AVG(CAST ( state AS numeric ))*12*0.082/1000) AS avr_day_0_12,0 as avr_day_12_22,0 as avr_day_22_23, 0 as avr_day_full
FROM states
WHERE entity_id = 'sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power'
AND state != 'unknown'
AND state != ''
AND CAST(state AS numeric) >= 0
AND CAST(state AS numeric) <= 7500
AND DATE(created) = current_date -1
AND EXTRACT(HOUR from created) between '00' and '11'
GROUP BY DATE(created)
ORDER BY DATE(created))
UNION
(SELECT DATE(created),0,(AVG(CAST ( state AS numeric ))*10*0.161/1000) AS avr_day_12_22,0,0
FROM states
WHERE entity_id = 'sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power'
AND state != 'unknown'
AND state != ''
AND CAST(state AS numeric) >= 0
AND CAST(state AS numeric) <= 7500
AND DATE(created) = current_date -1
AND EXTRACT(HOUR from created) between '12' and '21'
GROUP BY DATE(created)
ORDER BY DATE(created))
UNION
(SELECT DATE(created),0,0, (AVG(CAST ( state AS numeric ))*2*0.082/1000) AS avr_day_23_00, 0
FROM states
WHERE entity_id = 'sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power'
AND state != 'unknown'
AND state != ''
AND CAST(state AS numeric) >= 0
AND CAST(state AS numeric) <= 7500
AND DATE(created) = current_date -1
AND EXTRACT(HOUR from created) between '22' and '23'
GROUP BY DATE(created)
ORDER BY DATE(created))
UNION
(SELECT DATE(created),0,0,0, (AVG(CAST ( state AS numeric ))*24*0.139/1000) AS avr_day_full
FROM states
WHERE entity_id = 'sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power'
AND state != 'unknown'
AND state != ''
AND CAST(state AS numeric) >= 0
AND CAST(state AS numeric) <= 7500
AND DATE(created) = current_date -1
GROUP BY DATE(created)
ORDER BY DATE(created))
) as a
group by ayer;"
column: "total"
unit_of_measurement:
value_template: "{{ value | round(2) }}"
- name: Coste Ayer TSDH
query: "SELECT DATE(created), (AVG(CAST ( state AS numeric ))*24*0.139/1000) AS total
FROM states
WHERE entity_id = 'sensor.qubino_zmnhtdx_smart_meter_s4_s5_s6_power'
AND state != 'unknown'
AND state != ''
AND CAST(state AS numeric) >= 0
AND CAST(state AS numeric) <= 7500
AND DATE(created) = current_date -1
GROUP BY DATE(created)
ORDER BY DATE(created);"
column: "total"
unit_of_measurement:
value_template: "{{ value | round(2) }}"

View File

@@ -0,0 +1,6 @@
media_player:
- platform: kodi
host: 10.10.1.121
name: Hab. Padres
username: kodi
password: XBMC

View File

@@ -0,0 +1,46 @@
automation:
- alias: Encender Luz Entrada Pasillo Normal
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.movimiento_entrada_pasillo
to: 'on'
condition:
condition: or
conditions:
- before: sunrise
condition: sun
- after: sunset
condition: sun
action:
- service: homeassistant.turn_on
data:
entity_id:
- light.luz_entrada_pasillo
data_template:
brightness: >
{% if 7 < now().strftime('%H')|int and now().strftime('%H')|int < 23 -%}
255
{%- else -%}
100
{%- endif %}
- service: timer.start
data:
entity_id: timer.luzentradapasillo
- alias: Apagar Luz Entrada Pasillo Normal
initial_state: 'on'
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.luzentradapasillo
action:
service: homeassistant.turn_off
data:
entity_id:
- light.luz_entrada_pasillo
timer:
luzentradapasillo:
duration: '00:03:05'

View File

@@ -0,0 +1,39 @@
automation:
- alias: Encender Luz Habitación Estudio Normal
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.movimiento_habitacion_estudio
to: 'on'
condition:
condition: or
conditions:
- before: sunrise
condition: sun
- after: sunset
condition: sun
action:
- service: homeassistant.turn_on
data:
entity_id:
- light.luz_habitacion_estudio
- service: timer.start
data:
entity_id: timer.luzhabitacionestudio
- alias: Apagar Luz Habitación Estudio Normal
initial_state: 'on'
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.luzhabitacionestudio
action:
service: homeassistant.turn_off
data:
entity_id:
- light.luz_habitacion_estudio
timer:
luzhabitacionestudio:
duration: '00:03:00'

48
packages/luzpasillo.yaml Normal file
View File

@@ -0,0 +1,48 @@
automation:
- alias: Encender Luz Pasillo Normal
initial_state: 'on'
trigger:
- platform: state
entity_id: binary_sensor.movimiento_pasillo_habitaciones
to: 'on'
condition:
condition: or
conditions:
- before: sunrise
condition: sun
- after: sunset
condition: sun
action:
- service: homeassistant.turn_on
data:
entity_id:
- light.luz_estudio_pasillo
- light.luz_habitaciones_pasillo
data_template:
brightness: >
{% if 7 < now().strftime('%H')|int and now().strftime('%H')|int < 23 -%}
255
{%- else -%}
50
{%- endif %}
- service: timer.start
data:
entity_id: timer.luzpasillo
- alias: Apagar Luz Pasillo Normal
initial_state: 'on'
trigger:
platform: event
event_type: timer.finished
event_data:
entity_id: timer.luzpasillo
action:
service: homeassistant.turn_off
data:
entity_id:
- light.luz_estudio_pasillo
- light.luz_habitaciones_pasillo
timer:
luzpasillo:
duration: '00:00:20'

120
packages/persianas.yaml Normal file
View File

@@ -0,0 +1,120 @@
cover:
- platform: mqtt
name: "Persina Habitación Principal"
state_topic: "shellies/shellyswitch25-744b67/roller/0"
command_topic: "shellies/shellyswitch25-744B67/roller/0/command"
position_topic: "shellies/shellyswitch25-744B67/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-744B67/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-744B67/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0
- platform: mqtt
name: "Persina Habitación Noha"
state_topic: "shellies/shellyswitch25-5DB8BE/roller/0"
command_topic: "shellies/shellyswitch25-5DB8BE/roller/0/command"
position_topic: "shellies/shellyswitch25-5DB8BE/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-5DB8BE/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-5DB8BE/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0
- platform: mqtt
name: "Persina Habitación Mia"
state_topic: "shellies/shellyswitch25-74595B/roller/0"
command_topic: "shellies/shellyswitch25-74595B/roller/0/command"
position_topic: "shellies/shellyswitch25-74595B/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-74595B/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-74595B/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0
- platform: mqtt
name: "Persina Habitación Estudio"
state_topic: "shellies/shellyswitch25-74595A/roller/0"
command_topic: "shellies/shellyswitch25-74595A/roller/0/command"
position_topic: "shellies/shellyswitch25-74595A/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-74595A/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-74595A/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0
- platform: mqtt
name: "Persina Salón Fase Dos"
state_topic: "shellies/shellyswitch25-745590/roller/0"
command_topic: "shellies/shellyswitch25-745590/roller/0/command"
position_topic: "shellies/shellyswitch25-745590/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-745590/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-745590/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0
- platform: mqtt
name: "Persina Salón Piscina"
state_topic: "shellies/shellyswitch25-74552E/roller/0"
command_topic: "shellies/shellyswitch25-74552E/roller/0/command"
position_topic: "shellies/shellyswitch25-74552E/roller/0/pos"
set_position_topic: "shellies/shellyswitch25-74552E/roller/0/command/pos"
availability_topic: "shellies/shellyswitch25-74552E/online"
state_open: "open"
# state_close: "close"
payload_available: "true"
payload_not_available: "false"
retain: false
optimistic: false
payload_open: "open"
payload_close: "close"
payload_stop: "stop"
position_open: 100
position_closed: 0
qos: 0

View File

@@ -0,0 +1,12 @@
sensor:
- platform: miflora
mac: 'C4:7C:8D:67:5A:AC'
name: Plantas
force_update: true
median: 3
monitored_conditions:
- moisture
- light
- temperature
- conductivity
- battery

View File

@@ -0,0 +1,5 @@
fan:
- platform: xiaomi_miio
host: 10.10.1.173
token: c7411a8e3b3631f918fe70cba89aa623
model: zhimi.airpurifier.mc1

76
packages/smart.yaml Normal file
View File

@@ -0,0 +1,76 @@
sensor:
- platform: command_line
command: !secret smart_status
name: smart_status
json_attributes:
- signals
- location
- updatedAt
value_template: ''
scan_interval: 300
- platform: template
sensors:
smart_bateria:
friendly_name: 'Smart Batería'
value_template: >-
{% for signals in states.sensor.smart_status.attributes.signals -%}
{% if signals.name == "BatteryVoltage" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'V'
smart_velocidad:
friendly_name: 'Smart Velocidad'
value_template: >-
{% for signals in states.sensor.smart_status.attributes.signals -%}
{% if signals.name == "GpsSpeed" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'Km/h'
# smart_combustible:
# friendly_name: 'Smart Gasolina'
# value_template: >-
# {% for signals in states.sensor.smart_status.attributes.signals -%}
# {% if signals.name == "FuelLevel" %}
# {{ signals.value }}
# {% endif %}
# {%- endfor -%}
# unit_of_measurement: 'L'
smart_kilometros:
friendly_name: 'Smart Total Km'
value_template: >-
{% for signals in states.sensor.smart_status.attributes.signals -%}
{% if signals.name == "Odometer" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'km'
smart_revoluciones:
friendly_name: 'Smart Revoluciones por Minuto'
value_template: >-
{% for signals in states.sensor.smart_status.attributes.signals -%}
{% if signals.name == "EngineSpeed" %}
{{ signals.value }}
{% endif %}
{%- endfor -%}
unit_of_measurement: 'tr/min'
smart_fecha_update:
friendly_name: 'Smart Actualización'
value_template: "{{ as_timestamp(states.sensor.smart_status.attributes.updatedAt) | timestamp_custom('%D %-I:%M %P') }}"
smart_latitud:
friendly_name: 'Smart Latitud'
value_template: '{{ states.sensor.smart_status.attributes.location.latitude }}'
smart_longitud:
friendly_name: 'Smart Longitud'
value_template: '{{ states.sensor.smart_status.attributes.location.longitude }}'
camera:
name: Posición Smart
platform: generic
still_image_url: !secret camara_smart
limit_refetch_to_url_change: true

21
packages/sonoff.yaml Normal file
View File

@@ -0,0 +1,21 @@
automation:
- alias: "Power state on HA start-up"
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "sonoffs/cmnd/state"
payload: ""
initial_state: 'on'
- alias: "Enable MQTT discovery for all devices"
trigger:
platform: homeassistant
event: start
action:
- service: mqtt.publish
data:
topic: "sonoffs/cmnd/SetOption19"
payload: "1"
initial_state: 'on'

23
packages/telegram_bot.yaml Executable file
View File

@@ -0,0 +1,23 @@
telegram_bot:
- platform: polling
api_key: !secret telegram_apikey
allowed_chat_ids:
- -396720922 #Esperando al Tren (Isabel)
- -377291891 #HANotificacionesSilvia
- -381626310 #HANotificacionesFamilia
- -377425576 #HANotificacionesDiego
notify:
- name: Telegram_Diego
platform: telegram
chat_id: -377425576
- name: Telegram_Silvia
platform: telegram
chat_id: -377291891
- name: Telegram_Familia
platform: telegram
chat_id: -381626310
- name: Telegram_Isabel
platform: telegram
chat_id: -396720922

14
packages/xee.yaml Normal file
View File

@@ -0,0 +1,14 @@
sensor:
- platform: command_line
command: !secret refresh_xee_command
name: refresh_xee
scan_interval: 86400
json_attributes:
- access_token
- expires_in
value_template: >-
{% if value_json.access_token is defined -%}
Válida hasta: {{ (as_timestamp(now()) + value_json.expires_in) | timestamp_local }}
{%- else -%}
Caducada.
{%- endif -%}

56
scripts.yaml Normal file
View File

@@ -0,0 +1,56 @@
#Broadlink - Humidificiador
apagar_encender_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBgAAABJ5YRORISEhMSEhITERMRExMSETkRNxQ3EjgRFBI3EjgTNxI4EhIRFBEUEBQRExEUEhIRExI4ETkRORM3ETgTNxE5EgAFMAABJ0sRAAxfAAEoShEADF8AASdLEQANBQAAAAAAAAAA
display_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBwAAABKJQSOBMRExISEhITERMRFBISETkSOBI3EzcRFBI3EjgSOBISEhMRORETERMTEhISExIRORI3EhMSNxI4EjgRORI4EgAFLwABJ0sSAAxcAAEnSxEADF0AAShKEgAMXAABJ0sRAAxdAAEnShIADQUAAAAAAAAAAA==
calentador_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBgAAABKJQROREUERMSExETERMSExISEzcTNxE5EzcRExI4ETkTNxETEjgSOBETERQSEhEUEhISOBETEhMRORE4EjgRORI4EQAFMQABKEoSAAxgAAEnSxMADF0AAShKEgANBQAAAAAAAAAA
luz_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABKZQSOBEUEhISExISERQSEhITETgSOBI4ETkRFBE4EjgROREUERMRFBE5ERMRFBETERQSNxI4EjgSExE5ETgTNxI4EQAFMwABJ0sSAAxiAAEoShEADQU=
control_humedad_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABKJUSOBETERQRExITERMRFBETETkSOBE4EjgRFBE4EzcSOBEUEjcSExE5EhIRFBETEhMSNxMSETkSEhI4EzcSOBE4EgAFMQABJ0sRAAxfAAEoShIADQU=
tiempo_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABKJUTNxISEhMRExMTERISFBATEjgRORE5ETkSExA5EjgTNxEUEBQROBI4EhMTERITExERORE5ERMSExE5ETkSNxM3EwAFMAABKEoSAAxhAAEoShEADQU=
niebla_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABKJUSOBAUEhMRExEUERMRFBISEjgRORE5ETgSExE5ETgSOBEUETgSOBI4ERQRExISEhMSOBISERQRExE5ETkRORE4EgAFMQABJ0sRAAxfAAEnSxEADQU=
menos_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABKJUSOBMREhMSEhEUERMRFBETEjgRORI4ETkRExI4ETkSNxITERQRExISEjgSExETEhMRORI3EjgSOBITETgSOBI4EgAFMAABKEsSAAxgAAEoShEADQU=
mas_humidificador:
sequence:
- service: switch.broadlink_send_packet_10_10_1_152
data:
packet:
- JgBYAAABJ5YSNxMSERMSExISEhMRExITETkROBM3EjgRFBE4EzcSOBITETgSExISEjgSExETERQROBITETkRORISETkSOBI4EQAFMQABJ0sTAAxfAAEoShIADQU=

Submodule www/plugins/lovelace-auto-entities added at be13234a43

Submodule www/plugins/lovelace-card-modder added at f3d96f73f1

Submodule www/plugins/lovelace-card-tools added at deb8e38741

Submodule www/plugins/lovelace-fold-entity-row added at 6d11d3cc65

Submodule www/plugins/lovelace-layout-card added at e0ec2f21ad