{"id":3220,"date":"2024-01-05T15:05:44","date_gmt":"2024-01-05T13:05:44","guid":{"rendered":"https:\/\/iot-devices.com.ua\/?p=3220"},"modified":"2024-01-05T15:08:37","modified_gmt":"2024-01-05T13:08:37","slug":"about-changes-in-esphome-configuration-validation-pin-reuse-validation-en","status":"publish","type":"post","link":"https:\/\/iot-devices.com.ua\/en\/about-changes-in-esphome-configuration-validation-pin-reuse-validation-en\/","title":{"rendered":"About changes in ESPHome configuration validation &#8211; Pin Reuse validation"},"content":{"rendered":"\n<p>Recently, the ESPHome firmware has been changed to prevent the same controller I\/O ports from being reused to create different entities.<\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/NbMNFqAgMd6hpZWh-NXKLErqXahzagxGzuFmMuTS-pOh1kLpEa0c3RNqNSzc3sHs_L5xhrqexi882bwe6vmlPBunFqvNpaia62ckDj0jKklpRWig2qTRTOSN_sgx3lsHbxyk9dNmbbe-ZTtzwnI6B8I\" alt=\"\"\/><\/figure>\n\n<p>This mechanism is called Pin Reuse validation: https:\/\/esphome.io\/changelog\/2023.12.0.html#pin-reuse-validation<\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/al5mD8CoLfniPx9Wa-BU1sn4zydlCeLW4Wf893gfEzsXhYkR9asb_Bz10rJvE1mCRTV_qMMjSbQNDINUbw8e9SLkCRnpZS3G2m0X1Vx_PiE0AjiYdQjptfwD_p974q91ikm2pzwRGOME8sPwvugsy8c\" alt=\"\"\/><\/figure>\n\n<p>These updates in ESPHome version 2023.12.0 also affected the examples developed by our company for the GGreg20_V3 Geiger counter ionizing radiation detector module. <\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/5L3UxVVlENtNnMlume0WJMJHI37oR2ElKCXLiYYSn1VyfVqxqpPE4SjYiDFPUtmh6z9FuZedfXyP-8mJVI7m4go2yYCBGNLCewTZl7uowzU59TZHKDTWN8UMefsV8qoUlQai8VyhAEvcnMs9N2uITcA\" alt=\"\"\/><\/figure>\n\n<p>According to the user&#8217;s request (https:\/\/github.com\/iotdevicesdev\/GGreg20_V3-ESP32-HomeAssistant-ESPHome\/issues\/2) regarding the repository for GGreg20_V3-ESP32-HomeAssistant-ESPHome, we have made the necessary updates to the configuration YAML file. <\/p>\n\n<p>Now this example will work properly with the new ESHome configuration validation and you will be able to upgrade to newer versions of ESPHome without any problems.<\/p>\n\n<p>We also plan to update other repositories with this issue.<\/p>\n\n<p>You can also make changes to your ESPHome YAML configuration files yourself. <\/p>\n\n<p>As of now, we know of two ways to fix the configuration so that it passes the new configuration validation rules:<\/p>\n\n<p><strong>Way #1.<\/strong> If you need to reuse the pin, use https:\/\/esphome.io\/components\/copy.html instead<\/p>\n\n<p>This is the more correct path that we recommend using.<\/p>\n\n<p>For sensor entities:<\/p>\n\n<p><a href=\"https:\/\/esphome.io\/components\/copy.html#copy-sensor\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/components\/copy.html#copy-sensor<\/a><\/p>\n\n<p>For binary sensor entities:<\/p>\n\n<p><a href=\"https:\/\/esphome.io\/components\/copy.html#copy-binary-sensor\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/components\/copy.html#copy-binary-sensor<\/a><\/p>\n\n<p>An example of the code you should get is given here:<\/p>\n\n<p><a href=\"https:\/\/github.com\/iotdevicesdev\/GGreg20_V3-ESP32-HomeAssistant-ESPHome\/issues\/2#issuecomment-1867814996\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/iotdevicesdev\/GGreg20_V3-ESP32-HomeAssistant-ESPHome\/issues\/2#issuecomment-1867814996<\/a><\/p>\n\n<p><strong>Way #2.<\/strong> You can also use the exception described in the ESPHome Pin Schema document:<\/p>\n\n<p><a href=\"https:\/\/esphome.io\/guides\/configuration-types#config-pin-schema\" target=\"_blank\" rel=\"noopener\">https:\/\/esphome.io\/guides\/configuration-types#config-pin-schema<\/a><\/p>\n\n<p>config key: &#8220;allow_other_uses&#8221;<\/p>\n\n<p>You can use this config key to override the control of reusing pins in exceptional situations. <\/p>\n\n<p>Please note that the key must be specified not only in duplicate entities, but in each entity where a particular pin is used for the configuration to pass validation:<\/p>\n\n<p>Wrong keys:<\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/brK3IMK56GkE7Naz0ylxpNNlaZTm-JOUG4uYq_uFc6Zq6XTr67ROnrjGh_jJOepI1EmVQ3lHEctRRHz0gLsEzCW6VkVYnW8g1qFLWjyaylBBnpE6bY2aBEqnJXnEpJi7wnP9eVHXtVHv3rfN4f1ULsI\" alt=\"\"\/><\/figure>\n\n<p>Right keys:<\/p>\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh7-us.googleusercontent.com\/_3ZcmuT-cY6legairb3Ljg8eRLvQNcJSwg0NanYRmLRuSwUggLnJby9ezW7WNrGrrvPMRYH3iqQ0vsBppkuRMCO58xj70t7f3QGf3UG-LFUvgJvysG4eIIyAy1RVGJp8vCMDEPGNSMaz7dBbMm1Qc3c\" alt=\"\"\/><\/figure>\n\n<p>You should get the following code using the &#8220;alow_other_uses&#8221; key:<\/p>\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># YAML code example:\n- platform: pulse_counter\n    pin: \n      number: GPIO2\n      allow_other_uses: true\n    state_class: \"measurement\"\n    unit_of_measurement: 'CPM'\n    name: 'Ionizing Radiation Power CPM'\n    count_mode: \n      rising_edge: DISABLE\n      falling_edge: INCREMENT # GGreg20_V3 uses Active-Low logic\n  # It seems that only one instance of pulse counter internal filters can be set\n  # So here no any debounce filters for CPM value \n    use_pcnt: False\n    internal_filter: 180us\n    update_interval: 60s\n    accuracy_decimals: 0\n    id: my_cpm_meter\n \n  - platform: pulse_counter\n    pin:\n      number: GPIO2\n      allow_other_uses: true\n      inverted: True\n      mode: \n        input: True \n        pullup: False\n        pulldown: False\n    unit_of_measurement: 'uSv\/Hour'\n    name: 'Ionizing Radiation Power'\n    count_mode: \n      rising_edge: DISABLE\n      falling_edge: INCREMENT\n    update_interval: 60s\n    accuracy_decimals: 3\n    id: my_dose_meter\n    filters:\n  #    - sliding_window_moving_average: # 5-minutes moving average (MA5) here\n  #        window_size: 5\n  #        send_every: 1      \n      - multiply: 0.0057 # or 0.00332 for J305 by IoT-devices tube conversion factor of pulses into uSv\/Hour\n# END of YAML code example\n<\/pre>\n\n<p>You can choose which of the methods suits your DIY project.<\/p>\n\n<p>That&#8217;s all. Good luck!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, the ESPHome firmware has been changed to prevent the same controller I\/O ports from being reused to create different entities. This mechanism is called Pin Reuse validation: https:\/\/esphome.io\/changelog\/2023.12.0.html#pin-reuse-validation These updates in ESPHome version 2023.12.0 also affected the examples developed by our company for the GGreg20_V3 Geiger counter ionizing radiation detector module. According to the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3219,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","omw_enable_modal_window":"enable","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[89,88],"tags":[210,96,98,400],"class_list":["post-3220","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-news","category-tips-en","tag-esphome-en","tag-ggreg20_v3-en","tag-home-assistant-en","tag-yaml-en","entry","has-media","owp-thumbs-layout-horizontal","owp-btn-normal","owp-tabs-layout-horizontal","has-no-thumbnails","has-product-nav"],"_links":{"self":[{"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/posts\/3220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/comments?post=3220"}],"version-history":[{"count":2,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/posts\/3220\/revisions"}],"predecessor-version":[{"id":3222,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/posts\/3220\/revisions\/3222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/media\/3219"}],"wp:attachment":[{"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/media?parent=3220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/categories?post=3220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/iot-devices.com.ua\/en\/wp-json\/wp\/v2\/tags?post=3220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}