Energiemanagement mit Loxone – Wallbox

Dies ist der fünfte und vorerst letzte Teil meiner Serie zum Thema Photovoltaik, Energiemonitoring und -management. Teil 1 beschreibt die Grundidee und das Auslesen und Anzeigen von Daten aus dem SMA-Wechselrichter. Teil 2 geht auf die Anzeige von Momentanverbrauch sowie Energiezähler der Novelan-Wärmepumpe ein, Teil 3 stellt das Auslesen von Ladeleistung und Energiezähler des SMA EV Chargers vor. Das eigentliche Energiemanagement wird in Teil 4 vorgestellt, inklusive der Integration der PV-Funktion der Wärmepumpe in den Loxone-Energiemanager. Dieser Beitrag komplettiert die Serie, indem das Management der Wallbox ebenfalls über über Loxone umgesetzt wird, inklusive dynamischem Überschussladen.

„Energiemanagement mit Loxone – Wallbox“ weiterlesen

Energiemanagement mit Loxone – Wärmepumpe

Nachdem die ersten drei Teile meiner Serie sich darum drehten, Energieerzeugung und -Verbrauch an einer Stelle transparent und auswertbar zu machen, soll es nun darum gehen, überschüssige PV-Energie möglichst effizient zu nutzen. Ein Teil der Lösung ist ein Batteriespeicher, der direkt vom Wechselrichter ge- und entladen wird. Zusätzlich ist auch das dynamische Steuern von Verbrauchern eine Option den Grad der Eigennutzung von PV-Strom zu erhöhen. Dafür eignen sich insbesondere Wallboxen zum Laden von Elektrofahrzeugen und Heizstäbe für Warmwasserspeicher. Wir erzeugen unser Warmwasser ohnehin elektrisch mit einer Wärmepumpe, die selbst eine Möglichkeit bietet PV-Überschuss zu signalisieren und die Wärmeerzeugung entsprechend anzupassen. In diesem Beitrag beschreibe ich, welche Optionen mir zur Verfügung standen und wofür ich mich letztendlich entschieden habe.

„Energiemanagement mit Loxone – Wärmepumpe“ weiterlesen

Energiemonitoring mit Loxone – Wallbox

In Teil 3 meiner Serie zum Thema Energiemonitoring mit Loxone stelle ich heute vor, wich ich meine Wallbox, den SMA EV Charger, in mein Loxone-System eingebunden habe. Im ersten Schritt wollte ich vor allem die aktuelle Leistungsaufnahme der Wallbox sowie die Zählerstände auslesen, um den Energiefluss und die Verbrauchswerte zentral darstellen zu können.

TL/DR: Wer eine Lösung für smartes PV-Laden seines Elektrofahrzeugs sucht, die ohne Loxone und Home Assistant einfach funktioniert, sollte sich EVCC anschauen. Wer einfach nur einen SMA EV Charger in Home Assistant integrieren möchte, dem sei die SMA EV Charger integration for Home Assistant empfohlen. Wer außerdem Hintergründe, Codebeispiele oder die fertige Loxone-Integration sehen möchte, darf gerne weiterlesen.

„Energiemonitoring mit Loxone – Wallbox“ weiterlesen

Energiemonitoring mit Loxone – Wärmepumpe

Dies ist der zweite Teil meiner Serie zum Thema Energiemonitoring und -management im Smart Home mit Loxone. Teil 1 „Energiemonitoring mit Loxone und SMA“ beschreibt meine Motivation, meinen Energieverbrauch besser zu verstehen, z.B. um die Photovoltaikanlage bestmöglich zu nutzen, sowie die Schritte um alle Informationen aus der App meiner PV-Anlage in Loxone abzubilden. In diesem Beitrag stelle ich dar, wie ich diese Grundfunktionalität erweitert habe, um den Energieverbrauch unserer Wärmepumpe separat vom Rest der Verbraucher zu erfassen, um diesen getrennt analysieren zu können, und warum meine Lösung auch diesmal ohne Modbus auskommt.

„Energiemonitoring mit Loxone – Wärmepumpe“ weiterlesen

