You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to make use of the HAT for gathering digital and analog input and giving outputs with a Python program and AWS IoT. This would run indefinitely and send and receive information from my script ideally.
When i try to implement the same in the following manner.
def on_connect(client, userdata, flags, rc):
if rc == 0:
print("Connected to AWS IoT")
client.subscribe(MQTT_TOPIC_SUBSCRIBE)
else:
print("Connection to AWS IoT failed")
def on_message(client, userdata, msg):
print(f"Received message from topic {msg.topic}: {str(msg.payload.decode('utf-8'))}")
message = json.loads(msg.payload)
if "desiredTemperature" in message:
desired_temperature = message["desiredTemperature"]
print(f"Setting desired temperature to: {desired_temperature}")
set_temperature(desired_temperature)
I'm trying to make use of the HAT for gathering digital and analog input and giving outputs with a Python program and AWS IoT. This would run indefinitely and send and receive information from my script ideally.
When i try to implement the same in the following manner.
def on_connect(client, userdata, flags, rc):
if rc == 0:
print("Connected to AWS IoT")
client.subscribe(MQTT_TOPIC_SUBSCRIBE)
else:
print("Connection to AWS IoT failed")
def on_message(client, userdata, msg):
print(f"Received message from topic {msg.topic}: {str(msg.payload.decode('utf-8'))}")
message = json.loads(msg.payload)
if "desiredTemperature" in message:
desired_temperature = message["desiredTemperature"]
print(f"Setting desired temperature to: {desired_temperature}")
set_temperature(desired_temperature)
def read_sensors():
temperature = ind.get0_10In(STACK_LEVEL, TEMP_INPUT_CHANNEL)
humidity = ind.get0_10In(STACK_LEVEL, HUMIDITY_INPUT_CHANNEL)
return temperature, humidity
I get an error stating "An error occurred in the publish thread: [Errno 2] No such file or directory: '/dev/i2c-1'
The program works ideally when i comment out any code with regards to the megaind library and use dummy data.
The text was updated successfully, but these errors were encountered: