Proteus sensor api integration

Hi there

I’m trying to get a ultrasonic level sensor to work with homeassistant and am failing with hacking everything into my configuration.yaml.

How should a working config.yaml look like?
The description of the API is found here: Proteus API

Looking forward to see any suggestions.

My current yaml looks like this:

rest:
  resource: http://aes-gate-ecofrog.azurewebsites.net/Api/FuncDevice
  method: POST
  headers:
    Content-Type: application/json
  payload: '{ "DeviceRequest": {"Username": "xyz", "Email": "xyz", "SecurityStamp": "xyz", "DeviceID": "xyz" }}'
  scan_interval: 60
  sensor:
    - name: "Oelstand"
      value_template: "{{ value_json.ActualVolume}}"
      json_attributes_path: "$.ActualVolume"
      json_attributes:
      - "ActualVolume"
2 Likes

Please keep us updated if you have any progress…
I’m also about to order one and was looking in integrating it. Will share how it goes when I get back to our Oel-Haus :slight_smile:

I can’t make it to work…

yaml looks like this atm:

  - platform: rest
    resource: http://aes-gate-ecofrog.azurewebsites.net/Api/FuncDevice
    method: POST
    headers:
      Content-Type: application/json
    payload: '{DeviceRequest: {"Username": "xy", "Email": "xy", "SecurityStamp": "xy", "DeviceID": "xy" }}'
    name: 'proteus level sensor'
    value_template: "OK"
    json_attributes_path: "$.deviceresponse"
    json_attributes:
      - DeviceID
      - DeviceName
      - Medium
      - LastUpdate
      - MaxVolume
      - ActualVolume
      - ActualVolumePercent
      - Battery
      - Temperature
    scan_interval: 120

Log shows the following error:

Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:170
Integration: RESTful (documentation, issues)
First occurred: 16:54:14 (1 occurrences)
Last logged: 16:54:14

JSON result was not a dictionary or list with 0th element a dictionary

:tired_face:

Could it be the problems are caused by the response including backslashes for escaping? At least for me the response looks like

"{\"DeviceResponse\":[{\"DeviceID\":\"

and so on.

There is a similar issue which sadly hasn’t been solved on github. It also includes some escaped chars.

if i make the request with postman i also get the response like you (with backslashes).
as this is the first time i’m trying something like this, I have no clue…

Same result with GetIt and Insomnia. I also have very limited experience but it’s the first time for me seeing this.

I’m seeing the same behaviour. The actual JSON string of the response is somehow re-encoded as JSON, ending up in a single string. To correct for this, you need to decode JSON twice. As far as I know this isn’t supported by the REST integration.

I’ve been toying with adding my own integration, but I’m struggling with the learning curve and Home Assistant’s somewhat lacklustre developer documentation.

So I have a basic integration working and I’m testing it now. I’m hoping to get it into good enough shape to submit to Home Assistant core, but I may have to make it available as a custom integration for now, if anyone else wants it.

It uses a proper config flow (no YAML editing) and knows how to work around the double-encoded JSON output from the E-Sensorix API.

If anyone wants to try it out, it’s here: GitHub - alexiosc/ecofrog: EcoFrog integration for Home Assistant

1 Like

thank you for this, after integrationg it according to your manual it works!

first I tried setting your git as a repo for hacs and that did’nt worked out!

1 Like

Thank you! Good to know someone else tested this! I’m still learning HACS (which is why I don’t have the HACS banners etc. on the github page). I understand there’s some metadata that need to be added before the repo can be used directly from HACS, and I haven’t done that yet. Soon though!