REST question

Sure thing, thank you! Just a few updates: the integration has been approved by HA and you’ll see it in the next update (.113)! It also supports EU servers, mmol/L units optionally, and is a tad bit more stable.

1 Like

Looks like Sonos broke the TTS recently, so that’s a no-go now. I still have an automation set-up, but it takes a few minutes to trigger vs dexcom/sugarmate. Anyway to increase the update interval from dexcom?

In addition to the Nightscount REST data, I am also using the Dexcom Custom Component

There’s many moving parts in the Dexcom/Nightscout route, and sometimes something stops working and I am without a CGM reading for a while.

In Node-red, I automatically switch my reading from either the Nightscout/REST or the custom component- whichever works.

I haven’t tried it yet, but I just saw this: Frontend Panel for Diabetics using a Dexcom CGM

1 Like

The slow part is your phone/receiver. It only queries the CGM transmitter once every ten minutes to save the transmitter battery. However, I do the REST read every 15-seconds.

In my front end panel there I really only use nightscout for the iframe colored box in the middle. I’m in the process of gettting rid of that and replacing it with a picture-element card.

Nightscout was a great platform, but these days with many cgm APIs to tap into with just a curl request, it makes the entire setup of nightscout very tedious. “Sugarmate” for example, does the same thing, but easily pulls the data from its app, which pulls its data directly from the Dexcom Follow option — so it’s much faster. The Sugarmate API actually has a bit more options as well which I can honestly say have saved my ass a few times at night — example, it actually calls your phone if you get urgently low during sleep hours.

I’m curious why you’re without a reading for a while though? Both nightscout and the Dexcom component get their data from the Dexcom app (or Dexcom login). Why can’t you see them there?

I have my Dexcom component here trigger a few automations as well. The delays could be a few factors. I’ve found my automations run within a couple minutes; definitely enough times to address the situation. Possibly set your urgent low levels a bit higher for an earlier notification.

In my automations I track the trend as well and factor that in. If my level is below 6.0 mmol/L and the trend is “falling quickly” it sounds alarms then. I also have these automations setup in a way that make sure I get out of bed and into the kitchen. It’ll flash my bedroom lights at 100% brightness constantly, have Alexa screaming at 100% volume over and over until I trip the kitchen motion sensor. It’s pretty sloppy node red flows doing this now; but once it’s cleaned up I’ll post it.

1 Like

The problem isn’t in the Dexcom or Nightscout end- it’s what’s in-between. The Heroku App. If it hasn’t failed for you yet, it will. About once every two or three months I have to log on to my Heroku account to “restart the Dyno”. No indication, but after experiencing this a few times over the past couple of years, restarting the Dyno in Heroku becomes a maintenance step.
And, I received an email from Heroku recently that a component of my Nightscout, mLab (a MongoDB provider), is shutting down on November 10. Like I said, too many moving parts.

I like the simplicity of the Dexcom Custom Component, but I have had a couple of occasions where the HA Component wasn’t providing data from my Dexcom account, but the Nightscout program was. Thus the switch in Node Red. If there were a third source of getting my Dexcom data into Home Assistant or Node-Red, I would be using it.

1 Like

I really need to learn to use HA Automations. but, I find Node-Red flows are so much easier to program.

I don’t bother to fully wake up or especially don’t want to be going into the kitchen to fix a low. I keep a small plastic pill container on my nightstand containing three unwrapped Smarties rolls (6g each). I pop these into my mouth without lifting my head from the pillow and my urgent low is reversed in a few minutes.

Yeah i use Node Red basically for everything these days. But sometimes ill start an automation in YAML just so i can see the entire codebase at once; then ill break it up into nodes.

As for my crazy automations… My issue has always been… it takes an explosion or a punch in the face to get me up when I’m in a deep sleep. I tried the nightstand candy bucket approach as well, but sometimes I wouldn’t eat enough and fall back asleep, or I’d eat too much and skyrocket. For me, i had to make it in such a way i get the data i need (trend level, and value) and make a decision about sugar then. My condo isn’t that big, so the kitchen isn’t a far stroll…

