REST question

I believe I fixed the formatting, but I might need someone to yell at me some more. I am still getting a TTS “Unkown” reading. I am not sure what IP and port go in the shell_commands.yaml or is this for a magic mirror or a display of some sort?.

Script yaml

bg_tts_alarm:
  alias: BG TTS Alarm
  sequence: 
  - service: media_player.volume_set
    data_template:
      entity_id: 
      - media_player.josh_and_caila_mini
      - media_player.coral
      - media_player.xbox_mini
      volume_level: '.50'
  - service: tts.google_say
    entity_id: media_player.josh_and_caila_mini
    entity_id: media_player.coral
    entity_id: media_player.xbox_mini
    data_template:
      message: "Wake up. Mom blood sugar is {{states('sensor.json_sgv')}}."

bg_tts_current:
  alias: BG TTS Current
  sequence:
  - service: tts.google_say
    entity_id: 
    - media_player.josh_and_caila_mini
    - media_player.coral
    - media_player.xbox_mini
    data_template:
      message: "{{states('sensor.json_sgv')}}."

monitoron_mirror:
  alias: Mirror Monitor On
  sequence:
  - service: shell_command.monitoron_mirror

Config yaml

sensor:
  - platform: rest
    name: JSON_sgv
    resource: https://private.herokuapp.com/api/v1/entries/current.json
    value_template: '{{ value_json[0].sgv }}'

shell yaml

monitoron_mirror: curl -s http://192.168.1.42:9411/remote?action=MONITORON

what is the result of the following:

curl https://private.herokuapp.com/api/v1/entries/current.json

What is the state of the rest sensor?

I am not sure how to do the curl command, do i just put that line in the shell_command.yaml file?

I am not seeing the sensor in my entity list. I am assuming it would be called JSON sgv.

Without the curl.
https://private.herokuapp.com/api/v1/entries/current.json

You should get a json formatted string back. It will look like this:

[{"_id":"5c64e08d935f13a6221e6933","sgv":136,"date":1550114905000,"dateString":"2019-02-14T03:28:25.000Z","trend":4,"direction":"Flat","device":"share2","type":"sgv"}]

You extract the data with a template like this:

value_template: '{{ value_json[0].sgv }}'

I think I got it now, I had two sensor entities. Thank you guys for all your help. I am sure I will be back for more help. #noobstatus

I am curious, how do you parse out all of the JSON values coming from Nightscout? I should have probably posed this here, but I started a new post with that question and all of my details:

Hi there- for those following this, I wanted to share a new thread I started around using the CGM data.

Check it out and post your GGM data use examples:

Could you show an example of what would go in the Call Service node? I keep getting API errors with the current configuration.

Entity Id should be:

‘script.bg_tts_alarm’

On mine, the script itself sends the TTS message to the desired media player. All I am doing with the automation is calling the script.

So just to make sure, I should have it as such?

Also, here is the state node config. Does this look correct?

04 PM

Got it working! Had to make some adjustments to the script. Thanks again for the help.

#Blood Sugar Alarms
bg_tts_alarm:
  alias: BG TTS Alarm
  sequence:
  - service: notify.alexa_media
    data_template:
      data:
        type: announce
      target: media_player.master_bedroom
      message: "Wake up. NameHere has a blood sugar of {{states('sensor.json_sgv')}}."
1 Like

Hi, thought I might drop this information in here for anyone interested:
https://github.com/home-assistant/core/pull/33852

2 Likes

This would be awesome! Will it be integrated?

Still awaiting review, feel free to <3 or comment on the pull request to grab the attention of HA staff!

If you’d like to beta test the integration as a custom_component:

2 Likes

I tried… But no positive respons. There are somethings in the PR that should not be there was the answer i got.
My bet is that they are busy with the new beta.

