Skip to content
zivillianPublic

About

No description or website provided.

Topics

Resources

Stars

112 stars

Watchers

12 watching

Forks

Latest commit

 

History

266 Commits

Folders and files

Repository files navigation

ism7mqtt

Get all statistics and values from your Wolf ISM7 and send them to an mqtt server without using the smartset cloud or scraping the smartset UI. It connects directly to your ism7.

How?

Create a parameter.json file which is needed for ism7mqtt by running the ism7config tool on any machine which can connect to your ism7. This only needs to be done once (or after you changed your your Wolf setup):

ism7config -i <ism7 ip/host> -p <ism7 password>

Run ism7mqtt on any machine which can connect to your ism7 and an mqtt server.

ism7mqtt -m <mqttserver> -i <ism7 ip/host> -p <ism7 password>

Do not forget to put the generated parameter.json next to ism7mqtt or specify the path with -t .../parameter.json.

Docker

If you want to run this via docker, use:

docker run -d --restart=unless-stopped -v ./parameter.json:/app/parameter.json -e ISM7_MQTTHOST=<mqttserver> -e ISM7_IP=<ism7 ip/host> -e ISM7_PASSWORD=<ism7 password> zivillian/ism7mqtt:latest

Configuration options

Every option can be set as a CLI flag (when running the binary/dotnet run directly) or as an environment variable (typically used with Docker). If both are set, the CLI flag wins.

Connection (required)

Flag Env var Description
-m, --mqttServer=<host> ISM7_MQTTHOST MQTT broker host
-i, --ipAddress=<host> ISM7_IP ISM7 hostname or IP
-p, --password=<pwd> ISM7_PASSWORD ISM7 password

MQTT

Flag Env var Default Description
--mqttuser=<user> ISM7_MQTTUSERNAME – MQTT username
--mqttpass=<pwd> ISM7_MQTTPASSWORD – MQTT password
--mqttport=<port> ISM7_MQTTPORT 1883 MQTT broker port
--mqttqos=<0-2> ISM7_MQTTQOS 0 MQTT QoS level
-s, --separate ISM7_SEPARATE false One topic per value instead of one JSON payload per device (also disables the JSON payload)
--retain ISM7_RETAIN false Set the MQTT retain flag

Behavior

Flag Env var Default Description
--interval=<seconds> ISM7_INTERVAL 60 Push interval for polled values
-l, --lang=<code> ISM7_LANGUAGE DEU Language for HA localization (DEU,CHN,GRC,EST,HRV,LVA,LTU,ROU,ITA,ESP,FRA,POL,CZE,SVK,RUS,DNK,HUN,GBR,TUR,NLD,BUL,POR)
-d, --debug ISM7_DEBUG false Dump raw protocol XML (includes your password)
--hass-id=<prefix> ISM7_HOMEASSISTANT_ID – Enable Home Assistant discovery; implies --separate and --retain
--mqtt-health-file=<path> ISM7_MQTT_HEALTH_FILE – (Docker image: /tmp/ism7mqtt-mqtt.alive) File that is updated every 30 seconds while the connection to the MQTT broker is up — see below

Files & templates

Flag Env var Default Description
-t, --parameter=<path> (none — Docker: mount to /app/parameter.json) parameter.json Path to the generated parameter.json
--startup-timeout=<seconds> ISM7_STARTUP_TIMEOUT 90 Per-request startup timeout — see below
--ism7-reconnect-timeout=<seconds> ISM7_RECONNECT_TIMEOUT 300 How long to keep reconnecting to the ism7 before exiting with an error; 0 = exit on the first error — see below
--serialize-push-subscribes ISM7_SERIALIZE_PUSH_SUBSCRIBES false Send push subscribes one at a time during startup — see below
--parameter-xml-override=<path> ISM7_PARAMETER_XML_OVERRIDE – Replace the built-in parameter template — see Advanced below

ISM7_STARTUP_TIMEOUT (in seconds, defaults to 90, also available as --startup-timeout) only applies to the initial startup phase, where ism7mqtt requests all configured values from the ism7 one pull request at a time. It is not a timeout for the whole startup phase - it resets for every single pull request. If the ism7 does not answer one particular request within this time, ism7mqtt assumes the connection is stuck, logs the problem and reconnects until the reconnect timeout is reached (see below). The same timeout applies to establishing the connection (TCP connect and TLS handshake). Increase this value if your setup regularly needs more time to answer a single request; decrease it if you want ism7mqtt to fail faster on a stuck connection.

