Does a smart hub have an IP address ?
As pictured, a smart hub that is connected to a WiFi network will have an IP address. Any devices on WiFi networks need an IP address in order to be functional.
To access IoT devices from the outside, is the port forwarding only
for IP devices (IP camera in the figure) ? Do other non IP devices
(Z-Wave devices in the figure) also use port forwarding, even they use
a smart hub to be connected to the internet. How this could be done ?
Port forwarding is a technique for allowing IP devices residing on private networks to be reached from the public internet, using NAT. Since those devices are not on an IP network, this does not apply to them. They will be controlled through the hub.
Has the Mirai attack (in 2016) infected only IP devices or also non IP
There's some pretty good information out there about what devices were targeted. The targets were mostly Linux-based IoT devices that were publicly exposed and had default credentials. Mirai targeted only IP connected devices; other devices were unaffected.