MAX!CubeMigrationToFHEM: Unterschied zwischen den Versionen

Aus FHEMWiki
Zeile 79: Zeile 79:
room by room, one by one. Just identify the fhem-name in the "MAX"-room in fhem and adjust the address (last hex-number in the line).
room by room, one by one. Just identify the fhem-name in the "MAX"-room in fhem and adjust the address (last hex-number in the line).


===== Important =====
===== Understanding the setup =====
The rooms are still controlled from the MAX!Cube and MAX-software. fhem only listens and has useable names. fhem does not communicate with the devices and it cannot configure devices.
The rooms are still controlled from the MAX!Cube and MAX-software. fhem only listens and has useable names. fhem does not communicate with the devices and it cannot configure devices. However you have useable and human-understandable names instead of hex-codes.


==== fhem One-Time Device-specific configuration ====
==== fhem One-Time Device-specific configuration ====

Version vom 30. Januar 2014, 21:08 Uhr

WORK IN PROGRESS / NOT FINISHED: HowTo Migrate from MAX!Cube to fhem

Summary: This pages describes the steps required to migrate a house installation from MAX!Cube solution (using a Cube and MAX! Software from ELV/EQ-3) to fhem on a Raspberry Pi combined with a CUL. The benefit of such a migration is to gain better logfiles, to get graphs (Desired vs. Actual temperature and Valve position) and more reliable software.



Initial situation

The appartment has 125 sqm and five rooms (child 1, child 2, livingroom, bedroom, working room), one bathroom, a kitchen and a toilette. Each room has one heater below the window, the living room has two heaters. Two rooms require multiple window shutter contacts: bedroom and living room due to the amount of windows. MAX!Cube software is running since a year controlling all heaters, all windows and in combination with one wall thermostat in the living room and one ECO-switch at the main door to bring the full house to ECO mode when leaving.

Desired situation

