Git Product home page Git Product logo

Comments (5)

Herbi-1966 avatar Herbi-1966 commented on June 22, 2024

affected lines in yaml code:

esphome:
name: "esp32-ggreg20-v3"
#...
#...
binary_sensor:

  • platform: gpio
    name: "Pulse input state"
    id: my_pulse_input
    pin:
    number: 23
    inverted: True
    mode:
    input: True
    #...
    #...
    sensor:
  • platform: pulse_counter
    pin: GPIO23
    unit_of_measurement: 'CPM'
    name: 'Ionizing Radiation Power CPM'
    count_mode:
    rising_edge: DISABLE
    #...
    #...
  • platform: pulse_counter
    pin: GPIO23
    unit_of_measurement: 'uSv/Hour'
    name: 'Ionizing Radiation Power'
    count_mode:
    rising_edge: DISABLE
    falling_edge: INCREMENT
    #...
    #...

from ggreg20_v3-esp32-homeassistant-esphome.

iotdevicesdev avatar iotdevicesdev commented on June 22, 2024

The problem is very easy to solve with the help of special methods available in ESPHome.
But it will take me some time to make and test the appropriate changes to this file.

While I'm doing that, you can make the changes yourself in the following way:

When you need to reuse a pin, use https://esphome.io/components/copy.html
For sensor entities:
https://esphome.io/components/copy.html#copy-sensor
For binary sensor entities:
https://esphome.io/components/copy.html#copy-binary-sensor

Thus, you should get something like this:

- platform: pulse_counter
  pin: GPIO23
  unit_of_measurement: 'CPM'
  name: 'Ionizing Radiation Power CPM'
  count_mode: 
    'rising_edge': DISABLE
    falling_edge: INCREMENT # GGreg20_V3 uses Active-Low logic
# It seems that only one instance of pulse counter internal filters can be set
# So here no any debounce filters for CPM value 
# use_pcnt: False
# internal_filter: 190us
  update_interval: 60s
  accuracy_decimals: 0
  id: my_cpm_meter

- platform: copy
  source_id: my_cpm_meter
  unit_of_measurement: 'CPM'
  name: 'Ionizing Radiation Power CPM MA5'
  accuracy_decimals: 0
  id: my_cpm_meter_ma5
  filters:
    - # sliding_window_moving_average: # 5-minute moving average (MA5) here
        window_size: 5
        send_every: 1      

- platform: copy
  source_id: my_cpm_meter
  unit_of_measurement: 'uSv/Hour'
  name: 'Ionizing Radiation Power'
  accuracy_decimals: 3
  id: my_dose_meter
  filters:
# - sliding_window_moving_average: # 5-minute moving average (MA5) here
# window_size: 5
# send_every: 1      
    - multiply: 0.0057 # or 0.00332 for J305 by IoT-devices tube conversion factor of pulses into uSv/Hour 

- platform: integration
  name: "Total Ionizing Radiation Dose"
  unit_of_measurement: "uSv"
  sensor: my_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:
    # received dose. Converting from uSv/hour to uSv/minute: [uSv/h / 60] OR [uSv/h * 0.0166666667]. 
    # if my_dose_meter is in CPM, then [0.0057 / 60 minutes] = 0.000095; so CPM * 0.000095 = dose every next minute, uSv.
    - multiply: 0.0166666667

I hope that after these changes, which I have given in the example, everything will work for you.
I wish you success,
Oleksii

from ggreg20_v3-esp32-homeassistant-esphome.

iotdevicesdev avatar iotdevicesdev commented on June 22, 2024

yaml-file and documentation -> updated

from ggreg20_v3-esp32-homeassistant-esphome.

Herbi-1966 avatar Herbi-1966 commented on June 22, 2024

from ggreg20_v3-esp32-homeassistant-esphome.

iotdevicesdev avatar iotdevicesdev commented on June 22, 2024

You are welcome!
Also you can see the ESPHome Pin Schemma document:
https://esphome.io/guides/configuration-types#config-pin-schema
config key: "allow_other_uses"
You can use this key to override pin reuses in special situations.
BR,
Oleksii

from ggreg20_v3-esp32-homeassistant-esphome.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.