Looking for a way to pull a data value from json to overlay on camera feed

Jessie.slimer

BIT Beta Team
Joined
Aug 23, 2019
Messages
1,633
Reaction score
4,665
Location
Illinois
I have a zigbee temperature sensor in a remote room in my house that also has a camera. Using Hubitat, I was able to export a json file to the cloud of all of the sensor details including current actual values. In order to overlay the temperature sensor value onto the camera in blue iris, I am trying to find a way to extract this single temperature value and save it to text file, similar to how blue iris tools does it, in order to use a macro in blue iris for this file.

Any ideas on how to do this? From what I have seen, I would need a json parser, but this is all new to me. Does anyone know of a windows based program that would check a url constantly in real time, constantly exporting and rewriting this temperature value?

Screenshot_20211220-084602_Messages.jpg
 
Last edited:

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,678
Reaction score
14,031
Location
USA
That is a very easy job for a computer program, but I don't know of one that is already written to do what you are wanting.
 

OICU2

BIT Beta Team
Joined
Jan 12, 2016
Messages
831
Reaction score
1,365
Location
USofA
If all else fails, try posting a job on upwork.com for fifty bucks (or whatever you think its worth) and see what kind of offers you get. I had a custom script written to obtain my weather info from my Weather Direct sensors and it didn't cost much, It goes out to the web to a specific URL and scrapes only what I'm looking for and then writes it to a local text file that BI uses to overlay.
 

Jessie.slimer

BIT Beta Team
Joined
Aug 23, 2019
Messages
1,633
Reaction score
4,665
Location
Illinois
If all else fails, try posting a job on upwork.com for fifty bucks (or whatever you think its worth) and see what kind of offers you get. I had a custom script written to obtain my weather info from my Weather Direct sensors and it didn't cost much, It goes out to the web to a specific URL and scrapes only what I'm looking for and then writes it to a local text file that BI uses to overlay.
Great idea. Although I would love to learn, maybe this is the best way for right now until I can devote some time to it.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,678
Reaction score
14,031
Location
USA
I can't imagine what you get (for any price) at upwork.com is going to be high quality. A job as simple as that is going to attract every newbie programmer on the platform and there's no telling what you get.

But eh... I guess I should put up or shut up. I will make an app for you. Just give me a couple hours :)
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,678
Reaction score
14,031
Location
USA

Jessie.slimer

BIT Beta Team
Joined
Aug 23, 2019
Messages
1,633
Reaction score
4,665
Location
Illinois
This is awesome. I have been playing with it, and think it is going to work. However, I have multiple items listed under "attributes" in my JSON. What is the correct syntax to use after attributes to get only the number value associated with Temperature? I've tried a couple things but cannot get it to output anything.


1640046396452.png
 

Jessie.slimer

BIT Beta Team
Joined
Aug 23, 2019
Messages
1,633
Reaction score
4,665
Location
Illinois
That was it. The V in value needed to be capitalized.

Man, you are amazing. Thanks a ton for doing this. This app will be so useful for people who want to integrate data values from their home automation to Blue Iris. I'm going to get some outdoor temp sensors right now and overlay them onto my outdoor cameras. More accurate than nearby Weather Underground stations.
 

Jessie.slimer

BIT Beta Team
Joined
Aug 23, 2019
Messages
1,633
Reaction score
4,665
Location
Illinois
This has been working great. I noticed my data parameters move to different locations in the json array every few days, which displayed wrong data value overlays on the camera.

I followed the syntax guide attached within the program and was able to have the app select the "temperature" value, no matter where it was located.

I like the layout, especially the preview box. It displays in real time what the output will be as changes are made. I have been tinkering and it really helps to learn this language by seeing what works or does not work.

I have also come up with another use for this. One of my rear cameras cannot quite see if my rear fence gate is fully closed (too far). I am going to put a contact switch on it, bring it into Hubitat, then overlay the gate status onto the camera feed.
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
1,133
Reaction score
1,242
Location
SF Bay Area
I agree. This utility is great! Thanks @bp2008 !

My use case... Shelly sensors

I'm now using JsonDataExtractor to pull:
  1. real time battery and WIFI status for my Shelly Wifi Motion sensors (from the device ips - screenshot #1)
  2. humidity, temperature and battery status from my Shelly H&T sensors (via the Shelly cloud- screenshot #2 - necessary because these sensors are not continuously connected to wifi).
I am now displaying critical settings on camera feeds and no longer limited to getting current status via the Shelly Cloud app

Next I plan to write scripts to warn me of low battery levels, wifi disconnections, and out-of-range temperatures.

1641504492742.png 1641504626581.png

In case anyone is interested, here are my JsonDataExtractor templates:

Screenshot #1 - Motion sensor
{$.wifi_sta.connected}
{$.bat.value}
{$.bat.voltage}


Screenshot #2 - H&T sensor
{$.data.device_status.tmp.tF}
{$.data.device_status.hum.value}
{$.data.device_status.bat.value}
{$.data.device_status.bat.voltage}
 
Last edited:

johnstjs

Getting the hang of it
Joined
Dec 7, 2020
Messages
74
Reaction score
36
Location
08070
@Jessie.slimer

See if this does what you need it to. I built this so it would be useful to anyone that needs to download JSON records via HTTP(s) and extract some information into text files for Blue Iris to read.

This is AWESOME!!!! I'm a computer network consultant and I know absolutely zero about programming. I was trying my best to put together something using PowerShell or a VBScript to pull data down from a nooa.gov weather site and create a BI overlay. I was getting nowhere and about to give up (or just call a few of my friends that are programmers) when I found this. In about 30 minutes I was able to create something that pulls down the temperature, windspeed, wind gusts, water temperature, and last updated time and put them on an overlay. The only thing I couldn't figure out is how to change the 24hour format that is returned in the json with 12 hour am/pm (but that's no big deal). The json is a free get from noaa.gov (the only downside is that you need different urls for each item you want, I couldn't find a way to pull ll of the info at once). Attached are my templates to show how easy it is, even for someone that has no clue how to program.

Thank you bp2008!!!!
 

Attachments

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,678
Reaction score
14,031
Location
USA
There isn't a way to do date/time conversion with a JSON Path query. It would be necessary to add some kind of scripting language to this program, and that is a whole can of worms that I don't want to get into.
 

johnstjs

Getting the hang of it
Joined
Dec 7, 2020
Messages
74
Reaction score
36
Location
08070
There isn't a way to do date/time conversion with a JSON Path query. It would be necessary to add some kind of scripting language to this program, and that is a whole can of worms that I don't want to get into.
I don't blame you and it's not worth it. Besides the time and effort, why take a chance on breaking something that works so well. And if someone can't grasp that 17:30 is 5:30pm, then they probably shouldn't be boating and worrying about the tide and temperature (which is what this is used for - so we can see what the tide is in De City before we make a trip there) LOL
 
Top