MAX!Cube software was unstable and the update to v1.3.10 triggered the decision to move to a new setup: keep the MAX system, but control it via fhem. Have the ability to add more sensors, more actors from other brands than MAX (looking for Homematic due to the amount of different sensors and 1-Wire to avoid the unreliable radio transmission). Have the ability to better see what the system is doing (logfiles) and graph it out (diagrams for each room). Get some more flexibility for home-cinema setup, for light controls, etc. Increase the WAF (Women's Acceptance Factor) for the wife who was complaining about the MAX!Cube solution.

Procurement list

While it is possible to use the existing MAX Cube with fhem certain features would not be available. Therefore I decided to go with a Rasperry Pi and a CUL. Here is the shopping list:

  1. Rasperry Pi from G3 with cooling kit for enhanced reliability ([1])
  2. 32 GB SDHX Card Class 10 from SANDisk
  3. CC1101-USB-Lite 868MHz ([2]) with 36cm antenna (+8dBi) for MAX protocol
  4. 8 Channel 1-Wire Daughterboard without RTC with some sensors for testing ([3])

(Note: The 1-Wire board has not yet arrived and may not fit into the supplied case - but I am too lazy to attach the cooling modules myself).

Installation of Raspberry Pi

Please follow one of the many documentations how to install Linux on your Raspberry Pi - a good starting point would be [4]. I tried to install Raspbian using the advanced method of copying the image directly to the SD-card but it did not worked out well as many perl/python-modules were missing, had to be identified and installed to use fhem.

For my second approach I used the provided image from busware.de, which also includes drivers for their COC daughter board. Available for download here [5]. Unfortunately this has a slightly outdated fhem installation, but works for all other parts. Please note that there is no HDMI output enabled during the first boot. Just use ssh pi@fhem or ssh pi@<IP-address> to login and use raspi-config for initial setup of passwords, timezone and disk size. Do not forget to install an ntp-client using apt-get install ntp-client, an editor of your choice (I selected vim apt-get install vim) and edit /etc/ntp.conf to adjust ntpservers and select a country-pool (see [6]).

Upgrade of fhem

Once the initial setup is completed reboot your Raspberry and login into fhem using your web browser at <IP-address>:8083. Enter the upgrade command to upgrade your fhem-installation to the latest revision. Use shutdown restart to start the new code version.

CUL firmware flashing

Login using ssh and become root using su - or sudo -i to flash the empty CUL. This only works as root from the directory /opt/fhem using the command string dfu-programmer atmega32u4 erase && dfu-programmer atmega32u4 flash ./FHEM/CUL_V3.hex && dfu-programmer atmega32u4 start. If the application dfu-programmer is not installed, install using apt-get install dfu-programmer.

Migration Preparation

ADD ME

Documentation

If you have not done it before now it's a good start to document your existing MAX!Cube solution. Room for room write each device, the MAX address, location and intended profile into an Excel file. It could look like

Roomname DeviceName DeviceAddress Location WeekDayProfile WeekendProfile Dependencies

where WeekDayProfile and WeekendProfile only make sense for actors like Heaters within the MAX-solution. Dependencies can indicate Window Contacts to Heater actors or Wall Thermostat to Heater actors. Document as well your current heating profile configuration with MAX!Cube.

Make a backup.

Selecting the right time of the year

ADD ME

What do you want to archive

ADD ME

Migration Execution

ADD ME

MAX!Cube Configuration

ADD ME

fhem Configuration

CUL Setup

First step to setup fhem is to define the protocol and adaptor fhem should use. You need one CUL for each protocol (e.g. FS20, Homematic and MAX) as the CUL can listen to the same frequency, but does not understand multiple protocols. The <fhem.cfg> comes pre-installed with some default configuration. At the end add

#### CUL Definition, MAX!Cube
define CUL0 CUL /dev/ttyACM0@9600 1234
attr CUL0 rfmode MAX
define cm CUL_MAX 123456

and save fhem.cfg. After a reload fhem will start to listen to MAX-commands sent by your still active MAX-Cube.

Find MAX devices

As each MAX device communicates with the MAX!Cube over the time of two-three days, fhem will detect in use MAX-devices like Heaters, Thermostats and WindowsContacts (but not the ECO wall switch) and create alias definitions within the fhem.cfg file. To get all devices including addresses in use let fhem listen for a two-three days while the MAX!Cube is still in use and working.

Identify MAX devices

Login into MAX!Cube using one browser window (or tab) and into fhem using a second browser window (or tab). For each room change the temperature within the MAX!Software to an unsual value (like 27.5), change to the fhem window and identify the change in fhem. This allows you to detect one heater actor by the other.

To identify the Window Contacts just open one window, swap to fhem and see which contact reports an Open status.

Define alias names

Open a third browser window (or tab), login to fhem webpage and select Edit Files, fhem.cfg. You can now add the alias by adding lines like

define MAX_Bathroom_Heating MAX HeatingThermostat 05615b
define MAX_Bathroom_WindowSensor MAX ShutterContact 053767

room by room, one by one. Just identify the fhem-name in the "MAX"-room in fhem and adjust the address (last hex-number in the line).

Understanding the setup

The rooms are still controlled from the MAX!Cube and MAX-software. fhem only listens and has useable names. fhem does not communicate with the devices and it cannot configure devices. However you have useable and human-understandable names instead of hex-codes.

fhem One-Time Device-specific configuration

ADD ME

Testing and Verifying

ADD ME

Add-Ons

ADD ME

Graphs using 99_UtilsMaxScan.pm

There is a Wiki-articel how to use the [7] MAX-Temperature-Scanner with fhem. At the time of writing this article v1.05a has been published.

Few people have published changes to this version within the forum, which enables the use of ECO wall button and multiple WindowShutter contacts.

If you consider to create graphs for your installation your migration (as outlined above) should 'work stable, e.g.

  1. week programs for all rooms are active and working
  2. open windows are detected and the desired temperature is decreased
  3. you do not face any logfile entries like: CUL_MAX_SendQueueHandler: Not enough credit! credit10ms is 101, but we need 110. Waiting 9 seconds.
  4. you do not face any logfile entries like: CUL_MAX_SendQueueHandler: Missing ack from 020341 for 0f010403123456020341000e18003655
  5. you do not plan any changes to week programs any time soon.

Do not even think about starting to graph out heaters and rooms while migration is still in progress.

Do download the Scanner Module you need to register and login into the forum. The Scanner Module is attached to the post linked at [8]. Copy this file to /opt/fhem/FHEM and change ownership to fhem.

(Original Articles: [9] und [10])

ECO-Wallswitch

According to an extensive Google search it is currently not possible to group all Heater actors and send a single command to the group to save communication credits.

A workaround is to define a fhem structure which includes all Heaters, assign it to a new room labelled "House" and add a web control button to fhem:

# Define House to control all Heaters at once
define AllHeaters structure MAX_Child2_Heating MAX_Workingroom_Heating MAX_Child1_Heating MAX_Livingroom_THSensor MAX_Bedroom_Heating MAX_Toilette_Heating MAX_Kitchen_Heating MAX_Bathroom_Heating
attr AllHeaters room House
attr AllHeaters webCmd desiredTemperature

The ECO Wall button has a type PushButton and is easily defined using (you have to update the address of course):

### 9.1 ECO-Wallbutton
define MAX_WallButton MAX PushButton 0521c4

To set all heaters into ECO mode until the AUTO mode is pressed on the button or the AUTO mode is called from the webpage use:

 define MAX_HouseECOHeating notify MAX_WallButton:(onoff).* { if ("%EVTPART1" eq "0") { Log(3,"Setting ECO-Mode") && fhem("set AllHeaters desiredTemperature eco");;} else { Log(3,"Setting AUTO-Mode") && fhem("set AllHeaters desiredTemperature auto");;}} 

(Original discussion: [11])

Planned changes

ADD ME