I’m using mqtt sensors for this.
- Install mosquitto clients on your remote pi
- run the command or a script with crontab every 2 minutes
- publish the values to mqtt topic
- create mqtt sensor in ha
Example script:
#!/bin/bash
MQTT='192.168.123.123'
TOPIC='home/sensors/minibian/i2c_bus'
PAYLOAD=$(/usr/sbin/i2cdetect -y 1 | egrep '^20' | cut -d' ' -f2-9)
/usr/bin/mosquitto_pub -r -t "$TOPIC" -m "$PAYLOAD" -h "$MQTT"