Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to compute value if missing from other 2 values #296

Open
gmoscalu opened this issue Mar 10, 2024 · 1 comment
Open

how to compute value if missing from other 2 values #296

gmoscalu opened this issue Mar 10, 2024 · 1 comment

Comments

@gmoscalu
Copy link

gmoscalu commented Mar 10, 2024

Hi there,

I am using JSON_Exporter to monitor some Shelly EM devices (power usage monitoring).

I have configured them allright, but Shelly 3EM provides :

"emeters": [
    {
        "power": 7.81,
        "pf": 0.79,
        "current": 0.04,
        "voltage": 235.16,
        "is_valid": true,
        "total": 142226.2,
        "total_returned": 0.0
    },

while Shelly EM provides only:

"emeters": [
    {
        "power": 0.00,
        "reactive": 0.00,
        "pf": 0.00,
        "voltage": 237.77,
        "is_valid": true,
        "total": 0.0,
        "total_returned": 0.0
    },

As you can see the "current" is missing from the EM output, but since we have the "power" & "voltage" i could be computing it when it's missing, if only i could figure out how to.

My JSON_Explorer config looks like this:

shelly3em:
metrics:
- name: shelly3em
type: object
path: '{ .emeters[0] }'
help: Shelly SmartMeter Data
labels:
device_type: 'Shelly_PM'
phase: 'Phase_1'
values:
Instant_Power: '{.power}'
Instant_Current: '{.current}'
Instant_Voltage: '{.voltage}'
Instant_PowerFactor: '{.pf}'
Energy_Consumed: '{.total}'
Energy_Produced: '{.total_returned}'

Can anyone help:

  • check if ".current" is empty/null
  • if "power" & "voltage" are present in the JSON, compute the current=power / voltage

Thanks in advance,
Gabriel

@Amoolaa
Copy link

Amoolaa commented Mar 11, 2024

It's probably not ideal, but could you not get metrics for power and voltage and calculate the voltage on the query side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants