Proteus sensor api integration

Hey everyone, this is a hurried post without really reading the thread.

I’m back from a horrendously busy summer and just published version 0.3 of the integration. This is an urgent release to fix the issue with the sensor being unavailable. It should be available via HACS or the Github repository.

(lots of head scratching at this one, since the exception really didn’t help enough. Took far too long for a fix of a single line)

I’m going to check the rest of the thread now and look for any changes that need to be made.

But i want to achieve a “cloudfree” solution. So the device should only communicate within my local network. Did someone have experience with this?

I’m very interested in running this sensor cloud-free. Cloud providers go away, hardware stays behind.

I never even tried because I assumed the traffic from the sensor to the remote server was fully encrypted MQTT, and never even bothered checking. Are you saying it’s unencrypted? In this case, routing it to Home Assistant may actually be a necessity, but it’s not a no-hassle solution.

I could easily create a branch of this integration that does ‘cloudless’. The only procedural issue I see is that it would have to be a separate integration, because HA metadata are fixed: your integration is either local, or cloud-polling, you set that up in the manifest.json file and can’t change this at runtime. If anyone knows better, please chime in!


Update on 2023-09-06:

I captured the conversation between the EcoGrog and its cloud server and I have some good news and some bad news: the good news is it uses HTTP and JSON, not HTTPS, so it would be trivial to be a man-in-the-middle and process the outgoing data ourselves.

The bad news is the JSON object contains just an opaque string that appears to be encrypted so we’re stuck for now.

And of course, even if it did send a clear-text message, the actual data it would send would probably be just a time between ping and echo, and the temperature (to help calculate the speed of sound more accurately). We’d have to convert time and temperature to distance (easy), and convert that to volume based on the shape and size of the tank.

I seen three differences between my own Ecofrog that talks to the e-Sensorix servers:

  1. The API URL is different.
  2. There’s an accountID field in the request.
  3. The response doesn’t come back as a JSON-encoded string, but as a JSON object that can be decoded properly. The only reason I wrote the integration was to bypass this problem with my own Ecofrog after trying to use the REST integration.

I think these can easily be added to the integration itself to make things easier. In fact, 3 is already in there—the integration only applies the string workaround if needed. If it gets a proper JSON object back from the API, it doesn’t bother.


Updated 2023-09-26: by the way, I forgot to mention. I released version 0.3 of the integration, if anyone still needs it! Get it via Github or HACS as per usual.

Hey @alexiosc,

Glad you are back and as I said in ma answer to the request iam happy to help where I can. My knowledge is very basic and I am far away from creating an add-on or even modify one. Because of that I have tinkerd a bit and created the above sensor.
Even if cloudfree would be a problem a modified version of your add-on with the possibility to switch between the Sensors during setup would be grate

Hi, the sensor uses a AES Encryption (Mode set to “ECB - electronic codebook”) the JSON String is written in HEX and encrypted via AES secret “t3k3l3k”.

I was able to decrypt the communication from the sensor to the server (in my case “mt.api.interaid.de”)

Following JSON was captured and decrypted:

First-JSON:
{'SURL':'http://mt.api.interaid.de/','PASS':'t3k3l3k','SPORT':'8483','AES':'1','SERI':'1234567','TCPR':'3','TCPT':'20','AUXALM':'0','SCTRL':'12345678','SDAYS':'MON,TUE,WED,THU,FRI,SAT,SUN,','SSTART':'7','SOFF':'57','LINT':'360','SSID':'SSIDNAME','TSER':'123456','HWID':'4','FW':'1.91','LIM1_POL':'Fill','LIM1_EN':'Disable','LIM1_HYST':'15','LIM1_THR':'1023','LIM2_POL':'Fill','LIM2_EN':'Disable','LIM2_HYST':'15','LIM2_THR':'1023','LIM3_POL':'Fill','LIM3_EN':'Disable','LIM3_HYST':'15','LIM3_THR':'1023','FIL_SRC':'15','FIL_RSSI':'15','ALM_PING':'15'}

Second-JSON:
{'SERI':'12345678','TSER':'123456','BAT':'29','WRSSI':'-61','MAC':'68:xx:xx:xx:xx:xx','WFWID':'0XX0XXXX90XX_2019XXXX','FWID':'1.91','PRID':'14','HWID':'4','ITEMP':'17','ULL':'82','SRSSI':'10','SRC':'10'}

My assumptions:
SERIAL —> Serialnumber
CREASON —> “MAN” (manual scan triggered by button on device); “SCH” (automatic, time based measure)
LRESET —> ?
PRID —> Product-ID

HWID —> Hardware-ID
FW —> Unit Firmware
SBATT —> Battery (Data * 10)
WRSSI —> Wireless RSSI
-77 and beyond - WEAK

CNUM —> ?
STYPE —> ? (Type of sensor?)
ITEMP —> PCB Temp (In Fahrenheit)
STIME —> Time of measure (GMT Time)
SRC —> ?
SRSSI —> Sonic RSSI (Signal)
ULL —> Ullage (Measurement in centimeters)

Response from API-Server was:
{"SSTART":"7","SOFF":"57","RTC":"10/04/2023 08:54"}

Works fine for me.
Is there an plan for a full home assistant integration?

