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

HomematicControlModeToHomekitHeathingCoolingState not working #34

Closed
peterbaumert opened this issue Jan 28, 2018 · 16 comments
Closed

HomematicControlModeToHomekitHeathingCoolingState not working #34

peterbaumert opened this issue Jan 28, 2018 · 16 comments

Comments

@peterbaumert
Copy link

peterbaumert commented Jan 28, 2018

Added my Thermostats choose the conversion function but it always shows as off as the mode. The text is saying "heating to *" properly.

capture

If my settings are wrong I am sorry and would appreciate a hint how they are supposed to be :D

@jensweigele
Copy link
Owner

I know that there are some issues with the HeatingCooling state.
Could you please check which value your "Control_Mode" state can have?
The Conversion currently does the following: (Homematic -> Homekit)
0 -> AUTO
1 -> HEAT
2 -> HEAT
3 -> HEAT
else -> OFF

@peterbaumert
Copy link
Author

OK that explains it. Because even if its off control mode is still 1 :( maybe its possible to also include the set temperature? Because if its set to 4,5 that means its „OFF“

@jensweigele
Copy link
Owner

Are you able to sketch out some kind of "specification"? I'm currently busy but if you give me some kind of mapping/process to map the values, I could maybe implement it

@Bono1969
Copy link

Hi Jens,
i also have troubles with the conversion mapping.
On a Comet DECT Thermostat the mapping is:
0 -> Auto
1 -> OFF
2 -> ON

@schnub69
Copy link

OK that explains it. Because even if its off control mode is still 1 :( maybe its possible to also include the set temperature? Because if its set to 4,5 that means its „OFF“

Same here,

image

Mode OFF in Homekit sets to 0 = Auto Mode <-- this means not off --> off is manu mode below 4.5 °C
Mode Heating in Homekit sets to 1 = Manu Mode
Mode Cooling in Homekit sets to 0 = Auto Mode
Mode Automatic in Homekit sets to 0 = Auto Mode

any way to implement this?

@ghost
Copy link

ghost commented Dec 30, 2018

Got the same struggle like @Bono1969

Hi Jens,
i also have troubles with the conversion mapping.
On a Comet DECT Thermostat the mapping is:
0 -> Auto
1 -> OFF
2 -> ON

Is there an easy way for different mapping?

@jensweigele
Copy link
Owner

With the current master you can try it with a custom conversion function (script).

@ghost
Copy link

ghost commented Dec 31, 2018

With the current master you can try it with a custom conversion function (script).

Ok, I got the workaround with two additional states (https://forum.iobroker.net/viewtopic.php?f=20&t=8187#p200509).
My Code is a little different and for DECT of course.

homekit yahka additional states

homekit yahka to dect

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="on" id="ZE/S-9iNmQ6,jH5ldNTC" x="38" y="13">
    <field name="OID">fritzdect.0.Comet_117950531104.YAHKA-Input_to_DECT</field>
    <field name="CONDITION">ne</field>
    <field name="ACK_CONDITION"></field>
    <statement name="STATEMENT">
      <block type="controls_if" id="EFr6iA.DGMa*EGgjd,An">
        <mutation elseif="3"></mutation>
        <value name="IF0">
          <block type="logic_compare" id="w_co?|lraw]UCJn|c(,s">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="qc]sa(qT+d*B;8|o%7;j">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="H3QEAK?eXD}}Vt=mN:L]">
                <field name="NUM">0</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO0">
          <block type="comment" id="1Ai1ke9)t`HU4[a-`q7x">
            <field name="COMMENT">AUS</field>
            <next>
              <block type="control" id="ONFjA/EgzBX2hJLrfVY6">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.mode</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="k!?lgrfj15y*}eBxIq`(">
                    <field name="NUM">1</field>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
        <value name="IF1">
          <block type="logic_compare" id="9?vVqj.gndg?tmp[+@GW">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="DPt9V8w`|Ku[#E;7@*2F">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="*AB2t:ZX?dOLUsl`D7#8">
                <field name="NUM">1</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO1">
          <block type="comment" id="fF,qImRNe*C`J@g9Lmy`">
            <field name="COMMENT">HEAT</field>
            <next>
              <block type="control" id="oeb}GlJFm~Wq^K99:tRA">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.mode</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="Tfj[)qH![}b#0;UiWB~/">
                    <field name="NUM">0</field>
                  </block>
                </value>
                <next>
                  <block type="control" id=")(gG=@A/8VS*?*?5=zR6">
                    <mutation delay_input="false"></mutation>
                    <field name="OID">fritzdect.0.Comet_117950531104.targettemp</field>
                    <field name="WITH_DELAY">FALSE</field>
                    <value name="VALUE">
                      <block type="math_number" id="H4W%sB]TxNE40v=MWd%0">
                        <field name="NUM">24</field>
                      </block>
                    </value>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
        <value name="IF2">
          <block type="logic_compare" id="?C[vDW6u9;KV9wY~:BQ7">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="R-6%mZLxF4n+K[-Vmtf7">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="6QOcWV[F2wnNisb|i%Pu">
                <field name="NUM">2</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO2">
          <block type="comment" id="0)=Pc/AGjFbPST/0QL)Q">
            <field name="COMMENT">COOL</field>
            <next>
              <block type="control" id="P*q`C8.DpILun8CAS^;K">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.mode</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="dUjxVc-|}~Ez?W9S@W%@">
                    <field name="NUM">0</field>
                  </block>
                </value>
                <next>
                  <block type="control" id="(bV=6{F`V6_w,.#Fr4bp">
                    <mutation delay_input="false"></mutation>
                    <field name="OID">fritzdect.0.Comet_117950531104.targettemp</field>
                    <field name="WITH_DELAY">FALSE</field>
                    <value name="VALUE">
                      <block type="math_number" id="bTIciEb1bD99iE-T*Riv">
                        <field name="NUM">16</field>
                      </block>
                    </value>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </statement>
        <value name="IF3">
          <block type="logic_compare" id="+D(@!~?N0tDsn,RPEsSd">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="oF;h~;;..1Op6;AJ)3f6">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="*I,rWi-3N/JFH%R#[RHa">
                <field name="NUM">3</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO3">
          <block type="comment" id="}MT*/6:P.EuqTFKV4i[U">
            <field name="COMMENT">AUTO</field>
            <next>
              <block type="control" id="c6/,KcWQB(J;=A3Sl5h@">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.mode</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="l(BY_)k/d%QdF!f7T])P">
                    <field name="NUM">0</field>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
      </block>
    </statement>
  </block>
</xml>

homekit yahka from dect

<xml xmlns="http://www.w3.org/1999/xhtml">
  <block type="on" id="#ZW+c(RR#6LH%l}=oAKX" x="38" y="-62">
    <field name="OID">fritzdect.0.Comet_117950531104.mode</field>
    <field name="CONDITION">ne</field>
    <field name="ACK_CONDITION"></field>
    <statement name="STATEMENT">
      <block type="controls_if" id="mCHw%0*:TErPb{BLVZ6U">
        <mutation elseif="2"></mutation>
        <value name="IF0">
          <block type="logic_compare" id="BDOnoU:4iXPR(a`aKT*0">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="PNd5SxR.%q?#DndPHHCJ">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="k5y)lT~6um,,f~Z@o9Vk">
                <field name="NUM">0</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO0">
          <block type="comment" id="j,P@rIUy9i9RBc]E=;li">
            <field name="COMMENT">AUTO</field>
            <next>
              <block type="control" id="Z0x3w]x36`@3y?D{s|:F">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.YAHKA-Mode_Output_from_DECT</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="Md]zCs_Y0A]EYwM_cPhx">
                    <field name="NUM">0</field>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
        <value name="IF1">
          <block type="logic_compare" id="#{C}x3Xqevn:Y5|n;QH%">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="5AP)5@MCE)P#WIrSNiI#">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="?EI;Wl#l;wOz[j|NturJ">
                <field name="NUM">1</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO1">
          <block type="comment" id="tR5XrK;4-freLw]kA3%,">
            <field name="COMMENT">COOL</field>
            <next>
              <block type="control" id=":Yc!_PE@MYSPXP_0L,.}">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.YAHKA-Mode_Output_from_DECT</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="~uR]cpikkzw}QR-j3VHi">
                    <field name="NUM">2</field>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
        <value name="IF2">
          <block type="logic_compare" id="c-!rI7|frDnO7)%ADS/y">
            <field name="OP">EQ</field>
            <value name="A">
              <block type="variables_get" id="-1ZXMOol47?|H@m*7kaF">
                <field name="VAR">value</field>
              </block>
            </value>
            <value name="B">
              <block type="math_number" id="lGJ|9*?!_%gQKwvDYkYc">
                <field name="NUM">2</field>
              </block>
            </value>
          </block>
        </value>
        <statement name="DO2">
          <block type="comment" id="MXl1nN[F6zknL2kbTV36">
            <field name="COMMENT">HEAT</field>
            <next>
              <block type="control" id="oR|%;~5IS#Ka4!q+?{dY">
                <mutation delay_input="false"></mutation>
                <field name="OID">fritzdect.0.Comet_117950531104.YAHKA-Mode_Output_from_DECT</field>
                <field name="WITH_DELAY">FALSE</field>
                <value name="VALUE">
                  <block type="math_number" id="g8Jf;`i#@ln:+7I}d616">
                    <field name="NUM">1</field>
                  </block>
                </value>
              </block>
            </next>
          </block>
        </statement>
      </block>
    </statement>
  </block>
</xml>

@jensweigele
Copy link
Owner

@oklimberg
Copy link

oklimberg commented Apr 26, 2020

With the current master you can try it with a custom conversion function (script).

I know this is an old issue, but how can I read another value (current temperature) inside the custom conversion function?

And if I want to turn the thermostat off, I need to set 2 Values. Is this possible as well with the custom conversion function?

@kevinlieser
Copy link

@oklimberg Did you find a solution using other values inside the JS function?

@oklimberg
Copy link

I think it is not really supported from what I found, but could be achievable.
All methods for reading and setting values work asynchronously using callbacks, whereas the conversion function has to return the converted value 'directly'.
I did not dig deep enough into the code to figure out if there is some elegant way to wait for the async methods to return before doing the conversion, like with future objects in Java.

You could use busy waiting with a while loop inside the conversion function using a boolean variable which will be set inside the async callback of the getter/setter but this is really ugly.

@kevinlieser
Copy link

Did you know the getter Fucntions? Did read something about getState() and setState() but this results in javascript error.

@oklimberg
Copy link

You need to use this.adapter.setForeignState('ID-value', value, function (err) { }); and this.adapter.getForeignState('ID-value', function (err, state) { }); since the states you want to use are outside of the adapter. To read or set the temperature state of one of my thermostats I would have to use 'maxcube.0.devices.thermostat_XXXXX.temp'. You can find this under objects of ioBroker

@kevinlieser
Copy link

I got my problem solved by using an own data object for my Homekit Button and listening to changes by the JavaScript Adapter. On change I trigger the Homekit Button, on change the Homekit Button I trigger the Roomba/Denon AVR.

Seems to work.

Thanks!

@nicoh88
Copy link
Collaborator

nicoh88 commented Jun 8, 2020

With the current master you can try it with a custom conversion function (script).

I think, the problem from the issue owner is solved. Close

@nicoh88 nicoh88 closed this as completed Jun 8, 2020
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

No branches or pull requests

7 participants