ADCH++ on OpenSuse 11.4 / 12.1

This is my documentation of my first try building the ADCH++ hub software. The result is a private, register-only ADC Hub with encrypted connections. Before you proceed I recommend reading the basic and expert user guide which are very well written.

I’ve used version 2.8 from sourceforge which you can grab from here:

http://sourceforge.net/projects/adchpp/files/Releases/ADCH%2B%2B%202.8/2.8.0/

Download the adch++ source from sourceforge and extract:

cd /tmp
wget adch++ <source-url>
tar xfv adchpp_2.8.0_source.tar.gz
cd adchpp_2.8.0_source/

Now we need to install the build tools. I’ve accepted all the vendor changes for python and readline-devel packages on OpenSuse 11.4. On 12.1 I was able to install them directly.

zypper in swig scons gcc-c++ libstdc++-devel python readline-devel openssl-devel

Compile adch++ now through:

scons mode=release

Create a new user account for runnning the hub service because root should not do that.

mkdir /home/adchpp
mkdir /home/adchpp/bin/
useradd -r -s /sbin/nologin -d /home/adchpp adchpp
chown -R adchpp:users adchpp/

# make the config directory accessible
chown -R adchpp:users /etc/adchpp/

Copy binaries, scripts and config files

mkdir /home/adchpp/bin/
cp build/release-default/bin/* /home/adchpp/bin/
mkdir /etc/adchpp
mkdir /etc/adchpp/scripts
cp -rf plugins/Script/examples/* /etc/adchpp/scripts/
cp -rf etc/* /etc/adchpp/

The hub could be started now, but we wanted encrypted connections which need some more configuration.

cd /etc/adchpp

# Make the line endings unix style
dos2unix Script.xml
dos2unix adchpp.xml

# Create certificates for encrypted connections
mkdir certs
cd certs/
openssl genrsa -out privkey.pem 2048
openssl req -new -x509 -key privkey.pem -out cacert.pem -days 1095
openssl dhparam -outform PEM -out dhparam.pem 1024

Enable TLS connections

vi /etc/adchpp/adchpp.xml

Insert the following snippet into the right config section.

<Server Port="2780" TLS="1" Certificate="/etc/adchpp/certs/cacert.pem" PrivateKey="/etc/adchpp/certs/privkey.pem" TrustedPath="/etc/adchpp/certs/trusted/" DHParams="/etc/adchpp/certs/dhparam.pem" />

Get the scripts working. I have added the json, autil and aio.lua to the list. The Script.xml should look like this then:


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--Ensure that you load the scripts in this order so that they work correctly.-->
<ScriptPlugin>
        <Engine language="lua">
                <Script>/etc/adchpp/scripts/json.lua</Script>
                <Script>/etc/adchpp/scripts/aio.lua</Script>
                <Script>/etc/adchpp/scripts/autil.lua</Script>
                <Script>/etc/adchpp/scripts/access.lua</Script>
                <Script>/etc/adchpp/scripts/access.bans.lua</Script>
                <Script>/etc/adchpp/scripts/access.guard.lua</Script>
                <Script>/etc/adchpp/scripts/access.op.lua</Script>
                <Script>/etc/adchpp/scripts/access.bot.lua</Script>
                <Script>/etc/adchpp/scripts/motd.lua</Script>
                <Script>/etc/adchpp/scripts/history.lua</Script>
        </Engine>
</ScriptPlugin>

Start the hub under our new adchpp user

sudo -u adchpp /home/adchpp/bin/adchppd

Result:

Starting..Processing HubName
Processing Description
Processing Log
Processing LogFile
Processing MaxCommandSize
Processing BufferSize
Processing MaxBufferSize
Processing OverflowTimeout
Processing LogTimeout
.
2.8.0 (r0) Release running, press ctrl-c to exit...

Looking good. Now we should be able to connect with dc++ to our server using adcs://ip:port. If something is not working or you are not able to execute any commands you should have a look into the log file in /etc/adchpp/logs/

The following steps are allready well documented in the basic user guide. I’ve listed them here only for the sake of completeness.

How to get the operator status

To make yourself the OP type the following into the dc++ chat.

+regme <password>
[20:58] You're now successfuly registered with the Password: <password>

Then stop the hub and edit the users.txt in your /etc/adchpp/ directory and set your user level to 10.

Start the hub again and you will see that your the boss now.

How to limit access to registered users only

+cfg maxusers 0

How to register new users

+regnick <nick> <password> <level>

Now your hub is up and running and you can send out some invites. Have fun :)

Keine Kommentare


A Quick User & Role Management Solution

In the last few days I have played a lot with the version control system git. I’ve worked on a user and role management solution on GitHub for smaller and maybe medium sized ASP.NET MVC projects.

I wanted to have something which is pluggable into any other future project without duplicating this (boring) code over and over again.

My solution for that consists of two parts. One the one hand there is a static helper class which generates all the html, css and JavaScript code needed for the user interface. On the other hand there is an external controller, which provides all the role and user account data requested by the client.

The user interface is divided into 3 parts: The user accounts as a sortable table, a form for creating new user accounts and a form for managing roles.

If you are tired of reading yet just watch the demo application at AppHarbor:
http://usermanagementdemo.apphb.com/

Features:

  • Paged user list by using mottie’s tablsorter fork and pager plugin (included in MyHtmlHelper)
  • Create / delete user accounts
  • Create / delete roles
  • Manage roles for users
  • Client-side success and error messages
  • Custom user authorization possible
  • Any membership or roleprovider can be used

+ Unlocking user accounts

There are some points though you need to know before trying out:

  • The user table is loaded at once which is a bad idea for > 1000 users ?!
  • All data is rendered on the client through JavaScript, which is no showstopper if you know the admin’s browser settings.

If you are currently starting a new project, it might be a simple and quick solution for you. You can still mess around with an advanced system when your project grows.

The full source code including the demo application is available at GitHub:
https://github.com/Epstone/Simple-MVC-User-Management

,

Keine Kommentare


myPVLog ist online

So… seit ein paar Tagen ist nun myPVLog.de als Nachfolger von solar.riedme.de online und das wollte ich in meiner kleinen Ecke des Internets mal veröffentlichen.

Die Aufgaben des Portals sind die gleichen wie zuvor, nämlich das Empfangen und Verarbeiten von Betriebsdaten von Kleinkraftwerken, wie z.B. der aktuellen Einspeiseleistung.
Diese Daten werden nach der Übertragung in einer Datenbank gespeichert und können im Anschluss in Diagramm- und Tabellenform dargestellt werden. Hierdurch lässt sich die Funktionsfähigkeit der eigenen Anlage überprüfen, da man live mitverfolgen kann wieviel Strom gerade produziert wird und welchen Ertrag man über den Tag, Monat oder Jahr erhält.

Die Oberfläche wurde natürlich auch etwas überarbeitet und es schaut nun alles ein wenig übersichtlicher und kompakter aus. Daneben sind dann noch folgende neue Funktionen hinzugekommen:

  • Öffentliche Registrierung
  • Anlagen können selbstständig angelegt und verwaltet werden
  • Erweiterte Wechselrichterverwaltung
  • Exportschnittstelle zu Sonnenertrag.eu und PV-log.com im SolarLog Format

Wie man das eigene Kraftwerk an die Seite anbinden kann ist in der API beschrieben, nämlich mit einfachen URL Aufrufen, bzw. HTTP GET Anfragen. Wäre natürlich toll, wenn der ein oder andere sich mit an die Seite hängen könnte, damit die Anlagenübersicht in Zukunft nicht mehr so leer ausschaut ;)

Wie man hardwaremäßig die Anbindung für Kaco-Wechselrichter hinbekommt habe ich hier und hier beschrieben. Mit Linux Grundkenntnissen durchaus machbar. Bei anderen Wechselrichtern kommt es darauf an, was auf den Schnittstellen ausgegeben wird. Das kann dann schon deutlich schwieriger sein, wenn man erstmal ein proprietäres Herstellerprotokoll in C umsetzen muss…

Für mich gibt es natürlich noch kleinere Dinge zu erledigen, wie z.B. die prozentuale Abweichung von der Nennleistung, Unterscheidung von Anlagen die gerade off- oder online sind und manch andere Funktion.

,

Keine Kommentare