Interesting to include the trend in automations as well.

The dexcom updates on its’ intervals but the integration is slow to update with it. Anywhere from 5-15 min. Any idea on that? Usually it’s lagging behind

Honestly, I haven’t experienced delays longer then a minute or two; but then again, i dont compare my dexcom app to the component side by side often. I usually can tell just because HA will shoot out the low warning at the same time my Dexcom app does… or within a minute or so.

Since the component gets its data from dexcom, try setting up a “Dependent Profile” on your Dexcom account. Basically this would be like a parent having the same access level as thier kid within dexcom. I had a few issues signing into the custom dexcom component at first due to a “@“ symbol in my username. So I created a Dependent Profile with no special characters and that fixed my problem. Maybe sending data to your app and the component (and any other platforms) from the same login is what’s slowing it down — to many requests?? No idea. But it cant hurt to try the dependent thing,.

just want to show some of stuff i have done. i didn’t know about nightscout / rest until a week ago. I am working with sugarmate.io. I just wish i would pull more data.


here is our alert system

this is our trending warning system when getting near low. This one has not been cleaned up

this is a system when she is to high that it will tell her to drink water or we can turn it on to tell her every 10 mins.

this is just our lantus reminder.

Looks ambitious. I use the Nightscout REST endpoints and just recently, the Dexcom custom component. I have in my flow a voting system that if the Nightscout/Heroku data is NG, then use the Dexcom component data.

Two questions:

  1. Where did you find the Sugarmate endpoints?
  2. Describe the Routine Speak.
1 Like

i was playing around on sugarmate.io (which was found looking for an alexa skill) and i found the json file in settings. i turned it on and started looking into how to pull the data from it. i have it pull data every 2 seconds. i used to do every second but I decided to scale that down just a little.

msg.sofbg = “Warning, Warning… Sophie is at” + msg.payload + "… Sophie is at " + msg.payload
or
msg.sofbg = “attention, attention… Sophie is at” + msg.payload + "… Sophie is at " + msg.payload

i know they basically say the same thing but originally it used to say something else and then i found out how to put her number in there. I wanted really to here either attention or warning and what her number was so we know how and what to use.

the trending one will say that she is 90 or below and trending down single or double arrow. (this one was tricky) I do want to change it to be 100 and double down that we get the notification.
if you are wondering what all those catches are, they look for an error in each one of the speak nodes for alexa and will resend the data. Sometimes we only get like 2 Alexa’s in the house that talk because the other had an error for whatever reason. that was my failsafe to make sure that we got the info. the alert system only plays in our room and the living room in the middle of the night too.

i would use the new intregration with home assistant too but as far as i know you only get 5 or share shares for the follow app, so that is all taken. sugarmate takes up a share. we actually have one left and we will end up having to give it to her dad.

i also on the control panel for the house has graphs

This on on the main screen. This does show all the disables I have for the alerts. The low disables will automatically turn back off if she gets to 80 or above.

Thanks- I didn’t even know that was there.
Where are you told that you only get 5 shares?

1 Like

in the dexcom app it shows only 5 spots for shares.

5 spots seems shortsighted.

Can you spot what I am doing wrong here:

  - platform: rest
    name: Sugarmate sgv
    resource: https://sugarmate.io/api/v1/xxxxxxx/latest.json
    value_template: '{{ value_json[0].value }}'
    unit_of_measurement: 'mg/dl'

All I get is zero, but in the browser I get JSON data.

not sure, I have never used the REST platform.

My node-red runs on a seperate VM on my server. If for what ever reason that HA is down, this still runs and will still send messages to alexa.
on the http request


from there you goto the string node to strip the BG out of the json

the RBE node just makes it to where if the data hasn’t changed that it will do nothing.
the next node creates the sensor that the data is written to in HA

I also send the data that i stripped out of the json file to a different flow for her alerts. that is not using the HA sensor at all because if HA is down and she goes low, at least i will get alerts.

