Getting values from Lora module connected on raspberry (HAOS installed)

I have HAOS installed on my raspberry, and try to use a HC12 module connected directly on this raspberry. It is for a reception of mail box recieveing mail or package, with also battery level. For fun I also send Termperature, Humidity, battery level from an arduino with HC12 with DHT22 and normally open magnetic Switch)
I try to find any information on how to read informations from HC12 module (from a GPIO) under HAOS.
=> Does some one already tried it? is it possible? if so, how to do it 100% with HAOS ?

Previously : This configuration was working perfectly on my previous configuration (raspberry under raspbian + HA on docker + python script. I changed to this new configuration after a crash of my SSD and after many readings that Supervisor mode is a must have.

Hmm… Perhaps it’s due to GPIO support being deprecated.

https://github.com/home-assistant/core/commit/8c679639913f0981c4d135ac5316ebf2199d8f2f

There’s an integration available from HACS to provide the capability.

https://github.com/thecode/ha-rpi_gpio

Thanks for your suggestion
Unfortunalty, it will not work because, rpi_gpio support only : Binary Sensor , Cover , Switch. In my case I send a string I need to read. Morover I need to send configuration command via AT command.
I wanted Supervisor mode, but in fact it is not compatible with GPIO (not directly), I think I will go back and install raspbian with HA on docker… with no Supervisor mode

Example from my previous configuration (on Domoticz):

#!/usr/bin/env python3

import serial
import time
import RPi.GPIO as GPIO
import requests

ser = serial.Serial(
	port='/dev/ttyS0',
	baudrate = 9600,
	parity=serial.PARITY_NONE,
	stopbits=serial.STOPBITS_ONE,
	bytesize=serial.EIGHTBITS,
	timeout=1
    )

GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT, initial=GPIO.LOW) # set pin 7 (GPIO4) to OUTPUT (SET pin of HC12)
GPIO.output(7, GPIO.LOW) # set HC12 to AT mode
ser.write(b"AT+DEFAULT\n") # Set HC12 to default configuraiton
time.sleep(0.5)
ser.write(b"AT+P4\n") # Set HC12 module to 8dBm
time.sleep(0.5)
GPIO.output(7, GPIO.HIGH) # set HC12 to normal mode
time.sleep(0.5)
 
print("Script ready, listening to HC12 radio messages and publish it")
ser.flushInput()
 
while 1:
    try:        
        size = ser.inWaiting()
        if size > 0:
            print(received_data)
           
            if ((len(received_data) == 4) and (received_data[0] == 'S1')):
                temperature = received_data[1]
                humidite = received_data[2]
                batterie = received_data[3]
                print(temperature)
                print(humidite)
                print(batterie)
                requests.get('http://localhost:8085/json.htm?type=command&param=udevice&idx=1357&svalue=' + ON)

    except IOError:
        print("restarting serial")
        ser.close()
        ser.open()
    except Exception as e:
        print("exception occured: ", e)
    time.sleep(2)
 
ser.close()

Another option might be to look at the capabilities of ESPHome:

The hardware is relatively inexpensive.

And there are also stand-alone LoRa modules that are very low power:

Thanks for the examples, they are interesting. Unfortunatly, it will not work as I expected (with HAOS) with ESPHome. At the moment, I don’t want to reinstall again HA again, with docker. I will just get make a gateway with a classic ESP32 or ESP8266 to push translate RF signal from mailbox to HA via wifi with MQTT protocole.

Take a look at Gateway_MQTT.ino