I’ve been using this and it’s been great. Especially, since it looks like Generic has depreciated their API support.
Question: Can we incorporate YAML that would expose these sensors to the new HA Energy Management features?
I’ve been using this and it’s been great. Especially, since it looks like Generic has depreciated their API support.
Question: Can we incorporate YAML that would expose these sensors to the new HA Energy Management features?
Probably. Something I’ll look into when I get settled after moving next week some time. Maybe this week if I get some free time to really look into how to integrate this.
I’m testing a few things now. Won’t know if the data generated is correct for a few days, but here’s what I put in my customize.yaml file to make my entities selectable on the energy page.
sensor.calculated_generation:
icon: mdi:solar-power
state_class: measurement
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
sensor.calculated_consumption:
icon: mdi:transmission-tower
state_class: measurement
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
sensor.calculated_net:
state_class: measurement
last_reset: '1970-01-01T00:00:00+00:00'
device_class: energy
Great news.
I’m out of pocket right now but I’ll give this a try when I return. I need to read more about the Energy Management feature. Right now, all I have feeding into it is my Tesla charging current. For some reason, after showing reasonable numbers when the car is charging, it starts showing small returns to the utility when, in fact, it’s just sitting quietly not taking any current and certainly not returning any.
I have some reading to do. Thanks for putting this up so quickly.
So far it looks like the data is fed in, but it’s not accurate. It’s not intuitive as to why, either. I’m hoping this gets some revision in the next update to make it a bit more user friendly.
Hi, did the formatting change with a home assistant update or something? I can’t get the sensors to pull the data, specifically, anything after the channels object ( “…channels.3.p_W”)
When I input the data in the template area of HA’s developer section, it will list all the raw data if I use states.sensor.neurio_raw.attributes.channels
, but trying to pull anything beyond that does not work.
Help!
Edit: solved it! the problem lies with the nested attributes within the rest sensor. This bit of code fixed it for me (note the [2]
; this was necessary to tell the template which section to pull the numbers from):
sensors:
realtime_consumption:
friendly_name: "Consumption"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[2].p_W }}"
Just looking to get this working, as I’ve pretty much ignored my neurio sensor since the default plugin failed, but am having some issues getting the sensors to display data. I suspect this is because my 2015 neurio install doesn’t include generation as in your example, so the channels might be wrong (I am of course just trying to create the consumption sensor rather than adding a generation one).
I tried Geoff’s suggestion from above, but that didn’t work for me either.
The results I get directly from the sensor’s current-sample page (with sensorID obfuscated) are:
{"sensorId":"0x000000000001932C","timestamp":"2022-01-09T01:47:12Z","channels":[{"type":"PHASE_A_CONSUMPTION","ch":1,"eImp_Ws":318062520955,"eExp_Ws":35827,"p_W":627,"q_VAR":-379,"v_V":236.487},{"type":"CONSUMPTION","ch":2,"eImp_Ws":318062430880,"eExp_Ws":38,"p_W":627,"q_VAR":-379,"v_V":236.487}],"cts":[{"ct":1,"p_W":627,"q_VAR":-379,"v_V":236.487,"i_A":3.448},{"ct":2,"p_W":0,"q_VAR":0,"v_V":0.205,"i_A":0.000},{"ct":3,"p_W":0,"q_VAR":0,"v_V":0.205,"i_A":0.000},{"ct":4,"p_W":0,"q_VAR":0,"v_V":236.480,"i_A":0.000}]}
Any suggestions as to what the correct format of the Consumption sensor should be?
Here is mine, place it under your top level sensor:
in your configuration.yaml
- platform: template
sensors:
realtime_consumption:
friendly_name: "Consumption"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[2].p_W }}"
Oddly enough, I was having issues getting this working after my HA VM crashed and I had to do restore. For some reason, the rest platform would not setup. Tried again today and it magically worked (formatting error somewhere?). Can confirm this code is working for me now, but do you have the neurio_raw
sensor setup? that is where the info gets pulled for this particular sensor, not from the neurio api directly like the neurio_raw does.
Thanks for that, unfortunately that’s exactly what my current configuration is set to
Yes - as the neurio api no longer works for me I have set up a neurio_raw sensor as per Bobby’s example, and that is working, and providing live info:
Does your neurio_raw sensor look the same as mine? I suspect I’ll just have to play around with the syntax of the sensor until I get it working.
EDIT: Got it working with
value_template: "{{ (states.sensor.neurio_raw.attributes.channels.1.p_W) }}"
(states.sensor.neurio_raw.attributes.channels.0.p_W)
gets me channel 1.
Good to hear you got it! So, it looks like the original formatting worked for you?
I wonder what the difference is between our setups?
I was a Kickstarter backer for neurio back when it released but only recently hooked it back up after moving a couple times. It was offline for a couple years so I wonder if there was an update at one point that I missed out on that changed it somehow?
The difference is the configuration of the CTs (how many) and what data you’re pulling from the sensor. It’s all in JSON format, so depending on how many sensors you have and which data you want, the count of the array you need to reference may be different than what I originally posted.
Hi Guys.
Found this thread while searching if it was possible to use my Neurio sensor that I got from Kickstarter long time ago.
Now that Home Assistant added support for energy metering I thought I would try to see if it was possible to use it.
Like user @mist, I also have the 3 Phase model, and was wondering if someone could help make a template that works with this?
Also I noticed in the latest discussion that the original post by @Bobby with all the config might not work with the Energy metering feature and need additional config? or did I miss-understand?
Any help would be great. Thank you.
The output from the 3-phase looks like this:
{"sensorId":"0x0000C47F51018244","timestamp":"2022-02-03T15:00:46Z","channels":[{"type":"PHASE_A_CONSUMPTION","ch":1,"eImp_Ws":40868465475,"eExp_Ws":2380,"p_W":171,"q_VAR":-102,"v_V":233.006},{"type":"PHASE_B_CONSUMPTION","ch":2,"eImp_Ws":58456695160,"eExp_Ws":4111,"p_W":582,"q_VAR":-287,"v_V":233.595},{"type":"PHASE_C_CONSUMPTION","ch":3,"eImp_Ws":13693604379,"eExp_Ws":6972,"p_W":37,"q_VAR":-23,"v_V":234.686},{"type":"CONSUMPTION","ch":4,"eImp_Ws":113017591779,"eExp_Ws":391,"p_W":790,"q_VAR":-412,"v_V":233.762}],"cts":[{"ct":1,"p_W":171,"q_VAR":-102,"v_V":233.006,"i_A":0.947},{"ct":2,"p_W":582,"q_VAR":-287,"v_V":233.595,"i_A":2.823},{"ct":3,"p_W":37,"q_VAR":-23,"v_V":234.686,"i_A":0.206},{"ct":4,"p_W":0,"q_VAR":0,"v_V":233.001,"i_A":0.000}]}
Here is a working version for the 3phase:
sensor:
- platform: rest
resource: http://YOUR_IP_HERE/current-sample
name: neurio_raw
scan_interval: 1
value_template: '{{ value_json.state }}'
json_attributes:
- channels
- platform: template
scan_interval: 1
sensors:
realtime_consumption_a:
friendly_name: "Consumption A"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[0].p_W }}"
realtime_consumption_b:
friendly_name: "Consumption B"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[1].p_W }}"
realtime_consumption_c:
friendly_name: "Consumption C"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[2].p_W }}"
realtime_consumption:
friendly_name: "Consumption Total"
device_class: power
unit_of_measurement: W
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[3].p_W }}"
I recently bought the Generac PWRcell system and i was hoping to use the local sensors in HA, but i dont get any reply from the URL. Does the local access has been deprecated on the newer versions?
I also have the newer system and can’t seem to get any response from the URL. I tried to scrape the pwrview website but that’s also a mess… any help here would be awesome.
Hey @oriolism and @papacrown , any chance either of you made headway with pwrcell connectivity? My system is being provisioned and I’m curious whether I need to attempt scraping from the inverter or if I’m supposed to be hitting a rebus beacon address instead. Curious for details if either of you might have some updates! Thanks.
Check this project:
Any chance you’d mind discussing strategies for implementation? My discord is AdmiralPete#9678
if you’re in the homeassistant server.
So I am a sensor noob and I am trying to get this up and running with my Neurio. I’m not entirely fluent in some of the syntax of the parsing for the templates so apologies for the basic requests. If I take my JSON from the neurio and use the template editor to parse my data I get the following:
set my_test_json = {
"sensorId": "0x0000C47F51019B45",
"timestamp": "2023-11-07T03:00:23Z",
"channels": [
{
"type": "PHASE_A_CONSUMPTION",
"ch": 1,
"eImp_Ws": 236424866152,
"eExp_Ws": 543326,
"p_W": 203,
"q_VAR": -38,
"v_V": 123.345
},
{
"type": "PHASE_B_CONSUMPTION",
"ch": 2,
"eImp_Ws": 271237108623,
"eExp_Ws": 2272310,
"p_W": 1177,
"q_VAR": -96,
"v_V": 123.876
},
{
"type": "CONSUMPTION",
"ch": 3,
"eImp_Ws": 499067562247,
"eExp_Ws": 3066363462,
"p_W": 1380,
"q_VAR": -134,
"v_V": 123.61
}
],
"cts": [
{
"ct": 1,
"p_W": 203,
"q_VAR": -38,
"v_V": 123.345,
"i_A": 1.766
},
{
"ct": 2,
"p_W": 1177,
"q_VAR": -96,
"v_V": 123.876,
"i_A": 9.833
},
{
"ct": 3,
"p_W": 0,
"q_VAR": 0,
"v_V": 123.862,
"i_A": 0
},
{
"ct": 4,
"p_W": 0,
"q_VAR": 0,
"v_V": 123.335,
"i_A": 0
}
]
} %}
The consumption is {{ my_test_json.channels[2].p_W}}.
This template correctly returns the field for the total consumption.
From the discussion above, I’ve included the following code in my configuration yaml file:
#Try to add local Neurio Sensor
sensor:
- platform: rest
resource: http://192.168.86.118/current-sample
name: neurio_raw
scan_interval: 1
value_template: '{{ value_json.state }}'
json_attributes:
- channels
- platform: template
scan_interval: 1
sensors:
realtime_consumption:
friendly_name: "Consumption Total"
device_class: power
unit_of_measurement: W
value_template: "{{ states.sensor.neurio_raw.attributes.channels.2.p_W }}"
For the value_template field I’ve tried almost all the syntax I found in the discussion above including:
value_template: "{{ state_attr('sensor.neurio_raw', 'channels')[2].p_W }}"
I can see the neurio_raw sensor loaded in the entities section and if I expand it I get the live sensor data JSON:
When I include the code for the realtime consumption sensor I get an error in the log file about unable to iterate on a NONE object. So I assume that means the sensor.neurio_raw object from the prior block isn’t valid.
I can’t seem to extract that channel data into the template sensors despite all my efforts. Any help appreciated!
----Edit Solved------
Looks like an YAML indentation issue in the template section got me. I was able to get it fixed but I can’t use the sensor in the default energy dashboard. I’ll keep working that.