2023-05-27 16:52:05 +02:00
|
|
|
substitutions:
|
|
|
|
name: "geigercounter"
|
|
|
|
friendly_name: "Geigerzähler"
|
|
|
|
|
2022-11-05 23:47:51 +01:00
|
|
|
esphome:
|
2023-05-27 16:52:05 +02:00
|
|
|
name: ${name}
|
|
|
|
friendly_name: ${friendly_name}
|
|
|
|
name_add_mac_suffix: false
|
|
|
|
project:
|
|
|
|
name: sensor.radiation
|
|
|
|
version: "1.0"
|
|
|
|
min_version: 2022.11.0
|
|
|
|
|
|
|
|
esp32:
|
2022-11-05 23:47:51 +01:00
|
|
|
board: nodemcu-32s
|
2023-05-27 16:52:05 +02:00
|
|
|
framework:
|
|
|
|
type: arduino
|
2022-11-05 23:47:51 +01:00
|
|
|
|
|
|
|
wifi:
|
|
|
|
ssid: "Voltage-legacy"
|
|
|
|
password: !secret voltage_legacy_psk
|
2023-05-27 16:52:05 +02:00
|
|
|
use_address: ${name}.home
|
2022-11-05 23:47:51 +01:00
|
|
|
power_save_mode: high
|
|
|
|
fast_connect: on
|
|
|
|
|
|
|
|
# Enable fallback hotspot (captive portal) in case wifi connection fails
|
|
|
|
ap:
|
|
|
|
ssid: "Geigercounter Fallback Hotspot"
|
|
|
|
password: !secret fallback_psk
|
|
|
|
|
|
|
|
captive_portal:
|
|
|
|
|
|
|
|
# Enable logging
|
|
|
|
logger:
|
|
|
|
|
|
|
|
# Enable Home Assistant API
|
|
|
|
api:
|
|
|
|
encryption:
|
|
|
|
key: !secret apikey
|
|
|
|
|
|
|
|
ota:
|
|
|
|
password: !secret ota
|
|
|
|
|
|
|
|
spi:
|
2022-12-06 13:44:29 +01:00
|
|
|
clk_pin: 18
|
|
|
|
mosi_pin: 21
|
2022-11-05 23:47:51 +01:00
|
|
|
|
|
|
|
display:
|
|
|
|
- platform: max7219
|
2022-12-06 13:44:29 +01:00
|
|
|
cs_pin: 16
|
2022-11-05 23:47:51 +01:00
|
|
|
num_chips: 1
|
|
|
|
lambda: |-
|
2022-11-07 23:58:48 +01:00
|
|
|
if(id(sun_state).has_state()) {
|
|
|
|
// dim 7 segment's LED brighness at nighttime
|
|
|
|
if (id(sun_state).state == "below_horizon") {
|
|
|
|
it.set_intensity(2);
|
|
|
|
} else {
|
|
|
|
it.set_intensity(12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
it.print(" ");
|
|
|
|
it.printf("%2.2f uSh", id(dose_meter).state);
|
2022-11-05 23:47:51 +01:00
|
|
|
|
|
|
|
# Here we calc and include to the firmware a power and doze values of ionizing radiation as sensor outputs
|
|
|
|
sensor:
|
|
|
|
- platform: pulse_counter
|
2022-12-06 13:44:29 +01:00
|
|
|
pin: 19
|
2022-11-05 23:47:51 +01:00
|
|
|
unit_of_measurement: "µSv/h"
|
|
|
|
name: "Radioaktive Strahlungsleistung"
|
|
|
|
icon: "mdi:radioactive"
|
|
|
|
count_mode:
|
|
|
|
rising_edge: DISABLE
|
|
|
|
falling_edge: INCREMENT
|
2023-02-02 17:46:36 +01:00
|
|
|
# Hardware counter alows only 13us debounce, so we set it OFF:
|
|
|
|
use_pcnt: False
|
|
|
|
# When hw counter is OFF then we may set our filter time to SBM20 190 us Deadtime value or any other (also in microseconds):
|
|
|
|
internal_filter: 190us
|
2022-11-05 23:47:51 +01:00
|
|
|
update_interval: 60s
|
|
|
|
accuracy_decimals: 3
|
|
|
|
id: dose_meter
|
|
|
|
filters:
|
|
|
|
- sliding_window_moving_average: # 5-minutes moving average (MA5) here
|
|
|
|
window_size: 5
|
|
|
|
send_every: 1
|
2023-02-02 17:46:36 +01:00
|
|
|
- multiply: 0.0057 # SBM20 tube conversion factor of pulses into µSv/Hour
|
2022-11-05 23:47:51 +01:00
|
|
|
- platform: integration
|
|
|
|
name: "Gesamte Strahlungsdosis"
|
|
|
|
unit_of_measurement: "µSv"
|
|
|
|
sensor: dose_meter # link entity id to the pulse_counter values above
|
|
|
|
icon: "mdi:radioactive"
|
|
|
|
accuracy_decimals: 5
|
|
|
|
time_unit: min # integrate values every next minute
|
|
|
|
filters:
|
2023-02-02 17:46:36 +01:00
|
|
|
# obtained dose. Converting from mkSv/hour into mkSv/minute: [mkSv/h / 60] OR [mkSv/h * 0.0166666667].
|
|
|
|
# if my_dose_meter in CPM, then [0.0054 / 60 minutes] = 0.00009; so CPM * 0.00009 = dose every next minute, mkSv.
|
|
|
|
- multiply: 0.0166666667
|
2022-11-07 23:58:48 +01:00
|
|
|
text_sensor:
|
|
|
|
- platform: homeassistant
|
|
|
|
entity_id: sun.sun
|
|
|
|
id: sun_state
|