I would like to have access to my G6 data without the cumbersome Heroku app, but…
I am running Home Assistant in a Docker on an Intel NUC running Ubuntu. There is no homeassistant/custom_components folder. I tried mkdir custom_components then adding the /dexcom folder in /usr/share/hassio/homeassistant/custom_components, but in Configuration -> Integrations -> +, there is no Dexcom to configure.

Does it matter that root owns everything in /usr/share/hassio/homeassistant?

Any tips would be appreciated.

Be sure to do a restart, and be sure it’s just the /dexcom folder in there, not the whole repository.

The directory structure you have is identical to mine.

Thanks. Did a restart, still not there.

steve@nuc:/usr/share/hassio/homeassistant/custom_components$ ls -al
drwxr-xr-x 2 root root 4096 May 15 13:00 dexcom

cd dexcom

steve@nuc:/usr/share/hassio/homeassistant/custom_components/dexcom$ ls -al
-rwxr--r-- 1 root root 1848 May 15 12:59 config_flow.py
-rwxr--r-- 1 root root  389 May 15 12:59 const.py
-rwxr--r-- 1 root root 3011 May 15 12:59 __init__.py
-rwxr--r-- 1 root root  291 May 15 12:59 manifest.json
-rwxr--r-- 1 root root 4133 May 15 12:59 sensor.py
-rwxr--r-- 1 root root  618 May 15 12:59 strings.json

Other ideas?

Can you confirm that this directory has your configuration.yaml ?

Yes, it does:

steve@nuc:/usr/share/hassio/homeassistant$ ls -al
total 257256
drwxr-xr-x  9 root root      4096 May 15 20:28 .
drwxr-xr-x 12 root root      4096 May 10 17:10 ..
-rw-r--r--  1 root root         2 Feb  9 09:50 automations.yaml
-rwxr--r--  1 root root      3078 Mar  4 14:26 cameras.yaml
drwxr-xr-x  2 root root      4096 Feb  9 09:50 .cloud
-rw-r--r--  1 root root      2792 May 15 13:03 configuration.yaml
drwxr-xr-x  3 root root      4096 May 15 13:00 custom_components
drwxr-xr-x  2 root root      4096 Feb  9 09:50 deps
-rw-r--r--  1 root root       512 Feb 10 15:20 groups.yaml
-rw-r--r--  1 root root         7 May 15 19:01 .HA_VERSION
-rw-r--r--  1 root root   5396331 May 15 20:28 home-assistant.log
-rw-r--r--  1 root root 257478656 May 15 20:28 home-assistant_v2.db
-rw-r--r--  1 root root       451 Feb 10 16:50 known_devices.yaml
-rwxr--r--  1 root root        55 Oct 18  2018 life360.conf
drwxrwxr-x  7 root root      4096 May 11 15:08 node-red
-rw-r--r--  1 root root      1122 Feb 10 08:01 options.xml
-rw-r--r--  1 root root    314113 May 15 20:27 OZW_Log.txt
-rw-r--r--  1 root root     32768 Feb 10 08:01 pyozw.sqlite
-rw-r--r--  1 root root         0 Feb  9 09:50 scenes.yaml
-rw-r--r--  1 root root         0 Feb  9 09:50 scripts.yaml
-rw-r--r--  1 root root       563 Feb 10 17:41 secrets.yaml
-rwxr--r--  1 root root      4290 Feb 10 23:22 sensors.yaml
drwxr-xr-x  2 root root      4096 May 15 20:16 .storage
drwxr-xr-x  2 root root      4096 Feb  9 09:50 tts
-rwxr--r--  1 root root      4788 Mar 12 23:51 ui-lovelace.yaml
drwxr-xr-x  2 root root      4096 Feb 17 22:57 www
-rwxr--r--  1 root root       656 Feb 10 17:41 zones.yaml
-rw-r--r--  1 root root     95826 May 15 19:01 zwcfg_0xd8b30543.xml
-rw-r--r--  1 root root       108 May 15 19:01 zwscene.xml

Recall that Home Assistant is in a docker container. I have been bitten by the docker folders not the same as Ubuntu folders before.