Some semiconducting metal oxides as e.g. tin dioxide (SnO<sub>2</sub>), tungsten trioxide (WO<sub>3</sub>) or cobalt oxide (Co<sub>3</sub>O<sub>4</sub>) are well-known for their gas-dependent electrical properties and therefore they are utilized as active components in highly sensitive and cost-efficient resistive type gas sensors. Recently it was shown that it is possible to utilize the correlation of the electrical and the optical properties of these materials to build a new type of optical gas transducer based on metal oxide photonic crystals. However, a detailed theoretical description of the linking mechanism between the optical and the electrical property change was still missing. Utilizing n-type semiconducting WO3 for the detection of hydrogen (H<sub>2</sub>) as a model system we have shown, that free carrier absorption plays an important role in understanding the change in optical properties and the complex refractive index of WO<sub>3</sub>, respectively. In the presented work we will test this idea on p-type Co<sub>3</sub>O<sub>4</sub> for the detection of carbon monoxide. Therefore we synthesized cobalt(II,III) oxide photonic crystals (inverse opals) by a sol-gel based templating method. As expected, a gas induced change in the electrical properties can lead to a shift of the reflection peak due to a change in the refractive index of the material. We show that the characteristics of this optical response (e.g. its magnitude) can be manipulated by photonic band gap engineering, e.g. setting the stop band to the NIR range leads to an increase of the optical response compared to a stop band in the visible regime. The observed behavior is discussed by means of the optical dispersion of the complex refractive index of Co<sub>3</sub>O<sub>4</sub> and the Lorentz-Drude model.