Skip to content

Commit

Permalink
Merge branch 'main' into v3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
huizebruin authored Jun 25, 2024
2 parents 5884a1c + 8ddd21a commit a0742fd
Show file tree
Hide file tree
Showing 14 changed files with 1,424 additions and 1,423 deletions.
208 changes: 104 additions & 104 deletions esphome/components/DSZ12D.yml
Original file line number Diff line number Diff line change
@@ -1,104 +1,104 @@
substitutions:
impulslengte: "30ms"

# # ⬇ Enable Home Assistant API ⬇ #
api:
services:
- service: meterstand_kwh
variables:
meter_value: float
then:
- globals.set:
id: initial_kwh_usage
value: !lambda "return ( meter_value ) ;"
- globals.set:
id: total_kwh_pulses
value: "0"

globals:
- id: initial_kwh_usage
type: float
restore_value: yes
initial_value: '00010'
- id: total_kwh_pulses
type: int
restore_value: yes

number:
- platform: template
id: Select_pulse_rate
name: "Pulsrate kWh"
optimistic: true
mode: box
min_value: '10'
max_value: '4000'
step: '10'
restore_value: yes
initial_value: '1000'

binary_sensor:
#------------------------# kwh #------------------------#
- platform: gpio
id: kwh_sensor_status
name: "kWh sensor status"
internal: False
pin:
number: D5
allow_other_uses: true
mode:
input: true
on_press:
- then:
lambda: id(total_kwh_pulses) += 1;
#------------------------# Kwh meter S0 poort 1 #------------------------#
sensor:
# ⬇ kwh meter s0 ⬇ #
- platform: pulse_meter
pin:
number: D5
allow_other_uses: true
name: "Actuele energie"
id: actual_power
icon: "mdi:flash"
internal_filter: ${impulslengte}
accuracy_decimals: 0 #3
unit_of_measurement: "W" #'kW'
state_class: measurement
device_class: power
filters:
lambda: return x * (60.0 / id(Select_pulse_rate).state)* 1000 ;

# ⬇ Totaal opgebracht ⬇ #
total:
unit_of_measurement: 'kWh'
name: "Totaal opgebracht"
id: W_opbrengst_totaal
state_class: total_increasing
device_class: energy
icon: "mdi:flash"
accuracy_decimals: 3
filters:
- lambda: return id (id(total_kwh_pulses) * (1.0 / id(Select_pulse_rate).state) );
# - lambda: return x * (1.0 / id(Select_pulse_rate).state);


# ⬇ Kwh meterstand ⬇ stand bij benadering #
- platform: template
id: kwh_total
name: "Actuele meterstand"
state_class: "total_increasing"
device_class: energy
icon: "mdi:flash"
update_interval: 1s
unit_of_measurement: 'kWh'
accuracy_decimals: 3
lambda: return id(initial_kwh_usage) + (id(total_kwh_pulses) * (1.0 / id(Select_pulse_rate).state) );

# ⬇ kwh pulses only web interface for debugging ⬇ #
- platform: template
id: kwh_pulses
name: "kwh pulses totaal"
state_class: "total_increasing"
lambda: return id(total_kwh_pulses);
accuracy_decimals: 0
internal: True
substitutions:
impulslengte: "30ms"

# # ⬇ Enable Home Assistant API ⬇ #
api:
services:
- service: meterstand_kwh
variables:
meter_value: float
then:
- globals.set:
id: initial_kwh_usage
value: !lambda "return ( meter_value ) ;"
- globals.set:
id: total_kwh_pulses
value: "0"

globals:
- id: initial_kwh_usage
type: float
restore_value: yes
initial_value: '00010'
- id: total_kwh_pulses
type: int
restore_value: yes

number:
- platform: template
id: Select_pulse_rate
name: "Pulsrate kWh"
optimistic: true
mode: box
min_value: '10'
max_value: '4000'
step: '10'
restore_value: yes
initial_value: '1000'

binary_sensor:
#------------------------# kwh #------------------------#
- platform: gpio
id: kwh_sensor_status
name: "kWh sensor status"
internal: False
pin:
number: D5
allow_other_uses: true
mode:
input: true
on_press:
- then:
lambda: id(total_kwh_pulses) += 1;
#------------------------# Kwh meter S0 poort 1 #------------------------#
sensor:
# ⬇ kwh meter s0 ⬇ #
- platform: pulse_meter
pin:
number: D5
allow_other_uses: true
name: "Actuele energie"
id: actual_power
icon: "mdi:flash"
internal_filter: ${impulslengte}
accuracy_decimals: 0 #3
unit_of_measurement: "W" #'kW'
state_class: measurement
device_class: power
filters:
lambda: return x * (60.0 / id(Select_pulse_rate).state)* 1000 ;

# ⬇ Totaal opgebracht ⬇ #
total:
unit_of_measurement: 'kWh'
name: "Totaal opgebracht"
id: W_opbrengst_totaal
state_class: total_increasing
device_class: energy
icon: "mdi:flash"
accuracy_decimals: 3
filters:
- lambda: return id (id(total_kwh_pulses) * (1.0 / id(Select_pulse_rate).state) );
# - lambda: return x * (1.0 / id(Select_pulse_rate).state);


# ⬇ Kwh meterstand ⬇ stand bij benadering #
- platform: template
id: kwh_total
name: "Actuele meterstand"
state_class: "total_increasing"
device_class: energy
icon: "mdi:flash"
update_interval: 1s
unit_of_measurement: 'kWh'
accuracy_decimals: 3
lambda: return id(initial_kwh_usage) + (id(total_kwh_pulses) * (1.0 / id(Select_pulse_rate).state) );

# ⬇ kwh pulses only web interface for debugging ⬇ #
- platform: template
id: kwh_pulses
name: "kwh pulses totaal"
state_class: "total_increasing"
lambda: return id(total_kwh_pulses);
accuracy_decimals: 0
internal: True
Loading

0 comments on commit a0742fd

Please sign in to comment.