Run a code in ubuntu

after typing the code, how are supposed to run the code. i saved the code for ‘checking device status’. but i have not recieved any output. what should i do?

when i ran the code it was showing ‘no module named boltiot’

@sanikaliya28
After you have save the code you need to give command to run the code in Ubuntu.
to run the code you need to provide instruction given below:
sudo python3 filename.py
python3 is used run the .py file extension
sudo command allows you to run programs
filename implies what file name you have given to your saved file
Example:
sudo python3 device_status.py
and the output you will get something like this:
{“value”: “offline/online”, “time”: null, “success”: 1}
value depends on weather your Bolt module is connected to cloud or no
if connected it will show you “online” otherwise “offline”
it also shows you the current timing if your bolt module is online and if it is offline it will show you the output as null.
success status will always shows you the value 1 because even if your device is offline it show the value as 1 because the code written is correct and providing you no error other wise if the code is error it doesn’t even show the offline value.

1 Like

if this is happening could you please share me your code and output part by blurring the api_key and Bolt device ID

its working thank you so much

1 Like

@sanikaliya28
You are most welcome.