I wound up doing something similar:

[{"id":"11e7916c.5337af","type":"debug","z":"6164592e.ce1cc8","name":"Value","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":2180,"wires":[]},{"id":"3321d525.ffdc8a","type":"http request","z":"6164592e.ce1cc8","name":"Sugarmate","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://sugarmate.io/api/v1/xxxxxx/latest.json","tls":"","persist":false,"proxy":"","authType":"","x":270,"y":2220,"wires":[["ff75d72.ba61f28"]]},{"id":"8b99495e.3cbfc8","type":"inject","z":"6164592e.ce1cc8","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":2220,"wires":[["3321d525.ffdc8a"]]},{"id":"ff75d72.ba61f28","type":"json","z":"6164592e.ce1cc8","name":"","property":"payload","action":"","pretty":false,"x":410,"y":2220,"wires":[["31f61bbd.2931c4"]]},{"id":"31f61bbd.2931c4","type":"function","z":"6164592e.ce1cc8","name":"","func":"// just the data\nvar msg1 = {};\nvar msg2 = {};\nvar msg3 = {};\nvar msg4 = {};\nvar msg5 = {};\nvar msg6 = {};\n\nvar myVal = msg.payload.value;\nmsg1.payload = myVal;\n\nvar myTrend = msg.payload.trend;\nmsg2.payload = myTrend;\n\nvar myDelta = msg.payload.delta;\nmsg3.payload = myDelta;\n\nvar myFull = msg.payload.full;\nmsg4.payload = myFull;\n\nvar myTime = msg.payload.time;\nmsg5.payload = myTime;\n\nvar myTimestamp = msg.payload.timestamp;\nmsg6.payload = myTimestamp;\n\nreturn [msg1,msg2,msg3,msg4,msg5,msg6];\n","outputs":6,"noerr":0,"initialize":"","finalize":"","x":540,"y":2220,"wires":[["11e7916c.5337af"],["7b48bbe5.4c1e24"],["86036206.ff9a7"],["f269ba3d.e6abd8"],["4f0cef0a.e1aba"],["c92b9eac.38af3","2c9db90d.fa1806"]]},{"id":"7b48bbe5.4c1e24","type":"debug","z":"6164592e.ce1cc8","name":"Trend","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":2220,"wires":[]},{"id":"86036206.ff9a7","type":"debug","z":"6164592e.ce1cc8","name":"Delta","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":2260,"wires":[]},{"id":"f269ba3d.e6abd8","type":"debug","z":"6164592e.ce1cc8","name":"Full","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":2300,"wires":[]},{"id":"4f0cef0a.e1aba","type":"debug","z":"6164592e.ce1cc8","name":"Time","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":710,"y":2340,"wires":[]},{"id":"c92b9eac.38af3","type":"debug","z":"6164592e.ce1cc8","name":"Timestamp","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":730,"y":2380,"wires":[]},{"id":"2c9db90d.fa1806","type":"moment","z":"6164592e.ce1cc8","name":"","topic":"","input":"","inputType":"msg","inTz":"America/New_York","adjAmount":0,"adjType":"days","adjDir":"add","format":"object","locale":"C","output":"","outputType":"msg","outTz":"America/New_York","x":540,"y":2440,"wires":[["35a2a471.8627fc"]]},{"id":"35a2a471.8627fc","type":"moment","z":"6164592e.ce1cc8","name":"Local Time","topic":"date","input":"payload","inputType":"msg","inTz":"US/Eastern","adjAmount":0,"adjType":"days","adjDir":"add","format":"dd, MM.DD.YY - HH:mm","locale":"US","output":"payload","outputType":"msg","outTz":"US/Eastern","x":510,"y":2500,"wires":[["2fcdb384.42e05c"]]},{"id":"2fcdb384.42e05c","type":"debug","z":"6164592e.ce1cc8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":730,"y":2500,"wires":[]}]

Automations in Home Assistant still escape me. What is your “Routine Speak at Volume” node?

1 Like