Its already done: GitHub - ltspicer/heizoel24.mex: Daten vom Heizoel24 MEX auslesen und per MQTT versenden

Im using it via Cronjob from one of my Linux Machines to sent the data to MQTT and then fetch it via MQTT-Sensor in configuration.yaml.

Works very well. One of my sensor-config for example:

 - name: "MEXCurrentVolume"
   state_topic: 'MEX/Items/CurrentVolume'
   unique_id: "MEXCurrentVolume"
   state_class: "measurement"
   unit_of_measurement: "L"
   device_class: "volume_storage"
   force_update: true

Hi,
as i am far byond knowing how to create a integration i asked @alexiosc if he can modiyfi his one to be “selective” Maybe there will in the fuuture.
Please also keep in mind to set the “scan_interval” higher as i mentioned in an other post as you will request to many API-Cals otherwise

This only works with the ones from Heizoel24 not for the one from Protheus / Eco Frog
All 3 devices are nearly the same but they require different Services and APIs
The Integration from @alexiosc is for the Devices from E-Sensorix.
My “Yaml” integration is for the ones from protheus-sensor.de

Hello

I have been in contact with Michael Krause, Managing Director of Inno-tec (Proteus-Sensors).
It doesn’t make sense to request data more than once a day anyway, as the four measured values from the previous day are only transmitted the next day in the morning.

Belive me I hat a few Convos with him as the API documenting was wrong. Because of the period of the updates, I changed the time to a few years and created an Helper to update the sensors

Might be you want to give this integration a trial:

Hi Hamars,

unfortunately this is for an other Sensor.
The API is different. At a first glance I don’t think that it will work

Hey

when i do all your YAML and Automation Steps, i only get this in the Logs:

Logger: homeassistant.components.rest.util
Quelle: components/rest/util.py:18
Integration: RESTful (Dokumentation, Probleme)
Erstmals aufgetreten: 11:49:19 (2 Vorkommnisse)
Zuletzt protokolliert: 12:00:00

Empty reply found when expecting JSON data

Know anything about it?

Thx in advance

ps: Sensors are created, but empty

Hi can you please specify which code you used? and also what type of sensor do you have there are a few ones that looks the same but are different as they are from different “Vendors”

Hi.

I got mine directly from proteus – >Shopmail [email protected]
used this code

sensor:
  - platform: rest
    scan_interval: 31536000
    name: ecofrog
    json_attributes:
      - DeviceID
      - DeviceName
      - Medium
      - LastUpdate
      - MaxVolume
      - ActualVolume
      - ActualVolumePercent
      - Battery
      - Temperature
      - MessData
    resource: https://devapiext.azurewebsites.net/api/latest?code=qRX_UuM9UYPUuPV5B4lqEjUuzcpf_UrzDi40ReHSTTL7AzFu_4PDnA==
    payload: '{DeviceRequest: {"Username": "[email protected]", "accountID": „xXxXx“, "SecurityStamp": "b7b4eb63-4a2a-41e0-xxxxx", "DeviceID": "52xxxxx" }}'
    value_template: "OK"
  - platform: template
    sensors:
      eco_id:
        friendly_name: "Eco_DeviceID"
        value_template: "{{ state_attr('sensor.ecofrog', 'DeviceID') }}"
      eco_name:
        friendly_name: "Eco_Name"
        value_template: "{{ state_attr('sensor.ecofrog', 'DeviceName') }}"
      eco_medium:
        friendly_name: "Eco_Medium"
        value_template: "{{ state_attr('sensor.ecofrog', 'Medium') }}"
      eco_lastupdate:
        friendly_name: "Eco_LastUpdate"
        value_template: "{{ state_attr('sensor.ecofrog', 'LastUpdate') }}"
      eco_maxmolume:
        friendly_name: "Eco_MaxVolume"
        value_template: "{{ state_attr('sensor.ecofrog', 'MaxVolume') }}"
        unit_of_measurement: "L"
      eco_actualvolume:
        friendly_name: "Eco_ActualVolume"
        value_template: "{{ state_attr('sensor.ecofrog', 'ActualVolume') }}"
        unit_of_measurement: "L"
      eco_actualvolumepercent:
        friendly_name: "Eco_ActualVolumePercent"
        value_template: "{{ state_attr('sensor.ecofrog', 'ActualVolumePercent') }}"
        unit_of_measurement: "%"
      eco_battery:
        friendly_name: "Eco_Battery"
        value_template: "{{ state_attr('sensor.ecofrog', 'Battery') }}"
        unit_of_measurement: "V"
      eco_temperature:
        friendly_name: "Eco_Temperature"
        value_template: "{{ state_attr('sensor.ecofrog', 'Temperature') }}"
        unit_of_measurement: "°C"
      eco_messdata:
        friendly_name: "Eco_MessData"
        value_template: "{{ state_attr('sensor.ecofrog', 'MessData') }}"
        unit_of_measurement: "cm"

did you tripple check the payload data? Username and so on? test the Rest Api with Postman to see if you recive something
As you had a German error i assume you are also in Germany like me?

Countrywise, this is correct my dear sir… i presume :stuck_out_tongue:
Will check with Postman (Rest Api, and apis are not so my thing, but i try)

Keep you informed

Just found it… made the wrong quotation marks.
Works now