-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The changes we talked about in issue #23 #24
Open
dersimn
wants to merge
20
commits into
hobbyquaker:master
Choose a base branch
from
dersimn:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
983d357
Bind to all interfaces, send ‘eth0’ IP to CCU
dersimn 26c197d
Disable explicitDouble for XML-RPC
dersimn 00b7932
Conversion is not needed anymore
dersimn b8170d3
Fix hm/paramset/# topics
dersimn 2a1087c
Option to replace colons in topic name
dersimn 0c9bcf2
Unneccessary, CCU already does checking
dersimn 43b3ac0
Replace Dockerfiles
dersimn 448f07f
Add exposed ports
dersimn 8c07bd8
Publish ENUM as string-value, apped option list
dersimn e079774
Update README
dersimn 6c72d35
Merge older commits from dersimn's dev tree into hobbyquaker's master
dersimn cf6a115
Rename option
dersimn e145d3f
Protocol option: Prefer Strings
dersimn cd93621
Protocol option: Disable Value Checking
dersimn 3f5d777
Protocol option: Publish ENUM as String
dersimn 492317e
Protocol option: Publish ENUM list
dersimn 4bd1205
Protocol option: Prefer xmlrpc for rfd
dersimn 7a7fb59
Protocol option: Publish val distinct
dersimn 4efaef6
Merge remote-tracking branch 'hobbyquaker/master' into dev4
dersimn 1b93405
README
dersimn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
FROM node:slim | ||
LABEL maintainer="Holger Imbery <[email protected]>" \ | ||
version="1.1a" \ | ||
description="HM2MQTT (hm2mqtt.js) dockerized version of https://github.com/hobbyquaker/hm2mqtt.js" | ||
|
||
RUN npm config set unsafe-perm true && npm install -g hm2mqtt | ||
COPY . /node | ||
|
||
RUN cd /node && \ | ||
npm install | ||
|
||
EXPOSE 2126 | ||
EXPOSE 2127 | ||
ENTRYPOINT ["hm2mqtt"] | ||
|
||
ENTRYPOINT [ "node", "/node/index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
FROM hypriot/rpi-node:slim | ||
LABEL maintainer="Holger Imbery <[email protected]>" \ | ||
version="1.1a" \ | ||
description="HM2MQTT (hm2mqtt.js) dockerized version of https://github.com/hobbyquaker/hm2mqtt.js" | ||
FROM arm32v7/node:slim | ||
|
||
RUN npm config set unsafe-perm true | ||
RUN npm install -g hm2mqtt | ||
COPY . /node | ||
|
||
RUN cd /node && \ | ||
npm install | ||
|
||
EXPOSE 2126 | ||
EXPOSE 2127 | ||
ENTRYPOINT ["hm2mqtt"] | ||
|
||
ENTRYPOINT [ "node", "/node/index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,132 +1,33 @@ | ||
# hm2mqtt.js | ||
|
||
[![mqtt-smarthome](https://img.shields.io/badge/mqtt-smarthome-blue.svg)](https://github.com/mqtt-smarthome/mqtt-smarthome) | ||
[![NPM version](https://badge.fury.io/js/hm2mqtt.svg)](http://badge.fury.io/js/hm2mqtt) | ||
[![dependencies Status](https://david-dm.org/hobbyquaker/hm2mqtt.js/status.svg)](https://david-dm.org/hobbyquaker/hm2mqtt.js) | ||
[![Build Status](https://travis-ci.org/hobbyquaker/hm2mqtt.js.svg?branch=master)](https://travis-ci.org/hobbyquaker/hm2mqtt.js) | ||
[![Coverage Status](https://coveralls.io/repos/github/hobbyquaker/hm2mqtt.js/badge.svg?branch=master)](https://coveralls.io/github/hobbyquaker/hm2mqtt.js?branch=master) | ||
[![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/sindresorhus/xo) | ||
[![License][mit-badge]][mit-url] | ||
#### History of this project | ||
|
||
> Node.js based Interface between Homematic and MQTT | ||
It started off with owagner's Java-based [hm2mqtt](https://github.com/owagner/hm2mqtt). Hobbyquaker then created [hm2mqtt.js](https://github.com/hobbyquaker/hm2mqtt.js) (JavaScript) providing the same functionality as hm2mqtt. He gave up the development in favor his new projects [node-red-contrib-ccu](https://github.com/hobbyquaker/node-red-contrib-ccu) and [RedMatic](https://github.com/hobbyquaker/RedMatic). | ||
|
||
# UNMAINTAINED - I gave up working on this project in favor of [node-red-contrib-ccu](https://github.com/hobbyquaker/node-red-contrib-ccu) respectively the CCU3/RaspberryMatic Addon [RedMatic](https://github.com/hobbyquaker/RedMatic) that includes node-red-contrib-ccu. The functionality of hm2mqtt.js will be implemented in node-red-contrib-ccu so this can act as a 1:1 drop-in-replacement. | ||
I forked the project some time ago and added a few features to it. This project however got a bit too inflated for my taste, thus I'm also working on a very simple approach, implementing only rfd. No rega, no paramset database, just sending and receiving messages: [simple homematic rfd](https://github.com/dersimn/simplehomematicrfd2mqtt). | ||
|
||
Because [hm2mqtt](https://github.com/owagner/hm2mqtt) isn't developed anymore and I don't really like Java I decided to | ||
re-implement this with Node.js | ||
|
||
It's kind of the same like the original hm2mqtt, but it supports BINRPC and XMLRPC (hm2mqtt only supports BINRPC), so it | ||
can be used with Homematic IP also. Furthermore it supports Rega variables and programs. | ||
## Usage with Docker | ||
|
||
Run | ||
|
||
### Installation | ||
docker run dersimn/hm2mqtt.js --help | ||
|
||
Prerequisites: [Node.js](https://nodejs.org) 6.0 or higher. | ||
for a full list of options. A full command could look like this: | ||
|
||
`npm install -g hm2mqtt` | ||
|
||
I suggest to use [pm2](http://pm2.keymetrics.io/) to manage the hm2mqtt process (start on system boot, manage log files, | ||
...) | ||
|
||
|
||
### Command Line Options | ||
|
||
Use `hm2mqtt --help` to get a list of available options. All options can also be set per environment variable (e.g. | ||
setting `HM2MQTT_VERBOSITY=debug` has the same effect as using `--verbosity debug` as commandline parameter). | ||
|
||
### MQTT URL | ||
|
||
You can add Username/Password for the connection to the MQTT broker to the MQTT URL param like e.g. | ||
`mqtt://user:pass@broker`. For a secure connection via TLS use `mqtts://` as URL scheme. | ||
|
||
|
||
### Topics | ||
|
||
* Events are published on `<name>/status/<channelName>/<datapoint>` (JSON payload, follows | ||
[mqtt-smarthome payload format](https://github.com/mqtt-smarthome/mqtt-smarthome/blob/master/Architecture.md)) | ||
* Values can be set via `<name>/set/<channelAddress_or_channelName>/<datapoint>` (can be plain or JSON payload). Example: | ||
`hmip/set/Light_Garage/STATE`, | ||
* Single values from arbitrary Paramsets can be set via | ||
`<name>/param/<channelAddress_or_channelName>/<paramset>/<datapoint>`. Example topic for setting the Mode of an 1st gen | ||
Thermostat HM-CC-TC: `hm/param/Temperatur Hobbyraum Soll/MASTER/MODE_TEMPERATUR_REGULATOR` | ||
* Multiple values at once in arbitrary Paramsets can be set via ` | ||
``<name>/param/<channelAddress_or_channelName>/<paramset>`. The payload has to be a JSON object like e.g. | ||
`{"MODE_TEMPERATURE_REGULATOR":2,"TEMPERATUR_COMFORT_VALUE":24}`. | ||
* Arbitrary RPC methods can be called via `<name>/rpc/<iface>/<command>/<callId>` and respond to `<name>/response/<callId>` | ||
(JSON encoded Array as payload). The callId can be an arbitrary string, its purpose is just to collate the response | ||
to the command. iface can be one of `hmip`, `rfd` or `hs485d`. | ||
|
||
|
||
### Device and Channel Names | ||
|
||
Device and Channel names are queried from ReGa, this can be disabled by setting the `--disable-rega` option. To trigger | ||
a re-read after changes on the ReGa you can publish a message to `<name>/command/regasync` or just restart hm2mqtt. | ||
As an alternative to using the names from ReGa you can also supply a json file with the `--json-name-table` option | ||
containing address to name mappings, created by e.g. | ||
[homematic-manager](https://github.com/hobbyquaker/homematic-manager). This file should look like: | ||
```javascript | ||
{ | ||
"EEQ1234567": "Device Name", | ||
"EEQ1234567:1": "Channel Name", | ||
... | ||
} | ||
``` | ||
|
||
|
||
### ReGa (Homematic variables and programs) | ||
|
||
To receive changes from ReGa you have to set `--rega-poll-interval` and/or `--rega-poll-trigger`. | ||
`--rega-poll-trigger` can be set to e.g. `BidCoS-RF:50.PRESS_SHORT`, then a polling is done whenever this virtual button | ||
is pressed. This is meant to create a "pseudo push mechanism" where a program on the ccu reacts on variable changes and | ||
presses this virtual button. | ||
|
||
Variables and Programs are published to `<name>/status/<variableOrProgramName>` and can be set by sending a message to | ||
`<name>/rega/<variableOrProgramName>`. Publishing `true` or `false` to a program activates/deactivates the program. To | ||
start a program publish the string `start`. | ||
|
||
|
||
### _NOTWORKING datapoints | ||
|
||
hm2mqtt sends virtual datapoints named `LEVEL_NOTWORKING` respectively `STATE_NOTWORKING` for actuators that have a | ||
`WORKING` and/or `DIRECTION` datapoint. The `*_NOTWORKING` datapoints are only updated when `WORKING` is `false` - this | ||
is useful for e.g. sliders in a UI to prevent jumping sliders when a Blind or Keymatic is moving or a Dimmer is dimming. | ||
|
||
|
||
## docker image for hm2mqtt.js | ||
|
||
#### Usage (architecture: amd64) | ||
- pull the image to your machine, or if you are on a swarm to each node | ||
``` | ||
docker pull mqttsmarthome/hm2mqtt:latest | ||
``` | ||
- start the container with (e.g) | ||
``` | ||
docker run -d -p 2126:2126 -p 2127:2127 --name hm2mqtt -e HM2MQTT_MQTT-URL="mqtt://xxx.xxx.xxx.xxx" -e HM2MQTT_MQTT-USERNAME="mqtt-user-name" -e HM2MQTT_MQTT-PASSWORD="mqtt-user-password" -e HM2MQTT_CCU-ADDRESS="xxx.xxx.xxx.xxx" -e HM2MQTT_INIT-ADDRESS="xxx.xxx.xxx.xxx" -e HM2MQTT_VERBOSITY="debug" mqttsmarthome/hm2mqtt | ||
``` | ||
- or the service in your swarm with (e.g) | ||
``` | ||
docker service create --name hm2mqtt \ | ||
--network ingress \ | ||
--publish 2126:2126 \ | ||
--publish 2127:2127 \ | ||
--env HM2MQTT_MQTT-URL="mqtt://xxx.xxx.xxx.xxx" \ | ||
--env HM2MQTT_CCU-ADDRESS="xxx.xxx.xxx.xxx" \ | ||
--env HM2MQTT_INIT-ADDRESS="xxx.xxx.xxx.xxx" \ | ||
--env HM2MQTT_VERBOSITY="debug" \ | ||
mqttsmarthome/hm2mqtt | ||
``` | ||
|
||
#### Usage (architecture: armhf) | ||
- pull the image to your machine, or if you are on a swarm to each node | ||
``` | ||
docker pull mqttsmarthome/hm2mqtt:armhf | ||
``` | ||
- follow the description above (architecture: amd64), but leave out the pull sequence mentioned there. | ||
docker run -d --restart=always --name=hm \ | ||
-p 2126:2126 -p 2127:2127 \ | ||
dersimn/hm2mqtt.js \ | ||
--mqtt-url mqtt://10.1.1.50 \ | ||
--ccu-address 10.1.1.112 \ | ||
--disable-rega \ | ||
--init-address 10.1.1.50 \ | ||
--protocol-prefer-strings \ | ||
--protocol-disable-value-checking \ | ||
--protocol-publish-enum-as-string \ | ||
--protocol-prefer-xmlrpc-for-rfd | ||
|
||
|
||
## License | ||
|
||
MIT (c) 2017 [Sebastian Raff](https://github.com/hobbyquaker) | ||
|
||
[mit-badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=flat | ||
[mit-url]: LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this? listenAdress is needed if hm2mqtt runs in a vm with nat networking or in a container that exposes the listenPort to the hosts interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's actually the other way around. In a Docker environment you can and will have multiple network interfaces. It's therefore a good idea to bind the socket to
0.0.0.0
a.k.a. "listen on all interfaces". This happens here in your script.The line from this comment creates the url-string that is sent to the CCU. If you don't specify the
--init-address
it will default to the information form yourfirstip.js
script, otherwise (for e.g. NAT-ed Docker) the user has to provide the real external IP and take care of proper port forwarding.You can leave the line in here but combined with the change from line 44, this makes no semantical sense anymore.