Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError when running client.py #6

Open
ElwoodPowerBI opened this issue May 18, 2021 · 6 comments
Open

KeyError when running client.py #6

ElwoodPowerBI opened this issue May 18, 2021 · 6 comments

Comments

@ElwoodPowerBI
Copy link

I got to the step where I ran the "python3 raspberry_pi_client.py" command but I am seeing a KeyError, shown in attached png.

image

@jenfoxbot
Copy link
Contributor

Hello! Thanks for reaching out. Did you update the device connection string via the python_environment_setup.sh shell script? (Steps 6 - 8 under "Set up your Raspberry Pi" in the ReadMe)

@ElwoodPowerBI
Copy link
Author

@jenfoxbot I tried to run the script, but was getting an error. So I was copying each command into the prompt and when I changed "python" to "python3" command ran. But then the connection string was the issue, so I unhid and found the .env file and tried copying the connection string there. some screenshots below
image

image

@jmlp1
Copy link

jmlp1 commented Jun 10, 2022

@lmgeorge
Hi there,
I am having similar issues, had to break down the script into steps for creating the .env file

Once done I executed the source command, which I think is successful, however every time I tried to run the py script got the same error does not matter if executing as python or python3 any thoughts?

image

@jmlp1
Copy link

jmlp1 commented Jun 10, 2022

I figured out the first part of the problem, I was executing the python_environment_setup.sh with sh instead of using bash, which fixed the first script running issue, however still having problems with the python script

@jmlp1
Copy link

jmlp1 commented Jun 10, 2022

A little bit of perseverance and got it working, from raspberry_pi_client.py had to comment

  • Line 50 # pi_info['cpu_model'] = [i for i in pi_info_lines if i.startswith('model name')][0].split(':')[1].strip()
  • Line 254 # "cpu_model": pi_info['cpu_model'],

Once done telemetry started working and receiving data

image
image
image

@jmlp1
Copy link

jmlp1 commented Jun 11, 2022

Successfully connected a Raspberry Pi to Azure IoT Central, which via an MS Power Automate WorkFlow Rule sends alerts to D365 Field Service, just brilliant
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants