Skip to content
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
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

dersimn
Copy link
Contributor

@dersimn dersimn commented Dec 1, 2017

No description provided.

CCU will accept strings containing the ENUM value
Enables compatibility to OpenHAB MQTT binding, there the colon (:) is used as seperator in configuration and can’t be used in topic name: <http://docs.openhab.org/addons/bindings/mqtt1/readme.html#item-configuration-for-inbound-messages>
Before:

    {
      "val": 1,
      "ts": 1513329359300,
      "lc": 1512324435548,
      "hm": {
        "ADDRESS": "LEQ1519968:4",
        "ENUM": "MANU-MODE"
      }
    }

After:

    {
      "val": "MANU-MODE",
      "ts": 1513329359300,
      "lc": 1512324435548,
      "hm": {
        "ADDRESS": "LEQ1519968:4",
        "VALUE_LIST": [
          "AUTO-MODE",
          "MANU-MODE",
          "PARTY-MODE",
          "BOOST-MODE"
        ]
      }
    }
index.js Outdated
*
* homematic-xmlrpc introduced an object like `{explicitDouble: val}`.
*
* The CCU2 seems to accept <string>22</string> messages and does a string to int/float conversion itself - currently in testing.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... I'm asking myself if this works with the binrpc protocol also...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question, because I never checked.
Funny thing is - it does 😄

root@vserver:~# docker logs hm2mqtt
2017-12-21 13:05:05.161 <info>  hm2mqtt 2.3.0 starting
2017-12-21 13:05:05.164 <info>  mqtt trying to connect mqtt://10.1.1.50
2017-12-21 13:05:05.243 <info>  mqtt connected mqtt://10.1.1.50
2017-12-21 13:05:05.244 <info>  mqtt subscribe hm/set/#
2017-12-21 13:05:05.245 <info>  mqtt subscribe hm/paramset/#
2017-12-21 13:05:05.245 <info>  mqtt subscribe hm/rega/#
2017-12-21 13:05:05.245 <info>  mqtt subscribe hm/rpc/#
2017-12-21 13:05:05.245 <info>  mqtt subscribe hm/command/#
2017-12-21 13:05:05.257 <info>  rpc rfd > init [ 'xmlrpc_bin://10.1.1.50:2127', 'hm2mqtt_rfd' ]
2017-12-21 13:05:05.261 <info>  rpc hmip > init [ 'http://10.1.1.50:2126', 'hm2mqtt_hmip' ]
2017-12-21 13:05:05.750 <error> unknown device hm2mqtt_rfd LEQ1519968:0
2017-12-21 13:05:05.750 <error> unknown device hm2mqtt_rfd NEQ0629891:0
2017-12-21 13:05:05.751 <error> unknown device hm2mqtt_rfd NEQ0879789:0
2017-12-21 13:05:05.751 <error> unknown device hm2mqtt_rfd NEQ0880952:0
2017-12-21 13:05:05.751 <error> unknown device hm2mqtt_rfd NEQ0881133:0
2017-12-21 13:05:10.588 <error> createParamsetQueue called for unknown devices hmip
2017-12-21 13:05:10.962 <info>  rfd got 135 devices and channels
2017-12-21 13:05:34.504 <error> unknown paramsetDescription HM-TC-IT-WM-W-EU/22/THERMALCONTROL_TRANSMIT
2017-12-21 13:05:34.505 <error> unknown paramsetDescription HM-TC-IT-WM-W-EU/22/THERMALCONTROL_TRANSMIT
2017-12-21 13:05:34.505 <error> unknown paramsetDescription HM-TC-IT-WM-W-EU/22/THERMALCONTROL_TRANSMIT
2017-12-21 13:05:40.419 <info>  got 22 paramsetDescriptions
2017-12-21 13:15:05.294 <info>  rpc hmip > init [ 'http://10.1.1.50:2126', 'hm2mqtt_hmip' ]
2017-12-21 13:15:10.603 <error> createParamsetQueue called for unknown devices hmip
2017-12-21 13:25:05.320 <info>  rpc hmip > init [ 'http://10.1.1.50:2126', 'hm2mqtt_hmip' ]
2017-12-21 13:25:10.637 <error> createParamsetQueue called for unknown devices hmip
2017-12-21 13:35:05.328 <info>  rpc hmip > init [ 'http://10.1.1.50:2126', 'hm2mqtt_hmip' ]

I started the script a few weeks ago with my most recent branch. It used xmlrpc_bin as protocol and yeah.. works since then. For e.g. hm/set/NEQ0881133_4/SET_TEMPERATURE accepts either 19 and 19.5 doing the string conversion.

index.js Outdated
@@ -842,7 +850,8 @@ const rpcMethods = {
}
}
if (ps.TYPE === 'ENUM') {
payload.hm.ENUM = ps.VALUE_LIST[params[3]];
payload.val = ps.VALUE_LIST[params[3]];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a change that would break a few things in my scripts and in my ui... hmmm... :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought so, how about:

--protocol-option-replace-colons for this
--protocol-option-direct-enums

@@ -635,9 +641,9 @@ process.on('SIGTERM', stop);
function initIface(name, protocol) {
let url;
if (protocol === 'binrpc') {
url = 'xmlrpc_bin://' + (config.initAddress || config.listenAddress) + ':' + config.binrpcListenPort;
Copy link
Owner

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

Copy link
Contributor Author

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 your firstip.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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants