<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Exemplos de Componentes Visuais para iPython
Step1:  Barra
Step2:  Label
Step3:  Criando dois componentes visuais
Step4:  Renderizando componentes visuais
Step5:  Criando um componente que consome mensagens do MQTT
Step6:  Conectando os componentes
Step7:  Dashboard de componentes
Criando o consumidor_1 e seus widgets
Step8:  Criando o consumidor_2 e seus widgets
Step9:  Criando o consumidor_3 e seus widgets
Step10:  Criando o consumidor_4 e seus widgets
Step11:  Criando o consumidor_avg e seus widgets
Step12:  Organizando os componentes visualmente
Step13:  Conectando componentes visuais e seus respectivos consumidores
<ASSISTANT_TASK:>
Python Code:
from resources.iot.device import IoT_sensor_consumer
from IPython.core.display import display
import ipywidgets as widgets
from resources.iot.device import IoT_mqtt_publisher, IoT_sensor
Explanation: Exemplos de Componentes Visuais para iPython
End of explanation
widgets.FloatProgress(value=30.0, min=0, max=100.0, bar_style='danger', orientation='vertical')
widgets.FloatProgress(value=60.0, min=0, max=100.0, bar_style='info', orientation='horizontal', description='pressão: ')
Explanation: Barra
End of explanation
widgets.Label("isto é um label")
Explanation: Label
End of explanation
widget       = widgets.FloatProgress(min=0, max=100.0, bar_style='info', orientation='vertical', description='exemplo') # 'success', 'info', 'warning', 'danger' or ''
widget_label = widgets.Label("isto é um label")
Explanation: Criando dois componentes visuais
End of explanation
display(widget, widget_label)
Explanation: Renderizando componentes visuais
End of explanation
consumer = IoT_sensor_consumer("localhost",1883,"sensor/+/+")
Explanation: Criando um componente que consome mensagens do MQTT
End of explanation
consumer.connect(widget, widget_label)
Explanation: Conectando os componentes
End of explanation
widget_1       = widgets.FloatProgress(min=0, max=40.0, bar_style='info', orientation='vertical') 
widget_1_label = widgets.Label()
consumer_1 = IoT_sensor_consumer("localhost",1883,"sensor/1/+")
Explanation: Dashboard de componentes
Criando o consumidor_1 e seus widgets
End of explanation
widget_2       = widgets.FloatProgress(min=0, max=90.0, bar_style='warning', orientation='vertical')
widget_2_label = widgets.Label()
consumer_2 = IoT_sensor_consumer("localhost",1883,"sensor/2/+")
Explanation: Criando o consumidor_2 e seus widgets
End of explanation
widget_3       = widgets.FloatProgress(min=0, max=40.0, bar_style='info', orientation='vertical')
widget_3_label = widgets.Label()
consumer_3 = IoT_sensor_consumer("localhost",1883,"sensor/3/+")
Explanation: Criando o consumidor_3 e seus widgets
End of explanation
widget_4       = widgets.FloatProgress(min=0, max=90.0, bar_style='warning', orientation='vertical')
widget_4_label = widgets.Label()
consumer_4 = IoT_sensor_consumer("localhost",1883,"sensor/4/+")
Explanation: Criando o consumidor_4 e seus widgets
End of explanation
widget_avg       = widgets.FloatProgress(min=0, max=90.0, bar_style='success', orientation='horizontal')
widget_avg_label = widgets.Label()
consumer_avg = IoT_sensor_consumer("localhost",1883,"sensor/*/temperature/avg")
Explanation: Criando o consumidor_avg e seus widgets
End of explanation
separator = widgets.Label(value=" ---------- ")
col_1 = widgets.VBox([widget_1, widget_1_label])
col_2 = widgets.VBox([widget_2, widget_2_label])
col_3 = widgets.VBox([widget_3, widget_3_label])
col_4 = widgets.VBox([widget_4, widget_4_label])
col_5 = widgets.HBox([widget_avg, widget_avg_label])
row_1 = widgets.HBox([separator, col_1, separator, col_2, separator, col_3, separator, col_4])
row_2 = widgets.HBox([col_5])
display(row_1)
display(row_2)
Explanation: Organizando os componentes visualmente
End of explanation
consumer_1.connect(widget_1, widget_1_label)
consumer_2.connect(widget_2, widget_2_label)
consumer_3.connect(widget_3, widget_3_label)
consumer_4.connect(widget_4, widget_4_label)
consumer_avg.connect(widget_avg, widget_avg_label)
Explanation: Conectando componentes visuais e seus respectivos consumidores
End of explanation
<END_TASK>