Energiemonitoring mit Loxone und SMA

Wer meinen Blog verfolgt, hat mitbekommen, dass ich im September über das KfW-Förderprogamm 442 geschrieben habe. Es ging um die Beantragung einer Förderung für Photovoltaik-Anlagen. Damit bin ich überhaupt nur in Kontakt gekommen, weil wir selbst eine PV-Anlage installieren lassen wollten. Das war dann im November auch der Fall, und seitdem produzieren wir je nach Witterung eigenen Sonnenstrom. In diesem Artikel beschreibe ich, wie die eigene PV-Anlage einen ganz neuen Blick auf Energieverbrauch und -erzeugung eröffnet, wie man als Nerd mit dieser Motivation umgehen kann, und wie ich seitdem meine Energiebilanz verfolge.

TL/DR: Wer einfach nur wissen möchte, wie man möglichst einfach die Daten aus einem SMA TriPower Smart Wechselrichter mit einem Loxone Miniserver abrufen kann: Per Browser am Wechselrichter einloggen, im Benutzermenü den Smart Inverter Screen aktivieren, damit die Messwerte direkt auf der Starseite sichtbar sind, dann meine Vorlage für den HTTP-Eingang in die Loxone Config importieren und die IP-Adresse anpassen. Zack, feddich: Virtuelle Eingänge!

„Energiemonitoring mit Loxone und SMA“ weiterlesen

KfW-Förderprogamm 442 – technische Betrachtung

Disclaimer: Dieser Post spiegelt meine private Erfahrung mit dem Antragssystem wider und steht in keinem Bezug zu meiner beruflichen Tätigkeit. Meine einzige Verbindung zum Portal „Meine KfW“ ist mein privater Account auf der Plattform, den ich zur Antragstellung angelegt habe. Sämtliche Inhalte dieses Posts basieren auf Informationen, die allen Antragsteller:innen zugänglich waren.

Hintergrund

In den vergangenen Tagen haben bereits viele Medien über die Antragsphase des KfW-Förderprogramms 442 „Solarstrom für Elektroautos“ berichtet (etwa heise.de, tagesschau.de). Dieser Post wird die grundsätzlichen Probleme daher nicht erneut darstellen, sondern stattdessen einige Details hinzufügen, die in der breiten Berichterstattung bisher nicht vorkamen – sicher auch, weil sie vor allem für Web-Entwickler und -Tester interessant sein dürften, nicht aber für den Großteil der Bürger. Dennoch haben sich einige „Puzzleteile“ so perfekt aneinander gefügt, dass die hier aufgestellten Hypothesen zu den Gründen für den holprigen Verlauf der Antragsphase zunehmend wahrscheinlich erscheinen.

„KfW-Förderprogamm 442 – technische Betrachtung“ weiterlesen

Hardening a Simple WordPress Site

This ist part 2 of my mini series on setting up a WordPress site for my daughter’s primary school. In part 1, I covered the basic setup, including TLS and various security-related HTTP headers. In this post, I outline some steps specific to WordPress to secure your site. As I already introduced Cloudflare as a comfortable means of securing a site, I will continue to refer to Cloudflare in this post as well.

„Hardening a Simple WordPress Site“ weiterlesen

Updating to macOS Monterey with an Aftermarket SSD

Update 2021-11-01: It seems this error is quite common, and at this time, the only solution confirmed to be working over on StackExchange and MacRumors is the one that Worked for me, too.

I’ve spent a few days trying to install macOS Monterey on my late 2014 Mac Mini. In order for other people to save some time trying various general purpose advice, I summarize my findings here. In case you just want to know how to fix it, jump to the solution section at the end of this article. If you want to understand what is going on, keep reading.

The Error Message

Running the macOS Monterey installer, after a few minutes, and right before the first reboot („closing programs and preparing reboot“), an error message was shown (German: „Beim Vorbereiten der Installation ist ein Fehler aufgetreten. Versuche, das Programm erneut auszuführen.“, English: „An error occurred while preparing the installation. Try running this application again.“).

Screenshot of error message "An error occurred while preparing the installation. Try running this application again."

