Bom dia
estou a separar os meus switch e sensores para ficheiros packeges, troquei hoje de manha o sonoff pow r2 sao dois
e estavam a trabalhar ok quando passei para o ficheiro packege
os switch ficaram a funcionar os sensores nao estao a receber info mas a validação da config nao esta a dar erro o que podera ser
################################################################################
# TYPE: Package
# FILENAME: pow rigs.yaml
# NAME: Pow Rigs
# Controlo das rigs Com Sonoff pow R2 Com os sensores para calcular energia gasta
################################################################################
###############################################################################
#### SCRIPTS
################################################################################
#script:
####
################################################################################
## SHELL COMMAND
################################################################################
#shell_command:
####
################################################################################
## INPUT TEXT
################################################################################
#input_text:
####
################################################################################
#### INPUT SELECT
################################################################################
#input_select:
####
################################################################################
#### INPUT BOOLEANS
################################################################################
#input_boolean:
####
################################################################################
#### INPUT NUMBER (OLD INPUT_SLIDER)
################################################################################
#input_number:
####
################################################################################
#### INPUT DATE TIME
################################################################################
#input_datetime:
####
################################################################################
#### REST COMMANDS
################################################################################
#rest_command:
####
################################################################################
#### SENSORS
################################################################################
sensor:
#POW RIG 1
#sensor sonoff_pow_watts:
- platform: mqtt
#name: Rig 1 Current Power Usage
name: Rig 1 Consumo Actual
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{value_json['ENERGY'].Power }}"
qos: 1
unit_of_measurement : "W"
#sensor sonoff_pow_volts:
- platform: mqtt
#name: Rig 1 Current Voltage
name: Rig 1 Voltagem Actual
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{ value_json['ENERGY'].Voltage }}"
qos: 1
unit_of_measurement : "V"
#sensor sonoff_pow_current:
- platform: mqtt
#name: Rig 1 Current Amps
name: Rig 1 Consumo actual de Amperes
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{ value_json['ENERGY'].Current }}"
qos: 1
unit_of_measurement : "A"
#sensor sonoff_pow_kwh_today:
- platform: mqtt
#name: Rig 1 Todays Power
name: Rig 1 Consumo Diario
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{ value_json['ENERGY'].Today }}"
qos: 1
unit_of_measurement : "kWh"
#sensor sonoff_pow_kwh_yesterday:
- platform: mqtt
#name: Rig 1 Yesterdays Power
name: Rig 1 Consumo Dia Anterior
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{ value_json['ENERGY'].Yesterday }}"
qos: 1
unit_of_measurement : "kWh"
#sensor sonoff_pow_kwh_total:
- platform: mqtt
#name: Rig 1 Total Power
name: Rig 1 Consumo Total
icon: mdi:flash
state_topic: "tele/rig1/SENSOR"
value_template: "{{ value_json['ENERGY'].Total }}"
qos: 1
unit_of_measurement : "kWh"
#POW RIG 2
#sensor sonoff_pow_watts:
- platform: mqtt
#name: Rig 2 Current Power Usage
name: Rig 2 Consumo Actual
icon: mdi:flash
state_topic: "tele/rig2/SENSOR"
value_template: "{{value_json['ENERGY'].Power }}"
qos: 1
unit_of_measurement : "W"
#sensor sonoff_pow_volts:
- platform: mqtt
#name: Rig 2 Current Voltage
name: Rig 2 Voltagem Actual
icon: mdi:flash
state_topic: "tele/rig2/SENSOR"
value_template: "{{ value_json['ENERGY'].Voltage }}"
qos: 1
unit_of_measurement : "V"
#sensor sonoff_pow_current:
- platform: mqtt
#name: Rig 2 Current Amps
name: Rig 2 Consumo actual de Amperes
icon: mdi:flash
state_topic: "tele/rig2/SENSOR"
value_template: "{{ value_json['ENERGY'].Current }}"
qos: 1
unit_of_measurement : "A"
#sensor sonoff_pow_kwh_today:
- platform: mqtt
#name: Rig 2 Todays Power
name: Rig 2 Consumo Diario
icon: mdi:flash
state_topic: "tele/rig2/SENSOR"
value_template: "{{ value_json['ENERGY'].Today }}"
qos: 1
unit_of_measurement : "kWh"
#sensor sonoff_pow_kwh_yesterday:
- platform: mqtt
icon: mdi:flash
#name: Rig 2 Yesterdays Power
name: Rig 2 Consumo Dia Anterior
state_topic: "tele/rig2/SENSOR"
value_template: "{{ value_json['ENERGY'].Yesterday }}"
qos: 1
unit_of_measurement : "kWh"
#sensor sonoff_pow_kwh_total:
- platform: mqtt
#name: Rig 2 Total Power
name: Rig 1 Consumo Total
icon: mdi:flash
state_topic: "tele/rig2/SENSOR"
value_template: "{{ value_json['ENERGY'].Total }}"
qos: 1
unit_of_measurement : "kWh"
####
################################################################################
#### SENSOR TEMPLATES
################################################################################
#Calcular o custo da energia na Rig 1
- platform: template
sensors:
rig1_custo_energia_diario:
friendly_name: "Custo Energia Diario"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_1_todays_power.state) * 0.15184 + 0.11) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
rig1_custo_energia_dia_anterior:
friendly_name: "Custo Energia Dia anterior"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_1_yesterdays_power.state) * 0.15184 + 0.11) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
rig1_custo_energia_mensal:
friendly_name: "Custo Energia Total"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_1_total_power.state) * 0.15184 + 3.38) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
#calcular o custo da energia na Rig 2
- platform: template
sensors:
rig2_custo_energia_diario:
friendly_name: "Custo Energia Diario"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_2_todays_power.state) * 0.15184 + 0.11) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
rig2_custo_energia_dia_anterior:
friendly_name: "Custo Energia Dia anterior"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_2_yesterdays_power.state) * 0.15184 + 0.11) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
rig2_custo_energia_mensal:
friendly_name: "Custo Energia Total"
icon_template: mdi:currency-eur
value_template: '{{ ((float(states.sensor.rig_2_total_power.state) * 0.15184 + 3.38) * 1.23 ) | round(2) }}'
unit_of_measurement: "€"
################################################################################
## BINARY SENSORS
################################################################################
#binary_sensor:
####
################################################################################
#### BINARY SENSOR TEMPLATES
################################################################################
####
################################################################################
## SWITCHES
################################################################################
switch:
# Rig Control
- name: "Rig1"
#icon: mdi:desktop-classic
platform: mqtt
state_topic: "stat/rig1/POWER"
command_topic: "cmnd/rig1/POWER"
payload_on: "ON"
payload_off: "OFF"
optimistic: false
qos: 0
retain: false
- name: "Rig2"
#icon: mdi:desktop-classic
platform: mqtt
state_topic: "stat/rig2/POWER"
command_topic: "cmnd/rig2/POWER"
payload_on: "ON"
payload_off: "OFF"
optimistic: false
qos: 0
retain: false
################################################################################
## LIGHTS
################################################################################
#light:
####
################################################################################
## ALERTS
################################################################################
#alert:
####
################################################################################
#### CUSTOMIZE
################################################################################
homeassistant:
customize:
switch.rig1:
icon: mdi:desktop-classic
switch.rig2:
icon: mdi:desktop-classic
####
#### #### #### ####