ISM7_RECONNECT_TIMEOUT (in seconds, defaults to 300, also available as --ism7-reconnect-timeout) controls what happens when the connection to the ism7 is lost (e.g. a nightly router reconnect or a reset of the ism7) or cannot be established. ism7mqtt then reconnects on its own, while the connection to the MQTT broker stays up. It waits 10 seconds before the first reconnect attempt and doubles the delay after every failed attempt, but never waits longer than 60 seconds, so an ism7 that was powered off and on again is picked up quickly. Every wait is logged together with the reason, e.g. ism7 connection failed: ... - reconnecting in 20 seconds (attempt 2, giving up after 300 seconds without a connection). If the connection cannot be re-established within ISM7_RECONNECT_TIMEOUT seconds, ism7mqtt logs the last error and exits with an error, just like it does without a reconnect, so a restart policy (Docker, systemd, the Home Assistant app) or your monitoring still sees a real connection problem. A connection that is lost again shortly after it was established does not extend this time. Only a connection that stayed up for 5 minutes after finishing startup counts as recovered: the next loss then starts a new reconnect period with a 10 seconds delay. The timeout is checked between two attempts, so an attempt that is already running (see ISM7_STARTUP_TIMEOUT) is not interrupted.

Set ISM7_RECONNECT_TIMEOUT to 0 to turn the reconnecting off: ism7mqtt then exits on the first connection error, exactly as it did before this option existed.

A rejected login (invalidCredentials, e.g. a wrong password, or error) is never retried, regardless of this option, because the ism7 might lock you out after repeated failed logins. ism7mqtt exits with an error and logs invalid login state '...'. The login states busy and pending (the ism7 still holds the previous session) are transient: they are retried like a connection error, within the reconnect timeout (with 0 they end the process, as before).

The bundle and sequence ids sent to the ism7 start again at 1 for every connection, like after a restart of ism7mqtt, so they do not grow when the connection is re-established again and again.

MQTT write commands received while the ism7 is not connected or the login has not completed yet are dropped (and logged). ism7mqtt also exits with an error on problems it cannot recover from, e.g. if the MQTT broker is not reachable at startup.

ISM7_SERIALIZE_PUSH_SUBSCRIBES (defaults to false, also available as --serialize-push-subscribes) changes how ism7mqtt subscribes to push updates at the end of startup. By default all push subscribes are sent right after each other. Some devices on firmware 5.20 stop responding to anything (including keep-alives) shortly after startup when this happens, eventually resetting the connection. If you see this symptom, enable this option to make ism7mqtt send push subscribes one at a time, waiting for each response before sending the next, the same way pull requests are already handled.

ISM7_MQTT_HEALTH_FILE (also available as --mqtt-health-file) names a file that ism7mqtt updates every 30 seconds while the connection to the MQTT broker is up. It only reflects the MQTT side, not the connection to the ISM7. The Docker image sets it to /tmp/ism7mqtt-mqtt.alive and ships a HEALTHCHECK that reports the container as unhealthy when the file is older than two minutes. Set the variable to an empty value to turn the feature off; the check then always passes. Plain Docker does not restart unhealthy containers on its own; use your orchestrator or a tool like autoheal if you want that. If the broker goes away, ism7mqtt keeps trying to reconnect every 5 seconds and renews its subscriptions (and the Home Assistant discovery info) after every reconnect.

Advanced: overriding the built-in parameter.xml

ism7mqtt ships with a built-in parameter.xml describing every known Wolf parameter (name, min/max, selectable values, ...). If your installation exposes values that are missing from it (e.g. an incomplete KeyValueList for a select parameter), you can point ism7mqtt at your own local copy instead, via --parameter-xml-override <path> or ISM7_PARAMETER_XML_OVERRIDE. This is opt-in only - if unset, behaviour is unchanged and the built-in file is used as before.

Warning

This replaces the entire built-in template, it does not merge with it. Start from a copy of the current parameter.xml in this repo, edit only what you need, and keep it in sync when this file changes in later releases - there is no drift detection.

For Docker, mount your edited file additionally to the existing parameter.json mount and point the new environment variable at it:

