diff --git a/configuration.yaml b/configuration.yaml index 5a99137..077efdd 100644 --- a/configuration.yaml +++ b/configuration.yaml @@ -1,4 +1,3 @@ - # Configure a default setup of Home Assistant (frontend, api, etc) default_config: @@ -10,7 +9,7 @@ light: !include lights.yaml mqtt: - sensor: !include_dir_merge_list mqtt/ + sensor: !include_dir_merge_list mqtt/ http: use_x_forwarded_for: true @@ -20,8 +19,8 @@ logger: default: warn logs: - custom_components.localtuya: debug - + custom_components.stecamonitor: debug + recorder: commit_interval: 5 purge_keep_days: 7 @@ -74,12 +73,12 @@ - device_tracker entities: - sun.sun - + frontend: themes: !include_dir_merge_named themes/ extra_module_url: - /hacsfiles/lovelace-card-mod/card-mod.js - + tts: - platform: google_translate @@ -98,11 +97,14 @@ password: homeassistant max_retries: 3 default_measurement: state - + fuelprices_dk: fueltypes: - oktan 95 +stecamonitor: + ip: 10.0.1.4 + sensor: !include_dir_merge_list sensors/ template: !include_dir_merge_list template/ @@ -114,7 +116,7 @@ min: 0 max: 120 step: 1 - + input_boolean: lights_state: name: Wether lights have been turned off @@ -123,11 +125,11 @@ util_solar_generated_usage_daily: source: sensor.energy_generated cycle: daily - + util_solar_generated_usage_monthly: source: sensor.energy_generated cycle: monthly - + util_water_usage_hourly: source: sensor.water_total cycle: hourly @@ -139,4 +141,4 @@ cycle: monthly util_water_usage_yearly: source: sensor.water_total - cycle: yearly \ No newline at end of file + cycle: yearly diff --git a/template/aircondition.yaml b/template/aircondition.yaml index cae9add..2b9c936 100644 --- a/template/aircondition.yaml +++ b/template/aircondition.yaml @@ -1,33 +1,33 @@ - sensor: - name: AirCondition Energi - state: '{{ (states.switch.aircondition_switch.attributes.current_consumption) | default(0) | float }}' + state: "{{ (states.switch.aircondition_switch.attributes.current_consumption) | default(0) | float(0) }}" unit_of_measurement: "W" device_class: power state_class: measurement - name: AirCondition Spænding - state: '{{ (states.switch.aircondition_switch.attributes.voltage) | default(0) | float }}' + state: "{{ (states.switch.aircondition_switch.attributes.voltage) | default(0) | float(0) }}" unit_of_measurement: "V" device_class: voltage state_class: measurement - name: AirCondition Strøm - state: '{{ (states.switch.aircondition_switch.attributes.current) | default(0) | float * 0.001 }}' + state: "{{ (states.switch.aircondition_switch.attributes.current) | default(0) | float(0) * 0.001 }}" unit_of_measurement: "A" device_class: current state_class: measurement - + - name: AirCondition Power Factor - state: | + availability: "{{ states.sensor.aircondition_spaending | float(0) > 0 }}" + state: | {# Calculate power factor #} {% set v = states.sensor.aircondition_spaending.state | float %} {% set a = states.sensor.aircondition_strom.state | float %} {% set wp = states.sensor.aircondition_energi.state | float %} {% set ap = v * a %} {% set pf = wp / ap * 100 %} - + {{ pf | round(2) }} unit_of_measurement: "%" device_class: power_factor state_class: measurement - \ No newline at end of file diff --git a/template/computer-plug.yaml b/template/computer-plug.yaml index 5036eda..76d2de2 100644 --- a/template/computer-plug.yaml +++ b/template/computer-plug.yaml @@ -1,31 +1,32 @@ - sensor: - name: Computer Spænding - state: '{{ (states.switch.computer_switch.attributes.voltage) | default(0)| float }}' + state: "{{ (states.switch.computer_switch.attributes.voltage) | default(0) | float(0) }}" unit_of_measurement: "V" device_class: voltage state_class: measurement - + - name: Computer Strøm - state: '{{ (states.switch.computer_switch.attributes.current) | default(0)| float * 0.001 }}' + state: "{{ (states.switch.computer_switch.attributes.current) | default(0) | float(0) * 0.001 }}" unit_of_measurement: "A" device_class: current state_class: measurement - + - name: Computer Energi - state: '{{ (states.switch.computer_switch.attributes.current_consumption) | default(0)| float }}' + state: "{{ (states.switch.computer_switch.attributes.current_consumption) | default(0) | float(0) }}" unit_of_measurement: "W" device_class: power state_class: measurement - + - name: Computer Power Factor - state: | + availability: "{{ states.sensor.computer_spaending | float(0) > 0 }}" + state: | {# Calculate power factor #} {% set v = states.sensor.computer_spaending.state | float %} {% set a = states.sensor.computer_strom.state | float %} {% set wp = states.sensor.computer_energi.state | float %} {% set ap = v * a %} {% set pf = wp / ap * 100 %} - + {{ pf | round(2) }} unit_of_measurement: "%" device_class: power_factor diff --git a/template/historic_energy_price.yaml b/template/historic_energy_price.yaml deleted file mode 100644 index 39111d1..0000000 --- a/template/historic_energy_price.yaml +++ /dev/null @@ -1,13 +0,0 @@ -- sensor: - - name: Historic Energy Price Percentiles - unique_id: historic_energy_price_percentiles - state: OK - attributes: - 25th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * -0.63 }}" - 50th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 0 }}" - 75th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 0.57 }}" - 90th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 1.29 }}" - 95th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 1.65 }}" - 99th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 2.33 }}" - 100th: "{{ states('sensor.average_energy_price_last_30d_mean') | float + states('sensor.energy_price_last_30d_std') | float * 3.9 }}" - diff --git a/template/opvaskemaskine.yaml b/template/opvaskemaskine.yaml index 2f77428..6405052 100644 --- a/template/opvaskemaskine.yaml +++ b/template/opvaskemaskine.yaml @@ -1,33 +1,33 @@ - sensor: - name: Opvaskemaskine Spænding - state: '{{ (states.switch.opvaskemaskine_switch.attributes.voltage) | default(0)| float }}' + state: "{{ (states.switch.opvaskemaskine_switch.attributes.voltage) | default(0) | float(0) }}" unit_of_measurement: "V" device_class: voltage state_class: measurement - + - name: Opvaskemaskine Strøm - state: '{{ (states.switch.opvaskemaskine_switch.attributes.current) | default(0)| float * 0.001 }}' + state: "{{ (states.switch.opvaskemaskine_switch.attributes.current) | default(0) | float(0) * 0.001 }}" unit_of_measurement: "A" device_class: current state_class: measurement - + - name: Opvaskemaskine Energi - state: '{{ (states.switch.opvaskemaskine_switch.attributes.current_consumption) | default(0)| float }}' + state: "{{ (states.switch.opvaskemaskine_switch.attributes.current_consumption) | default(0) | float(0) }}" unit_of_measurement: "W" device_class: power state_class: measurement - + - name: Opvaskemaskine Power Factor - state: | + availability: "{{ states.sensor.opvaskemaskine_spaending | float(0) > 0 }}" + state: | {# Calculate power factor #} {% set v = states.sensor.opvaskemaskine_spaending.state | float %} {% set a = states.sensor.opvaskemaskine_strom.state | float %} {% set wp = states.sensor.opvaskemaskine_energi.state | float %} {% set ap = v * a %} {% set pf = wp / ap * 100 %} - + {{ pf | round(2) }} unit_of_measurement: "%" device_class: power_factor state_class: measurement - \ No newline at end of file diff --git a/template/teknikskab.yaml b/template/teknikskab.yaml index 3f1da8e..423e143 100644 --- a/template/teknikskab.yaml +++ b/template/teknikskab.yaml @@ -1,33 +1,33 @@ - sensor: - name: Teknikskab Energi - state: '{{ (states.switch.teknikskab_switch.attributes.current_consumption) | default(0) | float }}' + state: "{{ (states.switch.teknikskab_switch.attributes.current_consumption) | default(0) | float(0) }}" unit_of_measurement: "W" device_class: power state_class: measurement - name: Teknikskab Spænding - state: '{{ (states.switch.teknikskab_switch.attributes.voltage) | default(0) | float }}' + state: "{{ (states.switch.teknikskab_switch.attributes.voltage) | default(0) | float(0) }}" unit_of_measurement: "V" device_class: voltage state_class: measurement - name: Teknikskab Strøm - state: '{{ (states.switch.teknikskab_switch.attributes.current) | default(0) | float * 0.001 }}' + state: "{{ (states.switch.teknikskab_switch.attributes.current) | default(0) | float(0) * 0.001 }}" unit_of_measurement: "A" device_class: current state_class: measurement - + - name: Teknikskab Power Factor - state: | + availability: "{{ states.sensor.teknikskab_spaending | default(0) | float(0) > 0 }}" + state: | {# Calculate power factor #} {% set v = states.sensor.teknikskab_spaending.state | float %} {% set a = states.sensor.teknikskab_strom.state | float %} {% set wp = states.sensor.teknikskab_energi.state | float %} {% set ap = v * a %} {% set pf = wp / ap * 100 %} - + {{ pf | round(2) }} unit_of_measurement: "%" device_class: power_factor state_class: measurement - \ No newline at end of file diff --git a/template/tv_baenk.yaml b/template/tv_baenk.yaml index 425e60c..6abdb0b 100644 --- a/template/tv_baenk.yaml +++ b/template/tv_baenk.yaml @@ -1,33 +1,33 @@ - sensor: - name: TV Bænk Spænding - state: '{{ (states.switch.tv_baenk.attributes.voltage) | default(0) | float }}' + state: "{{ (states.switch.tv_baenk.attributes.voltage) | default(0) | float(0) }}" unit_of_measurement: "V" device_class: voltage state_class: measurement - + - name: TV Bænk Strøm - state: '{{ (states.switch.tv_baenk.attributes.current) | default(0) | float * 0.001 }}' + state: "{{ (states.switch.tv_baenk.attributes.current) | default(0) | float(0) * 0.001 }}" unit_of_measurement: "A" device_class: current state_class: measurement - + - name: TV Bænk Energi - state: '{{ (states.switch.tv_baenk.attributes.current_consumption) | default(0) | float }}' + state: "{{ (states.switch.tv_baenk.attributes.current_consumption) | default(0) | float(0) }}" unit_of_measurement: "W" device_class: power state_class: measurement - + - name: TV Bænk Power Factor - state: | + availability: "{{ states.sensor.tv_baenk_spaending | default(0) | float(0) > 0 }}" + state: | {# Calculate power factor #} {% set v = states.sensor.tv_baenk_spaending.state | float %} {% set a = states.sensor.tv_baenk_strom.state | float %} {% set wp = states.sensor.tv_baenk_energi.state | float %} {% set ap = v * a %} {% set pf = wp / ap * 100 %} - + {{ pf | round(2) }} unit_of_measurement: "%" device_class: power_factor state_class: measurement - \ No newline at end of file