Maintain a relation table among devices and in & out devices.
Solution 1:
For Device_Relation Table
+------------------+--------------+
| Of Table | Column |
+------------------+--------------+
| Indoor | net_id | -- <--- pk
| Outdoor | net_id | -- <--- pk
| Devices | device_id | -- <--- pk
| Device_relations | d.device_id, | -- <--- pk
| | od.net_id, | -- <--- fk
| | id.net_id | -- <--- fk
+------------------+--------------+
Solution 2:
For In_Out_Relation Table
+------------------+--------------+
| Of Table | Column |
+------------------+--------------+
| Indoor | net_id | -- <--- fk
| Outdoor | net_id | -- <--- fk
| in_out_id | in_out_id | -- <--- pk
+------------------+--------------+
For Devices Table
+------------------+--------------+
| Of Table | Column |
+------------------+--------------+
| Devices | device_id | -- <--- pk
| In_Out_Relation | io.in_out_id | -- <--- fk
+------------------+--------------+