docker run -d --restart=unless-stopped \
  -v ./parameter.json:/app/parameter.json \
  -v ./parameter.xml:/app/parameter.xml \
  -e ISM7_MQTTHOST=<mqttserver> -e ISM7_IP=<ism7 ip/host> -e ISM7_PASSWORD=<ism7 password> \
  -e ISM7_PARAMETER_XML_OVERRIDE=/app/parameter.xml \
  zivillian/ism7mqtt:latest

HomeAssistant

There is a HomeAssistant integration available at b3nn0/hassio-addon-ism7mqtt.

Firmware < 200

The old firmware (Software < 200) uses a different port (9091). ism7config tries to automatically detect and save the port in the parameter.json.

Cons

The ism7 accepts only a single connection, so you cannot use the Smartset application or mobile app while ism7mqtt is running.

Configuration

The parameter.json contains all devices and the corresponding properties for the installation extracted from your setup. You can remove any property which is not needed.

MQTT

ism7mqtt initially fetches all properties declared in parameter.json and afterwards subscribes to changes with an intervall of 60 seconds. Whenever new values are received from ism7 a json update with all those properties is published to mqtt. Please be aware that an update contains only the changed properties - so only the initial message may contain all properties.

You can also enable separate topics (--separate), which will report each value in its own nested topic and disable the JSON payload.

Each device on the bus (and present in the parameter.json) is reported via its own topic. The format is

Wolf/<ism7 ip address>/<device type>_<device bus address>

For each property of type ListParameter (basically all comboboxes) nested values are reported - the original numerical value (value) and the german text representation (text).

Duplicate properties are reported as a sub property or topic with their numerical identifier (property id) to make them unique.

Writing MQTT

Sending MQTT messages in order to set values involves using a general structure to publish messages.

Note

Please be aware that not all properties are writable. The ism7mqtt software attempts to validate whether a property can be set, but this may not always be accurate.

Use this topic to send JSON data:

Wolf/<ism7 ip address>/<device type>_<device bus address>/set

Use this topic to send single values:

Wolf/<ism7 ip address>/<device type>_<device bus address>/set/<property name>/...

Example

Goal: Switching heating mode on or off.

Observing the MQTT output published via topic Wolf/192.168.1.27/MK_BM-2_0x85 reveals the following structure:

{
    "Programmwahl": {
        "360051": {
            "value": 0,
            "text": "Standby"
        },
        "360058": 0
    }
}

You can now pick either property value or text to set a new heating mode. To do so you publish the following JSON payload to topic Wolf/192.168.1.27/MK_BM-2_0x85/set

{
    "Programmwahl": {
        "360051": {
            "value": 0
        }
    }
}

or

{
    "Programmwahl": {
        "360051": {
            "text": "Standby"
        }
    }
}

If done correctly ism7mqtt should greet you with the following messages (-d debug enables additional xml output):

received mqtt with topic 'Wolf/192.168.1.27/MK_BM-2_0x85/set' '{"Programmwahl":{"360051":{"text":"Auto"}}}'
> <?xml version="1.0" encoding="utf-16"?><tbreq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" bn="11" gw="1" ae="true" ty="write"><iwr se="" ba="0x85" in="10100" dl="0x01" dh="0x00" /></tbreq>
< ?<?xml version="1.0" encoding="utf-8"?><tbres bn="11" gw="" st="OK" ts="2024-04-19T22:09:22" emsg=""><iac se="0" ba="0x85" in="10100" dl="0x1" dh="0x0" st="OK"/></tbres>
publishing mqtt with topic 'Wolf/192.168.1.27/MK_BM-2_0x85' '{"Programmwahl":{"360051":{"value":1,"text":"Auto"},"360058":1}}'

Publishing Single Values

For single value updates instead of JSON, publish directly to the corresponding MQTT topic.

Append each part of a nested JSON property to the topic path:

Wolf/<ism7 ip address>/<device type>_<device bus address>/set/<property name>/...

Example topics to update single properties:

Wolf/<ism7 ip address>/WWSystem_BM-2_0x35/set/Programmwahl/35012/value
Wolf/<ism7 ip address>/WWSystem_BM-2_0x35/set/Programmwahl/35012/text

Bugs / Missing Features

If something is not working in your setup, you can get more output by using the debug switch -d. This will dump the communication with the ism7 (including your password). Please include a redacted version of this dump when opening an issue and also attach your parameter.json.

Protocol

See PROTOCOL.md

About

No description or website provided.

Topics

Resources

Stars

112 stars

Watchers

12 watching

Forks

Releases

Sponsor this project

Used by

Contributors

Languages