Wireless sensor networks (WSNs) are currently being deployed in everyday objects to collect and transmit information related to humidity, temperature, heartbeat, motion, etc. Such networks are part of the massive machine-type communication (mMTC) scenario within the fifth/sixth generation of wireless networks. In this paper, we consider the optimization and design of an optical WSN composed of multiple battery-powered sensor nodes based on light-emitting diode transmitters. Extending our previous work, we take into account both line-of-sight and diffuse-light propagation, and show that in indoor scenarios, diffuse radiation can improve link availability under shadowing/blocking and extend battery life. In order to optimize the optical wireless link parameters, we use a machine-learning approach based on a genetic algorithm to ascertain the performance limits of the system. The presented results indicate that the proposed system is a viable wireless option for WSNs within the context of mMTC.