There are a lot of ways to bring an ESP in life and to communicate with it.
For example programming with the Arduino IDE in C++ (or MicroPython ?), ESPEasy, ESPHome and so on.
I personally use the Arduino IDE and since a week I work with ESPHome (I flashed a XIAOMI Bluetooth Hygrometer with a new firmware in order to communicate with it to pimatic. After that I “programmed” a ESP32 with YAML-templates to read and to transmit the BLE-data over MQTT). All methods in common is the use of wifi and MQTT. There are tutorials about programming a ESP8266 with the Arduino IDE in the web. Look for sourcecode about wifi, mqtt and pir.
In this case a fast method without programming is the use of ESPHome (cut & paste). I like it! Check out this short tutorial with good examples:
https://www.galagaking.org/2019/11/05/esphome-workshop/
To integrate your smart PIR in pimatic you have to install a MQTT-broker (Mosquitto) on your raspi and after that you have to install the plugin
"mqtt" in pimatic (settings: host-IP, port). Create a new device, class MqttPresenceSensor. Fill in your chosen topic for your PIR, click at “onMessage”, type “true”, click at “offMessage”, type “off”. Create this item.