While trying many things in order to fix the issue (see below), I came across another error message:

osinstallersetupd[313]: Forcing MSU springboard for target: disk1s1 (has EFI without NVMe update support)

What did NOT Work

All of the following approaches did not work and led to the same result:

  • Running the installer from „System Settings“
  • Copying the installer bundle from another Mac
  • Checking and repairing the disk using Disk Utility
  • Creating a new admin user account and installing from there
  • Using System Restore (⌘ + R)
  • Using Internet System Restore (⌘ + ⌥ + R)
  • Using a bootable installer USB drive

The Reason

A few days later, a web search finally brought up a thread in Apple’s support forum, which contained an explanation as well as a proposed solution. The argument goes like this:

  • The issue is most likely caused by an outdated EFI / boot ROM
  • Boot ROM updates are not provided as standalone updates, but are included in macOS installers
  • The Monterey installer needs a new boot ROM in order to run successfully
  • Apple just updates the boot ROM if an original, Apple-produced system drive is present
  • On Macs with third-party system drives, the boot ROM update fails, causing the error message

The Solution

In order to verify that your Mac has an outdated boot ROM, you can check your current version – either using an app such as SilentKngiht, or by running the following Terminal command and checking the result against this list.

/usr/libexec/firmwarecheckers/eficheck/eficheck --integrity-check

If your boot ROM is indeed outdated, and you are lucky to have the original Apple hard drive or SSD around, you can upgrade to macOS Monterey by following these steps:

  1. Remove your current SSD, put in the original SSD
  2. Install or update to Monterey on that drive
  3. Verify you got the latest boot ROM
  4. Power down, swap your main SSD back in
  5. Install Monterey on your main SSD

For me, this completely fixed the issue, and I now run macOS Monterey on my Mac Mini with its third-party SSD.

Further Reading

Here is another resource I discovered during my quest (thanks to @AppleSupport): If an error occurred while updating or installing macOS

Securely Setting Up a Simple Website

This post aims at providing simple step-by-step guidance on how to set up a small, cost-efficient, yet secure website as an individual or organization. Being written by a single person using a single web site as an example, this post is highly opinionated. In order to put some of the decisions into perspective, the following paragraph outlines the project context, before we take a deeper look into the decisions themselves and the particular implementations.

Example: Primary School Website

As mentioned in an earlier post, I volunteer in the support association („Förderverein“) of my daughters‘ primary school. Currently, neither the association nor the school itself have their own website, let alone an IT department. Because I work in tech, I was approached by the school’s principal who asked for advice on how to get started building a website. They had already taken several attempts on putting up a site, but never got very far. There was a free offering available, which was provided by the state administration, but that seemed cumbersome to work with. Commercial options were considered as well, but it was hard to judge which of those were best suited for them.

Our Choice: Managed WordPress

Driven by personal interest, I have been following cyber security news for a couple of years, including blogs like troyhunt.com, scotthelme.co.uk, and podcasts like Security Now, Cyber Security Sauna, Random but Memorable, or InnoQ Security, so I wanted the site to be configured as securely as possible, but still require low maintenance effort and be cost-efficient.

While WordPress has made the cyber security headlines quite some times in the recent past, many of those incidents have been due to vulnerabilities in plugins, and lack of updates. So in order to operate a WordPress site, my priorities were clearly keeping the number of plugins to the absolute minimum, and (similar to this blog) selecting a managed offering, in which securing and updating WordPress is not primarily my own responsibility.

Since we are a (very) small non-profit organization in Germany, completely run by volunteers, responsibilities might change in the future, and therefore we voted against choosing one of the US-based heavyweights in the market, but went for a local, specialized vendor instead. They offer German customer service, including phone support, which gives us the confidence of being able to transfer responsibilities to less tech-savvy person in the future, who might also not be as comfortable communicating in English.

Regardless of this decision, the following paragraphs universally apply to any web hosting solution, given that it comes with a dedicated domain and allows for name server changes.

Optimizing the TLS Configuration

