Connecting a Sparkfun ThingPlus ESP32-S2 WROOM to Adafruit IO

After my previous success getting data into Azure IoT Central I now wanted a way to send data the other way. That is to the device from the cloud. However, I could see this being a challenge if I continued to use Azure as my cloud endpoint. What I really needed was something simpler to help me better understand the core communication concepts.

With this in mind I discovered:

https://learn.adafruit.com/

that is much easier to use to do the basic stuff I wanted.

I therefore went to Adafruit IO and created a free account. This will then give you access to:

https://io.adafruit.com/

I then needed to create a ‘Feed’ into which the data from my device would be sent so that it could then appear in the Adafruit IO console. You can follow these instructions to create a ‘Feed’:

https://learn.adafruit.com/adafruit-io-basics-feeds/overview

image

To get the credentials you’ll need to connect to the feed you just created you’ll need to select the ‘key’ icon in the top right of the window as shown above to reveal the details.

image

You should see a dialog like that shown above with your Active key. It is also handy to grab the sample code displayed below.

You’ll need the following headers/libraries in your code:

#include <Arduino.h>
#include <WiFi.h>
#include <Adafruit_MQTT.h>
#include <Adafruit_MQTT_Client.h>

you’ll also need to define a few things:

#define AIO_SERVER “io.adafruit.com”
#define AIO_SERVERPORT 1883
#define AIO_USERNAME “<Adafruit IO user name>
#define AIO_KEY “<Your Active key>
#define WLAN_SSID “<Your WiFi name>
#define WLAN_PASS “<Your Wifi password>

You’ll need to enter your own values for the last few to suit your own environment.

Next, you need to connect to the feed you created using:

// Setup the MQTT client class by passing in the WiFi client and MQTT server and login details.


Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, AIO_SERVERPORT, AIO_USERNAME, AIO_KEY);

Adafruit_MQTT_Publish feed= Adafruit_MQTT_Publish(&mqtt, AIO_USERNAME “/feeds/<Your feed name>”);

The feed variable here is where you will ‘publish’ data to be sent to the Adafruit IO console. The main loop running on the device will then contain something like this:

if (!feed.publish(ciaaht_getTemp())) {
Serial.println(F(“Failed”));}
else {
Serial.println(F(“Success”));}

which in essence, publishes data to the feed you created. In my case, I’m feeding in temperatures data via the function ciaaht_getTemp() which get the temperature from the DHT20.

There is a little bit more to it than that, but all the code is here:

https://github.com/directorcia/Azure/tree/master/Iot/ESP32-S2/IO-Adafruit-Publish

including the custom temperature sensor functions code I created previously.

image

With the code now uploaded to the ESP-32 I was able to see the data appearing in my feed in Adafruit IO as shown above. You’ll also see in my code that I used the on board LED as kind of indicator to let me know if things were working. A visual debugger if you like.

As you can see, getting data into Adafruit IO is much, much easier than into Azure IoT Central and I understand why that is and I’d suggest people start with Adafruit IO before moving to Azure. There is far less code with Adafruit IO making far easier to debug and understand.

With this now working and displaying temperature from my sensor, it is time to try and now send data to the device to control it from the cloud. Look out for that update coming soon!

Need to Know podcast–Episode 303

Join me for all the news an updates from Microsoft Build as well as a look at the Microsoft Package Manager, Winget.

This episode was recorded using Microsoft Teams and produced with Camtasia 2023.

You can listen directly to this episode at:

https://ciaops.podbean.com/e/episode-303-winget/

Subscribe via iTunes at:

https://itunes.apple.com/au/podcast/ciaops-need-to-know-podcasts/id406891445?mt=2

The podcast is also available on Stitcher at:

http://www.stitcher.com/podcast/ciaops/need-to-know-podcast?refid=stpr

Don’t forget to give the show a rating as well as send me any feedback or suggestions you may have for the show

Brought to you by www.ciaopspatron.com

Resources

@directorcia

@directorcia@twit.social

Join my shared channel

CIAOPS merch store

Become a CIAOPS Patron

CIAOPS Blog

YouTube edition of this podcast

Microsoft Build

Microsoft Build Book of News

Expanding IT value in Windows 11 Enterprise and Intune

Windows 365 boot

Announcing new Windows 11 innovation, with features for secure, efficient IT management and intuitive user experience

Microsoft Mesh: Transforming how people come together in the modern workplace

Bringing the power of AI to Windows 11 – unlocking a new era of productivity for customers and developers with Windows Copilot and Dev Home

Hardening Windows Clients with Microsoft Intune and Defender for Endpoint

Cyber Signals: Shifting tactics fuel surge in business email compromise

Automatically disrupt adversary-in-the-middle (AiTM) attacks with XDR

Use the winget tool to install and manage applications

Winstall.app

Wingetui

Introduction to Exchange Online Protection

This video is the technical session from my May 2023 Need to Know webinar that focuses on helping people understand Microsoft 365. The aim is to help viewers get an overview of how Exchange Online Protection secures their environment and where they can go to made additional adjustments if required.

The session was recorded using Microsoft Teams.

You can find the slide deck for this session here – https://www.slideshare.net/directorcia/may-2023-ciaops-need-to-know-webinar

Get Teams Meeting Attendees via PowerShell and the Microsoft Graph

Here’s a handy way to get a list of attendees in Microsoft Teams using PowerShell. I have uploaded the script to do this here:

https://github.com/directorcia/Office365/blob/master/tms-attend-get.ps1

Before you run the script you’ll need to have the Graph PowerShell module installed.

image

You’ll also need to set some variable values for your own environment in the script. You can do this by locating $tenantid in the script as shown above, and setting that to your own tenant URL. Then find $meetingjoinurl and set that to the URL for that meeting. Finally, set $useremail to the email address of the user who created the meeting.

image

The meeting URL is the link people selected to join the meeting as shown above. You’ll also find it in the configuration for the meeting.

image

With all those settings updated, when you run the script it should look something like shown above. The script will connect to the Microsoft Graph with the scopes required to read the meeting details. You may be requested to login to the tenant and then potentially consent to these scopes during the connection phase. The required scopes are:

OnlineMeetingArtifact.Read.All
OnlineMeetings.Read

The script will get the GUID of the creator of the meeting from the email you specified followed by the meeting id from the meeting join link you specified, then the report id for that meeting and finally the report details for the meeting. It will then display the email address (if recorded) of attendees as shown above.

Of course, you can just download the CSV meeting report from the Teams page I know, but this process will be first step in eventually using Power Automate to get meeting attendees and send them an automatic follow up after the meeting. Stay tuned for details on that coming soon. This is simply proof of concept and a handy option if you do indeed just want to use PowerShell to get a list of meeting attendees.

Using the Defender for Endpoint API and PowerShell (Updated)

A while back I wrote this post:

Using the Defender for Endpoint API and PowerShell

Problem is, the script that I developed:

https://github.com/directorcia/Office365/blob/master/endpoint-api-svbm.ps1

now doesn’t seem to bring back any results!

image

It used the following API:

https://api.securitycenter.microsoft.com/api/machines/SoftwareVulnerabilitiesByMachine

which isn’t generating any data or any errors!

image

The above returned results shows a good status but the value of data is empty.

So for now I’ll have to assume that this API is unavailable. No fear I’ve developed a new script:

https://github.com/directorcia/Office365/blob/master/mde-vul-get.ps1

image

image

which will not only list out the vulnerabilities but also export to a CSV file.

image

That allows you to sort and filter the results any way you wish.

To get the script working you still need the following API permissions for your Azure AD App with the WindowsDefenderATP API:

Application permissions = Vulnerability.Read.All

Application permissions = Machine.Read.All, Machine.ReadWrite.All

like so:

image

You also need to ensure you change the Azure AD App information in the script to match your own:

image

If you want to export more information you should be able to easily modify the script which firstly get the machine info and then the vulnerabilities on each.

Hopefully, this give people what they need until the original API comes back on line.

Need to Know podcast–Episode 302

In this episode I share some thoughts around AI and the impact that upcoming services like Microsoft 365 Copilot will have. As always, there is plenty of news an updates to share from the Microsoft Cloud. Listen in and let me know your thoughts on this episode.

You can listen directly to this episode at:

https://ciaops.podbean.com/e/episode-302-thoughts-on-ai/

Subscribe via iTunes at:

https://itunes.apple.com/au/podcast/ciaops-need-to-know-podcasts/id406891445?mt=2

The podcast is also available on Stitcher at:

http://www.stitcher.com/podcast/ciaops/need-to-know-podcast?refid=stpr

Don’t forget to give the show a rating as well as send me any feedback or suggestions you may have for the show

This episode was recorded using Microsoft Teams and produced with Camtasia 2023.

Brought to you by www.ciaopspatron.com

Resources

@directorcia

@directorcia@twit.social

Join my shared channel

CIAOPS merch store

Become a CIAOPS Patron

CIAOPS Blog

YouTube edition of this podcast

Responding to targeted mail attacks with Microsoft 365 Defender

Microsoft 365 Lighthouse helps you secure and improve the health of your customer tenants

Introducing the Microsoft 365 Copilot Early Access Program and new capabilities in Copilot 

SharePoint in the AI Era: Introducing Copilot in SharePoint & 10 more innovations for creators

Public Preview: Token Protection for Sign-In Sessions

Get step-by-step guidance for enabling key features in Microsoft Defender

Microsoft 365 Admin Monthly Digest – April 2023

New Microsoft Entra Features Now Available

Automating and Streamlining Vulnerability Management for Your Clients

Microsoft Build