openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.86k stars 3.58k forks source link

[avmfritz] add support for Comet DECT #1687

Closed LukaNoah closed 7 years ago

LukaNoah commented 7 years ago

Can you please add the support for the Comet DECT in the binding?

https://avm.de/fileadmin/user_upload/Global/Service/Schnittstellen/AHA-HTTP-Interface.pdf

LukaNoah commented 7 years ago

`

1 myDECT200 1 manuell 0 0 155920 158158 210 -10 1 myComet 220 -10 44 42 28 42 0 0 0 0 1484341200 28 `
cweitkamp commented 7 years ago

Hey there, I ready to look into this. Problem is, I have no Comet Dect device for testing. Maybe I can build a virtual AHA HTTP interface which will deliver exactly your devicelist-xml. But be patient. I think I need two weeks or more.

LukaNoah commented 7 years ago

Thank you very much. Great to hear this. I would help, so I can ;) Please don't forget the set command.

cweitkamp commented 7 years ago

Oh, no. I don't forget that command. That is the interesting part and follows in step 2. At the moment I'm planning to implement four read-only channels for "tist", "komfort", "absenk" and "battery_low" and one r/w channel for "tsoll".

If you like you are welcome to checkout my branch, build it and exchange the .jar file of the binding in your environment to test the current work.

LukaNoah commented 7 years ago

Thank you very much. Where can I find a howto, to make this? Where can I find the jar-file in my openhab-installation?

cweitkamp commented 7 years ago

You can find a tutorial here.

For the second question I need to know which setup you are using. Linux? Raspberry Pi? Windows? In general you can place your own addon files in the /usr/share/openhab2/addon/ folder (on linux based setups). I suggest to uninstall the old avmfritz binding first.

I attached a build of my current branch (.jar file). It only supports automatically discovering your Comet DECT device and read the "temperature" channel.

demo.items

Number COMETDECTTemperature "Actual measured temperature [%.1f °C]" { channel="avmfritz:Comet_DECT:1:aaaaaabbbbbb:temperature" }

demo.sitemap:

sitemap demo label="Main Menu"
{
    Frame "Comet DECT heating thermostat" {
        Text item=COMETDECTTemperature icon="temperature"
    }
}

I am eager to hear feedback.

LukaNoah commented 7 years ago

I'm using openHAB2 on a raspberry. Installed with apt-get and configured with paper-ui.

It works :D image

LukaNoah commented 7 years ago

I hade eclipse ;( Can you please post your actual builds ?

cweitkamp commented 7 years ago

My github fork Link is up-to-date. Feel free to clone or download it.

cweitkamp commented 7 years ago

@LukaNoah any results with your testings?

If not, I like to provide you my newest build (.jar file). This version supports reading temperature, reading battery level and setting temperature. Would you like to test it?

demo.items:

Number COMETDECTActualTemp "Actual measured temperature [%.1f °C]" { channel="avmfritz:Comet_DECT:1:aaaaaabbbbbb:actual_temp" }
Number COMETDECTSetTemp "Thermostat temperature setpoint [%.1f °C]" { channel="avmfritz:Comet_DECT:1:aaaaaabbbbbb:set_temp" }
Switch COMETDECTBattery "Battery low" { channel="avmfritz:Comet_DECT:1:aaaaaabbbbbb:battery_low" }

demo.sitemap:

sitemap demo label="Main Menu"
{
    Frame "Comet DECT heating thermostat" {
        Text item=COMETDECTActualTemp icon="temperature"
        Setpoint item=COMETDECTSetTemp minValue=8.0 maxValue=28.0 step=0.5 icon="temperature"
        Switch item=COMETDECTBattery icon="battery"
    }
}

I am eager to hear feedback.

LukaNoah commented 7 years ago

It work's, partially. In paperUI the new values are not present. I maked a avm.items-file with these two values and added these to my sitemap. The setpoint-value are changing the value in the fb. Changes in the fb does'nt change the oh2 values.

/Edit value range should be 7.5 to 28.5 °C. By 7.5 send "OFF" as 253. by 28.5 send "ON" as 254. So can I implement a boost and a "Frostschutz"

cweitkamp commented 7 years ago

Thanks for testing.

Some questions: Did you remove your Comet DECT thing in Paper UI and add it again after replacing the binding? If not, give it a try. If that doesn't help and the channels are not visible in Paper UI then remove all Comet DECT things and items in Paper UI and your .things and .items files, restart openhab2.service and try it again.

Do you know how the fb is reacting, after sending an "ON" or "OFF" over the interface? Does ist set the mentioned temperatures (7.5 for OFF, 28.5 for ON)? Currently I suggest not to expand the range of allowed temperatures from 7.5 to 28.5 because in the documentation of the interface the range is given from 8.0 to 28.0. I suggest to implement sending an ON or OFF to the set_temp channel. This will send either 253 or 254 to the fb. What do you mean?

I think I found the problem why the values are not present and will not update after change. I work out a solution for that.

LukaNoah commented 7 years ago

I has removed all. And add again. Nothing. On / Off where ok.

cweitkamp commented 7 years ago

New build (.jar file/untested). Should fix the "not present value" bug.

Could you try to implement an additional Switch item for "avmfritz:Comet_DECT:1:aaaaaabbbbbb:set_temp" channel to send ON/OFF commands?

Restart openhab2.service after replacing the binding like suggested.

LukaNoah commented 7 years ago

I Do, but I'm not @home. Friday I Can Do this, sorry ;)

cweitkamp commented 7 years ago

New build (.jar file).

LukaNoah commented 7 years ago

Hi, with the latest jar:

Do you plan also to "manipulate" the eco and comfort-temperatures?

great job ;) thank you very much image