One fundamental advice given by security professionals is that a lot of security comes with secure default settings. Therefore, I tried to achieve a sensible, secure default configuration for the site. The first step was enabling HTTPS on the site itself. This could be done by activating Let’s Encrypt in the admin panel.

Since settings were limited in terms of protocol versions, HSTS headers etc, I chose to follow Troy Hunt’s advice on httpsiseasy.com and put Cloudflare in front of the site. This is basically achieved by changing the name servers of the domain over to Cloudflare’s servers, allowing them to route all of the traffic to your site though their network. Cloudflare offers many features, like caching of requests or protecting agains DDoS attacks, but we’ll focus on those features that are relevant for improving the security of your site.

After completing the TLS setup on Cloudflare as suggested over at httpsiseasy.com, our site scores an A+ on ssllabs.com.

CSP and Other Headers

One thing I wanted to do for the site was create a Content-Security Policy (CSP). Basically, a CSP is a way to define which other sources your site should be allowed to pull stuff from, with „stuff“ being images, font, style sheets, scripts, and the like. Some time ago, I came across a site selling learning toys for kids, which immediately forwarded me to a malicious site showing loads of ads. This was achieved by someone (probably a script or a botnet) using a vulnerability on their site to inject a malicious script into the page. Had they used a CSP, my browser would have just refused to load that script, since it was hosted on another domain. Also, CSP provides a means of reporting such events, but I’ll cover this in another post.

In order to find out which other relevant headers exist, I recommend checking securityheaders.com by Scott Helme, which checks your site for common, security-related headers and recommends changes, along with great explanations of what they mean and how to set them. All these features are controlled by sending HTTP headers in your site’s responses. These headers are interpreted by the browser to e.g. block certain content. Depending on your web host, you may not get full control over the HTTP headers sent by the server. This is where Cloudflare workers come into play: Workers are basically code snippets that run each time a certain request is made to your site. While there is lots of use cases for workers, we’ll focus on a very simple one: On every request, add some statically defined HTTP headers to the result. This is achieved by the following worker code (adapted from this example in Cloudflare’s documentation):

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

async function handleRequest(request) {
  const response = await fetch(request)
  
  // Clone the response so that it's no longer immutable
  const newResponse = new Response(response.body, response)
  
  // Add securirty headers
  newResponse.headers.append("Upgrade-Insecure-Requests", "1")
  newResponse.headers.append("X-Frame-Options", "SAMEORIGIN")
  newResponse.headers.append("Referrer-Policy", "strict-origin-when-cross-origin")
  newResponse.headers.append("Permissions-Policy", 
    "accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=(), usb=(), interest-cohort=()")

  return newResponse
}

Once the worker is deployed and active, we have to make sure it runs on every request, which is achieved by adding a route and assigning the worker to it. In our case, we want to run this worker on every request, so we just copy the default route and assign our new worker.

Cloudflare’s free plan includes 100.000 worker invocations per day, which should be plenty for a small website. Still, you’ll have to decide what should happen in the rare occasion that you hit the limit. Your options are failing open, meaning that your site will still be reachable, but the worker will not run, and hence security headers will not be added anymore for the rest of the day, or failing closed, meaning your site will not be reachable for the rest of the day, but you can be sure it will always have security headers when it is.

Using these modifications, our site now gets an A rating on securityheaders.com, giving us the confidence that we do our best to protect visitors from malicious activity, even in case our site gets compromised.

Part 2: Hardening WordPress

So far, all of the above settings apply to any website, wether you use WordPress or any other offering. The next post will cover additional steps specific to WordPress.

An Accidental IPv6 Experiment

I just took over some new voluntary responsibility of managing the paperwork for the support association („Förderverein“) of my daughter’s primary school. Trying to get an overview over the current topics, I flipped through the recent documents, when I found a printed e-mail from the school’s director. The most surprising thing about that e-mail was that I had never seen it before, although my name and correct e-mail address was clearly visible in the To: field.

I started to wonder: Had I received the message, archived and forgot about it? Was it blocked by the spam filter? Was there something wrong with my mail client? This is how the search started.

„An Accidental IPv6 Experiment“ weiterlesen