IoT Based Industrial Safety and Gas Detection in Smart Factories