I’ve also gotten it working using a RESTful sensor; I didn’t have to use any template sensors once I fiddled around with the JSON attributes path and value templates a bunch (fwiw, HA’s logging of this is pretty annoyingly bad ).
Also worth mentioning: I was extremely impressed with Eyedro’s support; I had a bunch of pre-sales questions they were quick to answer (e.g.: note that the non-wifi version doesn’t have the local API), and they even swapped out the stock 200A CT clamps for 100A ones for me (to give me better accuracy as I only have 100A hydro service anyway).
You can apparently add the Integration - Riemann sum integral via GUI, but I chose to do it in the YAML (see the sensor: block below). Although I just got it working now and as a result don’t have enough data for the HA Energy charts to display, the total energy sensor does show up in the HA Energy sensor list, huzza!
sensor:
- platform: integration
source: sensor.eyedro_total_power
name: "Eyedro total energy"
unique_id: eyedro_total_energy
round: 2
rest:
- resource: http://[your eyedro's IP or hostname]:8080/getdata
scan_interval: 10
sensor:
- name: "Eyedro total power"
unique_id: eyedro_total_power
json_attributes_path: "$.response"
value_template: "{{ (value_json['data'][0][3] + value_json['data'][1][3])/1000 }}"
unit_of_measurement: "kW"
device_class: power
state_class: measurement
- name: "Eyedro total current"
unique_id: eyedro_total_current
json_attributes_path: "$.response"
value_template: "{{ (value_json['data'][0][2] + value_json['data'][1][2])/1000 }}"
unit_of_measurement: "A"
device_class: current
state_class: measurement
- name: "Eyedro average voltage"
unique_id: eyedro_average_voltage
json_attributes_path: "$.response"
value_template: "{{ (value_json['data'][0][1] + value_json['data'][1][1])/200 }}" #reported in tens of milivolts, but we want the average, so /2 /100 = /200
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
- name: "Eyedro average power factor"
unique_id: eyedro_average_pf
json_attributes_path: "$.response"
value_template: "{{ (value_json['data'][0][0] + value_json['data'][1][0])/20 }}" #reported in tenths of a percent, but we want the average, so /2 /10 = /20
unit_of_measurement: "%"
device_class: power_factor
state_class: measurement
Edit: for those of us in Ontario, there is a HACS integration for the Ontario Energy Board that can give you your ToU rates for use in the HA Energy dashboard.
Edit 2: fixed YAML typo, value_json['data'][0][1]
→ value_json['data'][1][0]
and /200
to /20
for the power factor value template.
Edit 3: fixed typo in Eydro total energy
→ Eyedro total energy
. Now entity searches don’t drive you crazy