I’ve considered this before. There are a couple problems with scanning the items’ barcodes as they enter and exit the fridge:
To be more efficient you need two barcode scanners, one for incoming and one for outgoing: toggling the mode back and forth with a button will get old fast.
Even with two barcode scanners, it gets old fast. What we need is passive RFID in product packaging. That will make building smart fridges a whole lot easier AND make tracking their inventory and expiration dates automatic.
Howabout simple scanning the barcode of every item you buy at the grocery store as you put them away in the fridge/pantry and then scanning them as they get thrown away/recycled?