{"id":4128,"date":"2026-05-03T09:00:00","date_gmt":"2026-05-03T09:00:00","guid":{"rendered":"https:\/\/pirhome.com\/?p=3914"},"modified":"2026-05-03T09:00:00","modified_gmt":"2026-05-03T09:00:00","slug":"pir-energy-saving-hvac-control","status":"publish","type":"post","link":"https:\/\/www.pirhome.com\/?p=4128","title":{"rendered":"PIR Sensor for Energy-Saving HVAC Control"},"content":{"rendered":"<h2>Project Overview<\/h2>\n<p>This project creates an energy-saving HVAC control system that automatically adjusts temperature settings based on room occupancy. When a room is occupied, the system maintains normal temperature; when the room is empty for a set period, it enters an energy-saving mode with a temperature setback. This can reduce heating and cooling costs by 10-20% annually.<\/p>\n<p><strong>Difficulty:<\/strong> Intermediate<br \/>\n<strong>Estimated time:<\/strong> 3-4 hours<br \/>\n<strong>Estimated cost:<\/strong> $30-50<\/p>\n<h2>How It Works<\/h2>\n<p>PIR sensors placed in key rooms detect occupancy. When no motion is detected for a set period, the system sends a signal to the HVAC system to adjust the temperature setpoint (higher for cooling, lower for heating). When occupancy is detected again, the system returns to the normal setpoint.<\/p>\n<h2>Materials Needed<\/h2>\n<ul>\n<li>ESP32 or ESP8266 (1)<\/li>\n<li>HC-SR501 PIR sensors (1-5)<\/li>\n<li>Jumper wires<\/li>\n<li>Power supply (5V 2A)<\/li>\n<li>Smart thermostat with API (Nest, Ecobee, or Home Assistant)<\/li>\n<\/ul>\n<h2>Home Assistant Setup<\/h2>\n<ol>\n<li>Install Home Assistant on a Raspberry Pi or server<\/li>\n<li>Add your thermostat integration<\/li>\n<li>Note the entity ID for your thermostat (e.g., climate.living_room)<\/li>\n<li>Enable ESPHome integration for PIR sensors<\/li>\n<\/ol>\n<h2>ESPHome Configuration<\/h2>\n<pre><code>esphome:\n  name: occupancy_sensors\n\nesp32:\n  board: esp32dev\n\nwifi:\n  ssid: \"YourWiFiSSID\"\n  password: \"YourWiFiPassword\"\n\napi:\n  password: \"YourAPIPassword\"\n\nbinary_sensor:\n  - platform: gpio\n    pin: GPIO4\n    name: \"Living Room Motion\"\n    device_class: motion\n    filters:\n      - delayed_on: 100ms\n      - delayed_off: 60000ms\n  \n  - platform: gpio\n    pin: GPIO5\n    name: \"Bedroom Motion\"\n    device_class: motion\n    filters:\n      - delayed_on: 100ms\n      - delayed_off: 60000ms\n<\/code><\/pre>\n<h2>Home Assistant Automations<\/h2>\n<pre><code># configuration.yaml\nautomation:\n  - alias: \"HVAC - Enter Away Mode\"\n    trigger:\n      - platform: state\n        entity_id: \n          - binary_sensor.living_room_motion\n          - binary_sensor.bedroom_motion\n        to: \"off\"\n        for: \"00:30:00\"\n    condition:\n      - condition: state\n        entity_id: binary_sensor.house_occupied\n        state: \"on\"\n    action:\n      - service: climate.set_temperature\n        target:\n          entity_id: climate.main_thermostat\n        data:\n          temperature: 62\n      - service: input_boolean.turn_off\n        target:\n          entity_id: input_boolean.house_occupied\n\n  - alias: \"HVAC - Return to Normal\"\n    trigger:\n      - platform: state\n        entity_id: \n          - binary_sensor.living_room_motion\n          - binary_sensor.bedroom_motion\n        to: \"on\"\n    condition:\n      - condition: state\n        entity_id: binary_sensor.house_occupied\n        state: \"off\"\n    action:\n      - service: climate.set_temperature\n        target:\n          entity_id: climate.main_thermostat\n        data:\n          temperature: 68\n      - service: input_boolean.turn_on\n        target:\n          entity_id: input_boolean.house_occupied\n<\/code><\/pre>\n<h2>Standalone Arduino Version<\/h2>\n<pre><code>\/\/ Standalone HVAC Controller with PIR\nconst int pirPin = 4;\nconst int relayPin = 5;\n\nunsigned long lastMotionTime = 0;\nconst unsigned long setbackDelay = 1800000;\nbool inSetback = false;\n\nvoid setup() {\n  pinMode(pirPin, INPUT);\n  pinMode(relayPin, OUTPUT);\n  digitalWrite(relayPin, LOW);\n  delay(60000);\n}\n\nvoid loop() {\n  bool motion = digitalRead(pirPin) == HIGH;\n  \n  if (motion) {\n    lastMotionTime = millis();\n    if (inSetback) {\n      digitalWrite(relayPin, LOW);\n      inSetback = false;\n    }\n  }\n  \n  if (!inSetback && (millis() - lastMotionTime > setbackDelay)) {\n    digitalWrite(relayPin, HIGH);\n    inSetback = true;\n  }\n  \n  delay(100);\n}\n<\/code><\/pre>\n<h2>Installation Steps<\/h2>\n<ol>\n<li>Place PIR sensors in key rooms at 2m height<\/li>\n<li>Connect sensors to ESP32 with long cables if needed<\/li>\n<li>Configure Home Assistant with ESPHome integration and thermostat<\/li>\n<li>Create automations for occupancy-based setback<\/li>\n<li>Test system to verify enters setback after no motion and returns when motion detected<\/li>\n<\/ol>\n<h2>Conclusion<\/h2>\n<p>This occupancy-based HVAC control system automatically reduces energy waste when rooms are empty, lowering utility bills without sacrificing comfort.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Project Overview This project creates an energy-saving HVAC control system that automatically adjusts temperature settings based on room occupancy. When a room is occupied, the system maintains normal temperature; when the room is empty for a set period, it enters an energy-saving mode with a temperature setback. This can reduce heating and cooling costs by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-4128","post","type-post","status-publish","format-standard","hentry","category-projects"],"blocksy_meta":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\r\n<title>PIR Sensor for Energy-Saving HVAC Control - PIRHOME<\/title>\r\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\r\n<link rel=\"canonical\" href=\"https:\/\/www.pirhome.com\/?p=4128\" \/>\r\n<meta property=\"og:locale\" content=\"en_US\" \/>\r\n<meta property=\"og:type\" content=\"article\" \/>\r\n<meta property=\"og:title\" content=\"PIR Sensor for Energy-Saving HVAC Control - PIRHOME\" \/>\r\n<meta property=\"og:description\" content=\"Project Overview This project creates an energy-saving HVAC control system that automatically adjusts temperature settings based on room occupancy. When a room is occupied, the system maintains normal temperature; when the room is empty for a set period, it enters an energy-saving mode with a temperature setback. This can reduce heating and cooling costs by [&hellip;]\" \/>\r\n<meta property=\"og:url\" content=\"https:\/\/www.pirhome.com\/?p=4128\" \/>\r\n<meta property=\"og:site_name\" content=\"PIRHOME\" \/>\r\n<meta property=\"article:published_time\" content=\"2026-05-03T09:00:00+00:00\" \/>\r\n<meta name=\"author\" content=\"nic@nicsky.com\" \/>\r\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\r\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"nic@nicsky.com\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\r\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128\"},\"author\":{\"name\":\"nic@nicsky.com\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\"},\"headline\":\"PIR Sensor for Energy-Saving HVAC Control\",\"datePublished\":\"2026-05-03T09:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128\"},\"wordCount\":257,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\"},\"articleSection\":[\"Projects\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4128#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128\",\"name\":\"PIR Sensor for Energy-Saving HVAC Control - PIRHOME\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\"},\"datePublished\":\"2026-05-03T09:00:00+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pirhome.com\\\/?p=4128\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pirhome.com\\\/?p=4128#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.pirhome.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PIR Sensor for Energy-Saving HVAC Control\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#website\",\"url\":\"http:\\\/\\\/www.pirhome.com\\\/\",\"name\":\"PIRHOME\",\"description\":\"PIR &amp; Motion Sensor\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.pirhome.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#organization\",\"name\":\"PIRHOME\",\"url\":\"http:\\\/\\\/www.pirhome.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.pirhome.com\\\/wp-content\\\/uploads\\\/2026\\\/02\\\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg\",\"contentUrl\":\"https:\\\/\\\/www.pirhome.com\\\/wp-content\\\/uploads\\\/2026\\\/02\\\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg\",\"width\":512,\"height\":512,\"caption\":\"PIRHOME\"},\"image\":{\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.pirhome.com\\\/#\\\/schema\\\/person\\\/41049b5236f9c77c9314997d070db3e3\",\"name\":\"nic@nicsky.com\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g\",\"caption\":\"nic@nicsky.com\"},\"sameAs\":[\"http:\\\/\\\/www.pirhome.com\"],\"url\":\"https:\\\/\\\/www.pirhome.com\\\/?author=1\"}]}<\/script>\r\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PIR Sensor for Energy-Saving HVAC Control - PIRHOME","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pirhome.com\/?p=4128","og_locale":"en_US","og_type":"article","og_title":"PIR Sensor for Energy-Saving HVAC Control - PIRHOME","og_description":"Project Overview This project creates an energy-saving HVAC control system that automatically adjusts temperature settings based on room occupancy. When a room is occupied, the system maintains normal temperature; when the room is empty for a set period, it enters an energy-saving mode with a temperature setback. This can reduce heating and cooling costs by [&hellip;]","og_url":"https:\/\/www.pirhome.com\/?p=4128","og_site_name":"PIRHOME","article_published_time":"2026-05-03T09:00:00+00:00","author":"nic@nicsky.com","twitter_card":"summary_large_image","twitter_misc":{"Written by":"nic@nicsky.com","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pirhome.com\/?p=4128#article","isPartOf":{"@id":"https:\/\/www.pirhome.com\/?p=4128"},"author":{"name":"nic@nicsky.com","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3"},"headline":"PIR Sensor for Energy-Saving HVAC Control","datePublished":"2026-05-03T09:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pirhome.com\/?p=4128"},"wordCount":257,"commentCount":0,"publisher":{"@id":"http:\/\/www.pirhome.com\/#organization"},"articleSection":["Projects"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pirhome.com\/?p=4128#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pirhome.com\/?p=4128","url":"https:\/\/www.pirhome.com\/?p=4128","name":"PIR Sensor for Energy-Saving HVAC Control - PIRHOME","isPartOf":{"@id":"http:\/\/www.pirhome.com\/#website"},"datePublished":"2026-05-03T09:00:00+00:00","breadcrumb":{"@id":"https:\/\/www.pirhome.com\/?p=4128#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pirhome.com\/?p=4128"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pirhome.com\/?p=4128#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.pirhome.com\/"},{"@type":"ListItem","position":2,"name":"PIR Sensor for Energy-Saving HVAC Control"}]},{"@type":"WebSite","@id":"http:\/\/www.pirhome.com\/#website","url":"http:\/\/www.pirhome.com\/","name":"PIRHOME","description":"PIR &amp; Motion Sensor","publisher":{"@id":"http:\/\/www.pirhome.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.pirhome.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/www.pirhome.com\/#organization","name":"PIRHOME","url":"http:\/\/www.pirhome.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.pirhome.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.pirhome.com\/wp-content\/uploads\/2026\/02\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg","contentUrl":"https:\/\/www.pirhome.com\/wp-content\/uploads\/2026\/02\/cropped-\u5fae\u4fe1\u56fe\u7247_2026-02-19_222409_472.jpg","width":512,"height":512,"caption":"PIRHOME"},"image":{"@id":"http:\/\/www.pirhome.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"http:\/\/www.pirhome.com\/#\/schema\/person\/41049b5236f9c77c9314997d070db3e3","name":"nic@nicsky.com","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/271d4eaab48e299e4fce771a8c43c537be3ac77a3115cc7de802a6c8b692d971?s=96&d=mm&r=g","caption":"nic@nicsky.com"},"sameAs":["http:\/\/www.pirhome.com"],"url":"https:\/\/www.pirhome.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4128"}],"version-history":[{"count":1,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4128\/revisions"}],"predecessor-version":[{"id":4648,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=\/wp\/v2\/posts\/4128\/revisions\/4648"}],"wp:attachment":[{"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pirhome.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}