~nabijaczleweli/supla-MEW-01-VA

Extract V/A data from Supla (ZAMEL) MEW-01 for consumption with Prometheus

1df417a So now we also have to retry on EADDRINUSE

1 year, 4 months ago

df16a77 Had upstream network drop and the client didn't reconnect; reexec after a minute with no data

1 year, 4 months ago

#supla-MEW-01-VA builds.sr.ht build status Licence

Wants to talk via a modified supla-console-client, see the Makefile.

The network-loss detexion code is Linux-specific (timerfd), but could be trivially updated for setitimer, and shimmed out even easier (replace timerfd_create() with -1).

$ curl -vvSL localhost:9927
*   Trying ::1:9927...
* Connected to localhost (::1) port 9927 (#0)
> GET / HTTP/1.1
> Host: localhost:9927
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/openmetrics-text; version=0.0.1; charset=utf-8
* no chunk, no close, no size. Assume close to signal end
<
# TYPE supla_total_forward_active_energy_balanced gauge
# HELP supla_total_forward_active_energy_balanced Vector phase-to-phase balancing [Wh/100]
supla_total_forward_active_energy_balanced 848237086 1675620034.073673399
# TYPE supla_total_reverse_active_energy_balanced gauge
# HELP supla_total_reverse_active_energy_balanced Vector phase-to-phase balancing [Wh/100]
supla_total_reverse_active_energy_balanced 1048087196 1675620034.073673399
# TYPE supla_total_forward_active_energy gauge
# HELP supla_total_forward_active_energy [Wh/100]
supla_total_forward_active_energy{phase="1"} 221966368 1675620034.073673399
supla_total_forward_active_energy{phase="2"} 204403344 1675620034.073673399
supla_total_forward_active_energy{phase="3"} 443846852 1675620034.073673399
# TYPE supla_total_reverse_active_energy gauge
# HELP supla_total_reverse_active_energy [Wh/100]
supla_total_reverse_active_energy{phase="1"} 385684354 1675620034.073673399
supla_total_reverse_active_energy{phase="2"} 391038810 1675620034.073673399
supla_total_reverse_active_energy{phase="3"} 293343510 1675620034.073673399
# TYPE supla_total_forward_reactive_energy gauge
# HELP supla_total_forward_reactive_energy [VArh/100]
supla_total_forward_reactive_energy{phase="1"} 102230912 1675620034.073673399
supla_total_forward_reactive_energy{phase="2"} 70105200 1675620034.073673399
supla_total_forward_reactive_energy{phase="3"} 58325742 1675620034.073673399
# TYPE supla_total_reverse_reactive_energy gauge
# HELP supla_total_reverse_reactive_energy [VArh/100]
supla_total_reverse_reactive_energy{phase="1"} 48706402 1675620034.073673399
supla_total_reverse_reactive_energy{phase="2"} 119919340 1675620034.073673399
supla_total_reverse_reactive_energy{phase="3"} 245379708 1675620034.073673399
# TYPE supla_voltage gauge
# HELP supla_voltage [V/100]
supla_voltage{phase="1"} 23559 1675620034.073673399
supla_voltage{phase="2"} 23551 1675620034.073673399
supla_voltage{phase="3"} 23924 1675620034.073673399
# TYPE supla_current gauge
# HELP supla_current [A/1000]
supla_current{phase="1"} 5598 1675620034.073673399
supla_current{phase="2"} 4339 1675620034.073673399
supla_current{phase="3"} 6872 1675620034.073673399
# TYPE supla_power_active gauge
# HELP supla_power_active [W/100000]
supla_power_active{phase="1"} 109303286 1675620034.073673399
supla_power_active{phase="2"} 93724028 1675620034.073673399
supla_power_active{phase="3"} 152398530 1675620034.073673399
# TYPE supla_power_reactive gauge
# HELP supla_power_reactive [VAr/100000]
supla_power_reactive{phase="1"} 60695944 1675620034.073673399
supla_power_reactive{phase="2"} 33953382 1675620034.073673399
supla_power_reactive{phase="3"} 42754088 1675620034.073673399
# TYPE supla_power_apparent gauge
# HELP supla_power_apparent [VA/100000]
supla_power_apparent{phase="1"} 129314152 1675620034.073673399
supla_power_apparent{phase="2"} 100200664 1675620034.073673399
supla_power_apparent{phase="3"} 161193576 1675620034.073673399
# TYPE supla_power_factor gauge
# HELP supla_power_factor [1/1000]
supla_power_factor{phase="1"} 844 1675620034.073673399
supla_power_factor{phase="2"} 934 1675620034.073673399
supla_power_factor{phase="3"} 946 1675620034.073673399
# TYPE supla_phase_angle gauge
# HELP supla_phase_angle [°/10]
supla_phase_angle{phase="1"} 286 1675620034.073673399
supla_phase_angle{phase="2"} 196 1675620034.073673399
supla_phase_angle{phase="3"} 153 1675620034.073673399
# EOF
* Closing connection 0

$ systemctl status supla-MEW-01-VA.service
● supla-MEW-01-VA.service - Extract V/A data from Supla (ZAMEL) MEW-01 for consumption with Prometheus
     Loaded: loaded (/usr/local/lib/systemd/system/supla-MEW-01-VA.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-02-05 05:33:04 CET; 13h ago
   Main PID: 2438001 (supla-MEW-01-VA)
     Status: "latest_served: 1675620034.073673399"
      Tasks: 3 (limit: 115959)
     Memory: 1.2M
        CPU: 5.626s
     CGroup: /system.slice/supla-MEW-01-VA.service
             ├─2438001 /usr/local/libexec/supla-MEW-01-VA localhost:9927 /usr/local/libexec/supla-console-client -i /var/lib/supla-MEW-01-VA/id
             └─2438002 /usr/local/libexec/supla-console-client -i /var/lib/supla-MEW-01-VA/id -input off

Feb 05 05:33:04 tarta systemd[1]: Started Extract V/A data from Supla (ZAMEL) MEW-01 for consumption with Prometheus.

$ systemctl status supla-MEW-01-VA.service
● supla-MEW-01-VA.service - Extract V/A data from Supla (ZAMEL) MEW-01 for consumption with Prometheus
     Loaded: loaded (/usr/local/lib/systemd/system/supla-MEW-01-VA.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-02-05 05:33:04 CET; 13h ago
   Main PID: 2438001 (supla-MEW-01-VA)
     Status: "latest_line: 1675620094.073579069"
      Tasks: 3 (limit: 115959)
     Memory: 1.2M
        CPU: 5.627s
     CGroup: /system.slice/supla-MEW-01-VA.service
             ├─2438001 /usr/local/libexec/supla-MEW-01-VA localhost:9927 /usr/local/libexec/supla-console-client -i /var/lib/supla-MEW-01-VA/id
             └─2438002 /usr/local/libexec/supla-console-client -i /var/lib/supla-MEW-01-VA/id -input off

Feb 05 05:33:04 tarta systemd[1]: Started Extract V/A data from Supla (ZAMEL) MEW-01 for consumption with Prometheus.