I was interested in keeping an eye on the temperature of my new Raspberry Pi4, so setup a "simple" solution (took me a while to get my head back around some Linux concepts I have used for about 4 or 5 years now).
The general steps were:
On the HE hub:
Setup a virtual temperature device in HE, noting the device Id
Install and configure Maker API or use an existing install
Add new virtual temperature device in the list of devices in Maker API
Copy the example command URL from the Maker API setup screen
On the Raspberry Pi:
Open the crontab editor
sudo crontab -e
If prompted, choose your text editor, I use Pico or Nano for most things.
EDIT: My original post of this text was missing some character in it's display on screen because of the backtick being detected a formatting option. I have now changed it to preformatted text. Good pick up @duane.and.
EDIT2 (17th Sep '22): I have also tweaked the original schedule that I posted, 1 * * * * does not work, changed it to all asterisks.
* * * * * curl http://<HE-IP-Address>/apps/api/<Maker-API-App-Id>/devices/<Device-Id>/setTemperature/`echo "scale=3; \`cat /sys/class/thermal/thermal_zone0/temp\` / 1000" | bc`?access_token=<Maker-API-Access-Token>
EDIT: Also from @duane.and 's post below, I have also included a version of this cron setup for those who don't have bc (basic calculator) installed on their rpi:
EDIT 2 (17th Sep '22): Tweaked the command so that the backticks appear in the post for people to copy
EDIT3 (17th Sep '22): I have also tweaked the original schedule that I posted, 1 * * * * does not work, changed it to all asterisks.
I have the added benefit that I am sending HE events to Influxdb / Grafana on the Raspberry Pi, so can also chart the results. Admittedly a bit of a round trip to get the results back onto the same pi, but simpler than writing code myself. Also not as feature-rich as the pi stats solution from this community. I'll probably get to installing this eventually.
Simon