cweitkamp commented 7 years ago

Hi, you're welcome. Sounds good so far.

Currently I'm working on the last problem and do some refactoring of the code. Maybe I upload an new version later this evening.

The eco and comfort temperatures are defined as readonly values in the AHA interface. So the only option I can offer is to create readonly channels for them in the avmfritz binding.

LukaNoah commented 7 years ago

Hi, then only readonly for oh2. I would see the actual setpoints for the 2 modes to set the mode in oh2. thx

cweitkamp commented 7 years ago

Hi, check this out (.jar file).

Problem solved: changing the values in fb should change them in oh2, too. Added channels "eco_temp" and "comfort_temp".

LukaNoah commented 7 years ago

on first start with new binding I got this

2017-01-30 21:52:17.862 [ERROR] [.binding.avmfritz.handler.BoxHandler] - java.lang.NullPointerException at org.openhab.binding.avmfritz.handler.BoxHandler.updateThingFromDevice(BoxHandler.java:189)[10:org.openhab.binding.avmfritz:2.0.0.201701302032] at org.openhab.binding.avmfritz.handler.BoxHandler.addDeviceList(BoxHandler.java:132)[10:org.openhab.binding.avmfritz:2.0.0.201701302032] at org.openhab.binding.avmfritz.internal.hardware.callbacks.FritzAhaUpdateXmlCallback.execute(FritzAhaUpdateXmlCallback.java:70)[10:org.openhab.binding.avmfritz:2.0.0.201701302032] at org.openhab.binding.avmfritz.internal.hardware.FritzahaContentExchange.onComplete(FritzahaContentExchange.java:71)[10:org.openhab.binding.avmfritz:2.0.0.201701302032] at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:453)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.HttpReceiver.responseSuccess(HttpReceiver.java:400)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.messageComplete(HttpReceiverOverHTTP.java:266)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.http.HttpParser.parseContent(HttpParser.java:1487)[73:org.eclipse.jetty.http:9.2.19.v20160908] at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1245)[73:org.eclipse.jetty.http:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.parse(HttpReceiverOverHTTP.java:156)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:117)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:69)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:89)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:123)[71:org.eclipse.jetty.client:9.2.19.v20160908] at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)[74:org.eclipse.jetty.io:9.2.19.v20160908] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)[85:org.eclipse.jetty.util:9.2.19.v20160908] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)[85:org.eclipse.jetty.util:9.2.19.v20160908] at java.lang.Thread.run(Thread.java:745)[:1.8.0_121] After remove thing and add new, the message where gone.

Changes in fb ui of setpoint where transmitt to oh2 hurra Change the setpoint in fb to off -> oh2 receive 126.5°C Change the setpoint in fb to on -> oh2 reveive 127 °C

great job, thanks a lot :D

image

cweitkamp commented 7 years ago

You got that NPE because your existing thing didn't have the new "eco_temp" channel. After replacing the thing everything works fine. I think it will not happen again in the future.

Which temperature values do you expect for the "set_temp" channel after sending an "ON" or "OFF" over the interface (8.0 for OFF, 28.0 for ON)? That will be easy.

The screenshot shows two channels for the Actual Temperature which are connected to different parameters of the interface. Let's have a look at your xml-response in the second post. There is one tag for the Comet DECT device. This tag is connected to the first channel "temperature" (similar to the Fritz!DECT 200 device). The other tag within the tag is connected to the second channel "actual_temp" (only provided by heating thermostats). I assume that both channels show the same value, but they are handled different in the binding.

LukaNoah commented 7 years ago

Thanks for the explanations. 8 and 28 are in the range of the control. I think 5 and 30 would be better because they are not in the normal range. If I change with the buttons the setpoint of 30 down, then comes as the first 28 and that would be correct. With 5 the same.

this rule works perfectly ;)

`rule SetPoint_Changed

when Item AVMThermostat_SetTemp changed then if (AVMThermostat_SetTemp.state==AVMThermostat_EcoTemperature.state) { AVMThermostat_Modus.postUpdate(40) logInfo("AVMT","SetPoint change; Eco") } if (AVMThermostat_SetTemp.state==AVMThermostat_ComfortTemperature.state) { AVMThermostat_Modus.postUpdate(60) logInfo("AVMT","SetPoint change; Comfort") } if (AVMThermostat_SetTemp.state==126.5) { AVMThermostat_Modus.postUpdate(0) AVMThermostat_SetTemp.postUpdate(5) logInfo("AVMT","SetPoint change; OFF") } if (AVMThermostat_SetTemp.state==127) { AVMThermostat_Modus.postUpdate(100) AVMThermostat_SetTemp.postUpdate(30) logInfo("AVMT","SetPoint change; ON") } end`

cweitkamp commented 7 years ago

Last build before creating pull request (.jar file).

Temperature of "set_temp" channel will be set to (6.0 for OFF, 30.0 for ON) after sending an "ON" or "OFF" over the fb interface.

Thanks for testing. Great job, too.

LukaNoah commented 7 years ago

can you please add this 2 readonly values endperiod and tchange?

LukaNoah commented 7 years ago

I have tested the new jar.

Set Setpoint at fb to "an" - oh receive "ON", setpoint in oh2 goes to 127. The same by "aus", setpoint goes to 126.5.

/Edit crazy... fb setpoint "off" oh2 get a setpoint 127, a short time later 30, each refresh the same...

fb setpoint "on" oh2 get a setpoint 126.5, a short time later 6, each refresh the same...

any idea?

2017-02-01 19:54:38.722 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 127 2017-02-01 19:54:38.735 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 30 2017-02-01 19:54:38.839 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 30 2017-02-01 19:55:07.652 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 127 2017-02-01 19:55:07.660 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 30 2017-02-01 19:55:07.696 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; ON, received 30 2017-02-01 19:55:33.576 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; OFF, received 126.5 2017-02-01 19:55:33.662 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; OFF, received 6 2017-02-01 19:55:48.437 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; OFF, received 126.5 2017-02-01 19:55:48.450 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; OFF, received 6 2017-02-01 19:55:48.477 [INFO ] [.eclipse.smarthome.model.script.AVMT] - SetPoint change; OFF, received 6

cweitkamp commented 7 years ago

Hi,

can you please explain which purpose the two new values "endperiod" and "tchange" fulfill? I don't find anything in the documentation of AVM. I need those information for understanding and of course for the binding documentation. Should "endperiod" represent a DateTime type and "tchange" a Number type? Both readonly?

I cannot explain the observed behavior. Maybe it is the behavior of the fb itself. But what I can tell you is that - stupid as I am - I implemented the ON/OFF specification mentioned in my last post for the actual_temp channel NOT like described for the set_temp channel. Now I switched it and it should handle the values correct (.jar file).

LukaNoah commented 7 years ago

Thanks ;) endperiod will be the next switch from eco to comfort, or comfort to eco. It will be DateTime. tchange will be the next setpoint, which where to set at endperiod. endperiod = end of the actual heating-cycle (eco or comfort) tchange = next setpoint, after the actual heating-cycle

The new jar I try tomorrow.

LukaNoah commented 7 years ago

with the new jar it works perfect :top:

In the above xml are 3 other parameters hidden:

Do you see a chance to implement this too?

cweitkamp commented 7 years ago

Nice to hear.

I think it is no problem to implement one channel for every information provided by the AHA interface. The Fritz!DECT 200 and 210 devices both provide more parameters, too (e.g. mode lock, devicelock). I think about implementing them in the near future. I am also interested in implementing the group features of the fb for this binding.

Maybe we should move our conversation and testing to the community forum. This feature (issue) is probaly ready to deploy. What do you think?

LukaNoah commented 7 years ago

Yes , it is. Let's do it. Thx :) Should I close?

cweitkamp commented 7 years ago

Why not.

LukaNoah commented 7 years ago

Ok, closed