2023-01-19

Using rootful podman-compose on Centos9

In the last weeks I updated my home server from Centos8 to Centos 9 stream. As part of this I also switched from docker to podman. This was no problem for single container but in case of multiple container working together - aka are composed - it wont work as expected. 

E.g in a setup of two container in a pod - app and db - the app can't resolve (and reach) the db. 

After multiple trial and error setups, crawling, reading through the web - filter out obsolete tips etc. I switch to "netavark" - (see https://github.com/containers/podman-compose/issues/455), be aware that the mentioned command podman system reset --force will remove all volumes (Yes, I did have a backup.)

In the end - all does not help ... I was about to give up. But then I found a hint how to look in the dns config of the container:

$ more /run/containers/networks/aardvark-dns/gogs_default
10.89.0.1
9951847ba473d97b6bf1e834b490 10.89.0.4 gogs_db,db,9951847ba473
6b06aee614d7584d32f3912e3b2c 10.89.0.5 gogs_app,app,6b06aee614d7

Ok, this mean the aardvark-dns is configured right. Next I look in the logs:

$ journalctl -t aardvark-dns
21:06:57 s...de aardvark-dns[1998]: Received SIGHUP will refresh servers: 1
21:06:57 s...de aardvark-dns[1998]: Unable to start server unable to start CoreDns server: \
                                    Address already in use (os error 98)
Looks like the aardvark-dns is in conflict with my name server runing on the same maschine.
$ ps 1998
 PID TIME COMMAND
1998 0:00 /usr/libexec/podman/aardvark-dns --config /run/containers/networks/aardvark-dns -p 53 run
Interesting - it is running on port 53 - like bind.

Finally I found out how to configure the port aardvark is using: it is a further entry in the file where I already switch to netavark.

$ more /etc/containers/containers.conf
[network]

# Explicitly use netavark. 
# See https://github.com/containers/podman-compose/issues/455
network_backend = "netavark"

dns_bind_port = 5533
Restart ... it runs.

2021-10-17

Update: Display TTN-Gateway status

After migrating my TTN gateway to the new The Things Stack Community Edition (see previous blog post) my script to display the gateway status stopped working. The reason behind was, that the new stack does not provide the noc api which was used in the script.

After searching in the TTN forum I found the thread New API for gateway mapping, status and info. Using this API I just need to change one line in my script and now it works again.

-  cmd = "curl -s http://noc.thethingsnetwork.org:8085/api/v2/gateways/eui-b827ebfffe06902a | jq -r '.timestamp'"
+  cmd = "curl -s https://mapper.packetbroker.net/api/v2/gateways/netID=000013,tenantID=ttn,id=eui-b827ebfffe06902a | jq -r '.updatedAt'"
The updated script is available in the github repo.

Migrate TTN-Gateway to The Things Stack Community Edition (aka V3)

 I just migrate my TTN-gateway to the new The Things Stack Community Edition (aka V3). 

I followed the instructions I found in the thread on GitHub.

  1. Create a new gateway on the things network (link)
  2. Change the server url in your local_conf.json to eu1.cloud.thethings.network
  3. Restart the gateway
Unfortunately the new stack does not provide a NOC api - so my script to output the gateway status to a OLED stop working. I will invest into this next.

2020-10-12

Photovoltaic dashboard with Grafana

I have a SolarEdge Inverter which is monitored by a energy meter (SolarEdge SE-MTR-3Y-400V-A). The energy meter gets measurements from the inverter and measures voltage and current at the house entry point.



SolarEdge provide a monitoring service and a mobile app to monitor the system. An example is shown here:


To be able to monitor and evaluate the measurements by myself I use the following applications:
  • mbmd - to read the measurements from the inverter and energy meter
  • nodered - to calculate some derived values 
  • mqtt - to "transport" the measurements between the apps
  • telegraf - to write the measurements into influxdb
  • influxdb - to store the measurements
  • grafana - to display the measurements



The result looks like this (a snapshot is available here):



Configuration 

mbmd

The mbmd reads the measurements from the inverter and (via the inverter) from the energy meter.
pi@racknode:/etc $ more mbmd.yaml
# REST api, use 127.0.0.1 to restrict to localhost
api: 0.0.0.0:8080

# mqtt config
mqtt:
  broker: my.mqtt.server:1883
  topic: mbmd
#  user:
#  password:
  clientid: mbmd
  qos: 0
  homie: ""
  # homie: homie


# adapters are referenced by device
adapters:
- device: inverter.ip.addr:1502

# list of devices
devices:
- name: inverter
  type: SE
  id: 1
  subdevice: 0 # use subdevice to access SunSpec subdevices
- name: powermeter
  type: SE
  id: 1
  subdevice: 1 # use subdevice to access SunSpec subdevices

Node-Red

To calculate the "self consumption" and split the measured power in Import/Export I create a Node-Red flow:


Here is the corresponding flow code.

Telegraf

The telegraf is configured to transfer the mqtt messages to the influxdb. 

The config is available here.

Grafana



A snapshot of the dashboard is available here and also the dashboard.json is available.


2020-10-03

HP MFP M754DN Fix "Scan to Network" error

My multifunction printer HP MFP M754DN has the ability to scan to a network folder. The target folder is provided by a samba server running CentOS8. It works with out problem but stops to be able to access the network folder some weeks ago. 

Testing the connection on the webgui results in the message: "Cannot connect to the network folder. Ensure the shared folder name is correct."


To fix it I have added the following lines in the smb.conf file on the samba server.
server min protocol = NT1    
min protocol = NT1
A further analysis of my last update activities showed that this was related to the update of the samba package from samba-4.10.4-101.el8_1.x86_64 to samba-4.11.2-13.el8.x86_64. 
According to Samba 4.11 WhatsNew the "SMB1 is disabled by default" now - and the HP printer unfortunately uses only SMB1. With the mentioned settings you enabled the SMB1 protocol again.

2020-04-19

A 3d printable case for a ZigBee Gateway

I create a 3D model of a case for the ZigBee board.

 

In the cap is a cutout to place a neodymium magnet.


STL files are uploaded to my Thingivers account (link).