API and Home Assistant config?

Hi crew,

I was pretty excited to see API available for the general community as I have just started using Home assistant.

Has anyone managed to intergrate Pulse into Hass? Care to share an example of your config?

I managed to return a response in cli using my api and device id with -
url --request GET “https://api.pulsegrow.com/devices/{deviceId}/recent-data” --header “x-api-key: {apiKey}”

But so far have not been able to find the time to learn to integrate it into Hass as I have yet to configure anything into config.yaml.

Any help would be appreciated

Thanks

1 Like

Hey @grudge

I don’t have much experience with home assistant, but i took a quick look at their docs and came across this: Fetching Data | Home Assistant Developer Docs

It appears to use this class: https://github.com/home-assistant/core/blob/5f827f4ca64067ca886e0e4dcb0d1498689e1ded/homeassistant/helpers/update_coordinator.py#L27

Seems like you can poll an API to get that data into home assistant. I’d probably have to work with it a bit more to get something more helpful, but could probably throw together a demo pretty quickly.

edit: did some more digging, here’s a decent example of how to do what you’re trying to do: https://michilehr.de/how-to-integrate-an-external-api-into-home-assistant-an-example-with-the-ambee-pollen-api and some discussion on it here: Home Assistant Ambee Pollen API · GitHub

Thanks for suggestions @peet

Looks like I will have to get my hands dirty. If I get something working I will post it here.

Im currently looking for a environmental controls solution and would be awesome if I can use Pulse as the sensors in combo with shelly wifi relays or similar.

1 Like

Sounds like a pretty cool setup, let me know if you end up needing some more help or something.

What would you control with the relays?

Currently controlling lighting and irrigation solenoids with shelly wifi switches and Home assistant.
Ideally I want to control RH and co2 using pulse data and shellys or similar.

1 Like

Hi, I’m trying to use the pulse grow vpd value to turn the dehumidifier on/off through home assistant.
I use the following code but it fails. Any idea to make it works please?

Pulse Grow Sensor

     - platform: command_line
       name:
        pulse_grow_vpd:
        command:'curl -X GET https://api.pulsegrow.com/devices/XXXXX/recent-data -H "x-api-key: XXXX"''
        value_template: '{{ value_json."vpd" }}'
        scan_interval: 60

Configuration validation Error Msg

Invalid config for [sensor.command_line]: required key not provided @ data[‘command’]. Got None
value should be a string for dictionary value @ data[‘name’]. Got OrderedDict([(‘pulse_grow_vpd’, None), (‘command:‘curl -X GET https://api.pulsegrow.com/devices/XXXXX/recent-data -H "x-api-key’, ‘XXXXX"’’’), (‘value_template’, ‘{{ value_json.“vpd” }}’), (‘scan_interval’, 60)]). (See ?, line ?).

@Toma_Chan I managed to get a few hours to play with this and got the config working. Hopefully we can collaborate and get this going.

In my config.yaml I added a line

sensor: !include sensor.yaml

I then created a new file named sensor.yaml and added this -

  - platform: rest
    resource: https://api.pulsegrow.com/devices/insertdeviceid/recent-data --header x-api-key:insertapikey
    value_template: '{{ value_json["vpd"] }}'
    name: "Pulse Grow"
    scan_interval: 20

Obviously put in your device id and api in the appropriate spots. Also just copy and paste these lines and change for each sensor where the “vpd” is. Device/sensor list is found on api docs page.
If youre like me youre not going to want to display or control every sensor Pulse offers in Hass so just add the ones you want.

Thats as far as i got so far. Its a working config for me. If you manage to advance please share.

edited code typo

Thanks grudge, really appreciate your prompt response and advice. I have replaced the device id and API Key with mine, and HASS show the Pulse Grow entity status is unknown. * from your suggestion code, the header is “x-apikey” which is different with the API document, and i tried to use “x-api-key”. However both doesn’t work.

Thanks for that, I edited to reflect my config. The api docs also add the “” but works without on my end.

Are you able to get a call a response if you put this in terminal or command prompt?

curl --request GET https://api.pulsegrow.com/devices/insertdeviceid/recent-data --header x-api-key:insertapikey

1 Like

Yes, the system response with the pulse grow current environment information.

Sorry mate, I just re -read your post and yes the entity does show the data as unknown.
Like I said that was as far as i got :slight_smile: First time doing any custom template in Hass
The config works it just needs some tweaking.

No worries, lets keep exlporing the way to make it works. Thanks.

just so it’s clear, the correct header is x-api-key

and here’s a sample CURL request

curl --request GET "https://api.pulsegrow.com/devices/ids" --header "x-api-key: ****************************"

some systems might use no quotes, some might use single quotes ', some might use double quotes "

@Toma_Chan
I got it to populate data finally

- platform: rest
  resource: https://api.pulsegrow.com/devices/insertdeviceid/recent-data
  method: GET
  value_template: '{{ value_json["vpd"] }}'
  name: "Pulse Grow"
  scan_interval: 20
  headers: 
    x-api-key: insertapikey`

I’m also working to integrate Pulse into HASS. Although I’m able to get curl responses with my api key and device id, the code for HASS is still giving “Unknown” status for sensors.

Would you post the entire YAML code you are using?

@puckett
in your config.yaml put this line in-

sensor: !include sensor.yaml

if you dont already have a sensor.yaml file, create one and then add-

- platform: rest
  resource: https://api.pulsegrow.com/devices/yourdeviceID/recent-data
  method: GET
  value_template: '{{ value_json["vpd"] }}'
  name: "Pulse Grow"
  scan_interval: 20
  headers: 
    x-api-key: yourAPIkey

Developer tools>check config>restart

Screenshot from 2022-09-21 15-59-06

That worked! I think my issue was somehow formatting related since I was using a sensor directory for my sensors.

1 Like