Kategorien
Allgemein

SMA Energymeter Analyzer Tool with SQL and MQTT

I wrote a little tool for the SMA Energymeter. The tool can just print the data to console (once or every second) or export the data to MQTT or mySQL.

Check it out on https://home.contes.eu.

andreas@ds-logger:~$ ./smaemtool --break --mqtt --sql
Version 1.0
Timestamp: 24.02.2023 16:19:22
Unix timestamp: 1677251962
Break set, running only once.
MQTT set, export to MQTT enabled.
SQL set, export to SQL enabled.
Listening for multicast packets on 239.12.255.254:9522...
Received 600 bytes from 192.168.0.124:
Power Import:    492 W
Power Export:    0 W
Phase 1 Import:  88 W
Phase 2 Import:  346 W
Phase 3 Import:  57 W
Phase 1 Export:  0 W
Phase 2 Export:  0 W
Phase 3 Export:  0 W
Message sent to MQTT broker 192.168.0.60 on topic smaemtool.
Starting SQL export to server 192.168.0.50, Database PV.
Data successfully inserted into table smaemtool.

German translation for SEO:
Ich habe ein kleines Tool für das SMA Energymeter geschrieben. Das Tool kann die Daten einfach auf der Konsole ausgeben (einmal oder jede Sekunde) oder die Daten nach MQTT oder mySQL exportieren.

Kategorien
Allgemein

Solarpix!

Kategorien
Allgemein

SNMP Bandwidth Monitoring with Node-Red

This is an example of how to monitor the bandwidth usage of a firewall. The data is queried via SNMP from the firewall and visualized via Node-Red. Firewall System in this case is an OPNSense.

SNMP Bandwidth Monitoring Flow with Node-Red

The background: On Linux systems you can’t query utilization via SNMP. You can just query the number of octets transmitted or received on a specific interface.

The trick: Query the octets of input and output interface, wait for 1 second and check query again. Then subtract both values from each other and convert them to MBit/s.

Here are the single node configurations for the Input Utilization:
Start with Inject node: Mark inject once after 0.1 seconds and set repeat to 2 seconds.
SNMP node (WAN interface input): OID 1.3.6.1.2.1.2.2.1.10.1 (beware: no leading dot)
Split node (split): default
Change node: Move msg.payload.value to msg.payload
Head over to the Delay node: Configure a 1 second delay
Add another SNMP, Split and Change Node with same parameters as above
Combine both Change nodes with a Join node (Input): Manual Mode, combine each msg.payload to create an array after a number of message parts: 2
Add a function node to calculate the bandwidth utilization:

msg.payload = msg.payload[1] – msg.payload[0];
msg.payload = msg.payload / 1048576 * 8;
return msg;

At least (for input) add a chart node, label it input and configure x-axis last 1 minute.
To add another graph for Output, just copy and paste the flow above and change the OID in the two SNMP nodes to OID 1.3.6.1.2.1.2.2.1.16.1 for outgoing packets.

Node-Red Dashboard: Bandwidth Utilization WAN Interface

Kategorien
Allgemein

OPNSense / pfSense High Availability

If you have problems with High Availability, CARP and DHCP failover on pfSense or OPNSense, you should check that the interfaces on both systems are the same. It is not the freely assigned interface name that counts, but the names that the system assigned during the initial setup (OPT1, OPT2, and so on). So, if interface VLAN10 on Master is OPT1 and VLAN10 on Backup is OPT2, then some functions like DHCP synchronization will not work! You will see errors like:
„DHCP rejected: Connection rejected, invalid failover partner“ or
„[…] rejected: Connection rejected, invalid failover partner.“ or
„dhcp failover peer state unknown“
It does not matter that the IP connection works! The (system) names of the interfaces are relevant.

Kategorien
Allgemein

Monitoring PV energy generation, consumption, import and export

Since 2013 we have a photovoltaic system with 5.2kWp on our houses roof. In combination with the SMA inverter it was not a big deal to monitor the PV output. There is a webpage of SMA where you can see the outputs for every day, month and year. The inverter itself sends the data to the SMA servers.

Now I wanted to montitor and visualize all the data by myself. And not only the PV output but also the energy consumption. Which means additionally power import and export. To get these data I installed the SMA Energy Meter. With this piece of hardware you are able to monitor the energy flow for every phase in your house. The measured values are then broadcasted, or better multicasted, to your local lan.

I wrote a little programm to receive these multicasts, extract the interesting values and save them in a SQLite database. Additionally I used the SBFSpot tool to get the current PV output from the inverter. The current PV output will also be saved in a SQLite DB. A small webpage collect all the data from the database and visualize them with Highcharts.

Here are some screenshots of the beta version. It also runs quite fast on a Rasperry Pi 2, but currently I use it on Ubuntu 14.04 LTS.

PV Output, Energy Export and Import.
PV Output, Energy Export and Import.

PV Output, Energy Export and Import.
PV Output, Energy Export and Import (Zoom in/Extract)

PV Output only
PV Output only

Kategorien
Allgemein

Shuttle DS57U Network Performance Tests with iperf

Did some network performance tests with my new Shuttle DS57U. I installed the actual IP Fire 2.17 Core Update 89 on a 16GB SDHC Card, connected the Intel i211 NIC to internal (green) interface and the Intel i218LM NIC to the external, red Interface. I also started the OpenVPN Server on the external Interface. Here are the results…

1st test. Plain routing:

iperf -c 192.168.0.200 -w 256k -l 256k -P2
————————————————————
Client connecting to 192.168.0.200, TCP port 5001
TCP window size: 256 KByte
————————————————————
[ 4] local 192.168.1.1 port 52004 connected with 192.168.0.200 port 5001
[ 3] local 192.168.1.1 port 52003 connected with 192.168.0.200 port 5001
[ ID] Interval Transfer Bandwidth
[ 4] 0.0-10.0 sec 562 MBytes 471 Mbits/sec
[ 3] 0.0-10.0 sec 562 MBytes 471 Mbits/sec
[SUM] 0.0-10.0 sec 1.10 GBytes 941 Mbits/sec

2nd test. Download an ISO image from internet. Proxy and URL filter (ad, adv) were active:

DS57U bwm-ng download

DS57U htop download

30MB/s…this is limited to my 250 MBit/s Internet connection :-/

3rd test. OpenVPN Performance:

iperf -c 192.168.1.200 -w 256k -l 256k -t 60
————————————————————
Client connecting to 192.168.1.200, TCP port 5001
TCP window size: 256 KByte
————————————————————
[ 3] local 10.41.21.6 port 54497 connected with 192.168.1.200 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0-60.1 sec 648 MBytes 90.6 Mbits/sec

DS57U htop OpenVPN

More Tests (with different Window Sizes, power consumption etc.) and more Screenshots can be found here.