<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[AC&#x2F;Heatpump control]]></title><description><![CDATA[<p dir="auto">Hi.<br />
I've just moved from Domoticz to MC, and so far I'm a happy chappy <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">On domo I was controlling my heatpump/AC unit using <a href="https://www.mysensors.org/build/heatpump" rel="nofollow ugc">Toni's</a> setup, slightly altered to allow for my Panasonic inverter.<br />
I used his <a href="https://www.domoticz.com/forum/viewtopic.php?f=34&amp;t=7179&amp;start=20#p74624" rel="nofollow ugc">LUA script  </a> to calculate the needed codes to send to the AC.</p>
<p dir="auto">Now I'm trying to make the thing work on MC...</p>
<p dir="auto">I can send fixed commands, using the RAW feature, but I'm stuck trying to figure out a smart way of doing it on MC.</p>
<p dir="auto">Somehow I need to make the state of "Heatpump Mode (including ON/OFF)", "Fan Speed" and "Temperature Setting" work together to generate an eight digit code that will be send to the AC node when one of the parameters update.</p>
<p dir="auto">Any pointers (or solutions <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /> )</p>
<p dir="auto">Thanks <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
]]></description><link>http://forum.mycontroller.org/topic/99/ac-heatpump-control</link><generator>RSS for Node</generator><lastBuildDate>Sun, 16 Aug 2026 16:53:04 GMT</lastBuildDate><atom:link href="http://forum.mycontroller.org/topic/99.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 01 Jan 2017 17:11:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Tue, 10 Jan 2017 08:24:46 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a><br />
Sorry for not posting the feedback yet...</p>
<p dir="auto">But yes - It works like a charm. And the timestamp solution seems to do what its supposed to <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
]]></description><link>http://forum.mycontroller.org/post/527</link><guid isPermaLink="true">http://forum.mycontroller.org/post/527</guid><dc:creator><![CDATA[ksga]]></dc:creator><pubDate>Tue, 10 Jan 2017 08:24:46 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Mon, 09 Jan 2017 18:15:54 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ksga" aria-label="Profile: ksga">@<bdi>ksga</bdi></a> Does this script works as you expected?</p>
]]></description><link>http://forum.mycontroller.org/post/519</link><guid isPermaLink="true">http://forum.mycontroller.org/post/519</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Mon, 09 Jan 2017 18:15:54 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Thu, 05 Jan 2017 13:02:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ksga" aria-label="Profile: ksga">@<bdi>ksga</bdi></a></p>
<blockquote>
<p dir="auto">Is it also correct that the<br />
if (fanSpeed == 'Auto')<br />
and not:<br />
if (mode == 'Auto')<br />
and so on...?</p>
</blockquote>
<p dir="auto">I am sorry it is a problem of copy/paste <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /> I have updated the script.</p>
]]></description><link>http://forum.mycontroller.org/post/503</link><guid isPermaLink="true">http://forum.mycontroller.org/post/503</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Thu, 05 Jan 2017 13:02:48 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Thu, 05 Jan 2017 12:23:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a><br />
Thanks.. Will give it a go..</p>
<p dir="auto">Is it also correct that the //Update Fan Speed should use<br />
<code>if (fanSpeed == 'Auto')</code></p>
<p dir="auto">and not:<br />
<code>if (mode == 'Auto')</code><br />
and so on...?</p>
]]></description><link>http://forum.mycontroller.org/post/502</link><guid isPermaLink="true">http://forum.mycontroller.org/post/502</guid><dc:creator><![CDATA[ksga]]></dc:creator><pubDate>Thu, 05 Jan 2017 12:23:17 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Thu, 05 Jan 2017 13:01:49 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ksga" aria-label="Profile: ksga">@<bdi>ksga</bdi></a></p>
<blockquote>
<p dir="auto">Is it possible to create a custom "Multi selector" sensor?</p>
</blockquote>
<p dir="auto">Right now it is impossible in MyController.</p>
<blockquote>
<p dir="auto">Regarding the script itself - would it not need some logic to prevent it from sending the value if nothing has changed?</p>
</blockquote>
<p dir="auto">you can check <code>timestamp</code> or <code>previousValue</code> of a sensor variable.</p>
<p dir="auto"><code>timestamp</code> &gt;&gt; would be a great one, you can make a condition with reference timestamp, if any one of sensorVariable timestamp changed, you can trigger further operation.<br />
<code>previousValue</code> &gt;&gt; compare <code>value</code> with <code>previousValue</code>, may not be a perfect solution! Might be changed multiple times within few seconds with the same value. Which leads false indication.</p>
<p dir="auto">I vote for <code>timestamp</code> solution, Here is simple check based on <code>timestamp</code>, For this you have to create new <code>variable</code> on <code>Variable repository</code> to take last execution time as a reference time. Create variable <code>hp-lastcheck</code> on <code>Utilities &gt;&gt; Variables repository</code>, add <code>0</code> as Value(default value, to avoid script null failure).</p>
<pre><code>//Get last check from variable repository
var lastCheckVariable = mcApi.variable().get("hp-lastcheck");
var lastCheck = lastCheckVariable.value;

//Get sensor values with UID Tags
var modeSensor =  mcApi.uidTag().getByUid("hp-mode").getResource(); //Heatpump Mode, sensor
var fanSpeedSensor = mcApi.uidTag().getByUid("hp-fs").getResource(); //Heatpump Fan Speed, sensor
var temperatureSensor = mcApi.uidTag().getByUid("hp-temperature").getResource(); //Heatpump Temperature, sensor

// Take refrance of current time, to update last check
var currentTime = Date.now();

if(modeSensor.timestamp &gt;= lastCheck || fanSpeedSensor.timestamp &gt;= lastCheck || temperatureSensor.timestamp &gt;= lastCheck){
  // Update values
  var mode =  modeSensor.getValue(); //Heatpump Mode
  var fanSpeed = fanSpeedSensor.getValue(); //Heatpump Fan Speed
  var temperature = parseInt(temperatureSensor.getValue()).toFixed(0); //Heatpump Temperature

  var modelCmd = '0'; //Default
  var powerModeCmd = "00"; //Default value
  var fanSpeedCmd = "0"; //Default value

  //Update mode
  if (mode == 'off'){
    powerModeCmd = '00';
  }else if (mode == 'Auto'){
    powerModeCmd = '11';
  }else if (mode == 'Heat'){
    powerModeCmd = '12';
  }else if (mode == 'Cool'){
    powerModeCmd = '13';
  }else if (mode == 'Dry'){
    powerModeCmd = '14';
  }else if (mode == 'Fan'){
    powerModeCmd = '15';
  }else if (mode == 'Maint'){
    powerModeCmd = '16';
  }

  //Update Fan speed
  if (fanSpeed == 'Auto'){
    fanSpeedCmd = '0';
  }else if (fanSpeed == 'Fan 1'){
    fanSpeedCmd = '1';
  }else if (fanSpeed == 'Fan 2'){
    fanSpeedCmd = '2';
  }else if (fanSpeed == 'Fan 3'){
    fanSpeedCmd = '3';
  }else if (fanSpeed == 'Fan 4'){
    fanSpeedCmd = '4';
  }else if (fanSpeed == 'Fan 5'){
    fanSpeedCmd = '5';
  }

  var temperatureCmd = parseInt(temperature).toString(16).toUpperCase();
  if(temperatureCmd.length &lt; 2) {
    temperatureCmd = '0' + temperatureCmd;
  }

  var modeCmd = '00'+modelCmd+powerModeCmd+fanSpeedCmd+temperatureCmd;

  // send to your IR
  // Get IR sensor via UID-Tag
  var irSensor = mcApi.uidTag().getByUid("my-ir-sen").getResource();
  // Update value
  irSensor.value = modeCmd;
  // Send value to sensor
  mcApi.sensor().sendPayload(irSensor);
}

//Update lastCheck refrence
lastCheckVariable.value = currentTime;
mcApi.variable().update(lastCheckVariable);
</code></pre>
<blockquote>
<p dir="auto">I think I should change from "simple" to "cron" for the timer. However it won't accept my cron entry "*/4 * * * * *" trying to make it run every 15 seconds...</p>
</blockquote>
<p dir="auto">In MyController cron is based on <a href="http://www.quartz-scheduler.org" rel="nofollow ugc">Quartz Scheduler</a>. You should have at least one <code>?</code> in your cron. Kindly refer <a href="http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html" rel="nofollow ugc">this tutorial</a>.<br />
For 15 seconds:  <code>0/15 * * * * ?</code></p>
]]></description><link>http://forum.mycontroller.org/post/501</link><guid isPermaLink="true">http://forum.mycontroller.org/post/501</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Thu, 05 Jan 2017 13:01:49 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Thu, 05 Jan 2017 09:52:04 GMT]]></title><description><![CDATA[<p dir="auto">No worries <a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a><br />
I'm trying to create the needed sensors. I assume I'll have to create some additional "dummy" sensors on the AC node.<br />
Is it possible to create a custom "Multi selector" sensor?<br />
The existing HVAC ones doesn't quite match the settings on my unit.</p>
<p dir="auto">Regarding the script itself - would it not need some logic to prevent it from sending the value if nothing has changed?<br />
I added the script on the "Utilities &gt; Scripts tab" - created an "Execute Script" operation on the "Resources &gt; Operations" tab, and finally a simple timer, running every 15 seconds, operating the "operation".</p>
<p dir="auto">If the script doesn't check for changes and stop if none has happened, I suspect that I will hear a most annoying beep from the heatpump four times every minute <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /><br />
I won't mind, but I'm sure I will shortly be single again....</p>
<p dir="auto">UPDATE<br />
It works as I feared <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";)" alt="😉" /><br />
Tried just doing "Text" sensors for holding the variables, and the code picks them up (except for fan speed), and sends them to the heatpump faithfully every time the script runs...<br />
Mildly annoying <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
<p dir="auto">Also, I think I should change from "simple" to "cron" for the timer. However it won't accept my cron entry "*/4 * * * * *" trying to make it run every 15 seconds...</p>
]]></description><link>http://forum.mycontroller.org/post/500</link><guid isPermaLink="true">http://forum.mycontroller.org/post/500</guid><dc:creator><![CDATA[ksga]]></dc:creator><pubDate>Thu, 05 Jan 2017 09:52:04 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Thu, 05 Jan 2017 13:04:00 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ksga" aria-label="Profile: ksga">@<bdi>ksga</bdi></a> Sorry for the delay response,</p>
<p dir="auto">JavaScript code for the above LUA script,</p>
<pre><code>//Get sensor values with UID Tags
var mode =  mcApi.uidTag().getByUid("hp-mode").getResource().getValue(); //Heatpump Mode
var fanSpeed = mcApi.uidTag().getByUid("hp-fs").getResource().getValue(); //Heatpump Fan Speed
var temperature = parseInt(mcApi.uidTag().getByUid("hp-temperature").getResource().getValue()).toFixed(0); //Heatpump Temperature

var modelCmd = '0'; //Default
var powerModeCmd = "00"; //Default value
var fanSpeedCmd = "0"; //Default value

//Update mode
if (mode == 'off'){
  powerModeCmd = '00';
}else if (mode == 'Auto'){
  powerModeCmd = '11';
}else if (mode == 'Heat'){
  powerModeCmd = '12';
}else if (mode == 'Cool'){
  powerModeCmd = '13';
}else if (mode == 'Dry'){
  powerModeCmd = '14';
}else if (mode == 'Fan'){
  powerModeCmd = '15';
}else if (mode == 'Maint'){
  powerModeCmd = '16';
}

//Update Fan speed
if (fanSpeed == 'Auto'){
  fanSpeedCmd = '0';
}else if (fanSpeed == 'Fan 1'){
  fanSpeedCmd = '1';
}else if (fanSpeed == 'Fan 2'){
  fanSpeedCmd = '2';
}else if (fanSpeed == 'Fan 3'){
  fanSpeedCmd = '3';
}else if (fanSpeed == 'Fan 4'){
  fanSpeedCmd = '4';
}else if (fanSpeed == 'Fan 5'){
  fanSpeedCmd = '5';
}

var temperatureCmd = parseInt(temperature).toString(16).toUpperCase();
if(temperatureCmd.length &lt; 2) {
  temperatureCmd = '0' + temperatureCmd;
}

var modeCmd = '00'+modelCmd+powerModeCmd+fanSpeedCmd+temperatureCmd;

// send to your IR
// Get IR sensor via UID-Tag
var irSensor = mcApi.uidTag().getByUid("my-ir-sen").getResource();
// Update value
irSensor.value = modeCmd;
// Send value to sensor
mcApi.sensor().sendPayload(irSensor);

</code></pre>
<p dir="auto">You have to set UID Tag for each sensor and get sensor value with <code>UID Tag</code>. There is no event mechanism in MC right now. You have to configure a timer job to run this operation.</p>
]]></description><link>http://forum.mycontroller.org/post/499</link><guid isPermaLink="true">http://forum.mycontroller.org/post/499</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Thu, 05 Jan 2017 13:04:00 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Wed, 04 Jan 2017 16:15:51 GMT]]></title><description><![CDATA[<p dir="auto">Hi <a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a><br />
I don't want to put any pressure on you or anything like that - I'm very grateful for all your hard work that has gone into this project - which ROCKS btw <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">But - was my above info useful, or was it insufficient to explain the issue?</p>
]]></description><link>http://forum.mycontroller.org/post/495</link><guid isPermaLink="true">http://forum.mycontroller.org/post/495</guid><dc:creator><![CDATA[ksga]]></dc:creator><pubDate>Wed, 04 Jan 2017 16:15:51 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Mon, 02 Jan 2017 12:30:22 GMT]]></title><description><![CDATA[<p dir="auto">Sure <a class="plugin-mentions-user plugin-mentions-a" href="/user/jkandasa" aria-label="Profile: jkandasa">@<bdi>jkandasa</bdi></a><br />
The LUA script that Toni wrote looks like this:</p>
<pre><code>-- These are the configuration variables, set them according to your system
modelCmd = '0'        -- Panasonic CKP, see https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/HeatpumpIRController/HeatpumpIRController.ino#L68
textDev = 'IR data'   -- Name of the 'IR data' MySensors device
irSendDev = 'IR send' -- Name of the 'IR send' MySensors device


commandArray = {}


for key, value in pairs(devicechanged) do
  if (key == 'Heatpump Mode' or key == 'Heatpump Fan Speed' or key == 'Heatpump Temperature') then

    mode = otherdevices['Heatpump Mode']
    fanSpeed = otherdevices['Heatpump Fan Speed']
    temperature = math.floor(otherdevices_svalues['Heatpump Temperature'])

    if     (mode == 'Off')   then powerModeCmd = '00'
    elseif (mode == 'Auto')  then powerModeCmd = '11'
    elseif (mode == 'Heat')  then powerModeCmd = '12'
    elseif (mode == 'Cool')  then powerModeCmd = '13'
    elseif (mode == 'Dry')   then powerModeCmd = '14'
    elseif (mode == 'Fan')   then powerModeCmd = '15'
    elseif (mode == 'Maint') then powerModeCmd = '16'
    end

    if     (fanSpeed == 'Auto')  then fanSpeedCmd = '0'
    elseif (fanSpeed == 'Fan 1') then fanSpeedCmd = '1'
    elseif (fanSpeed == 'Fan 2') then fanSpeedCmd = '2'
    elseif (fanSpeed == 'Fan 3') then fanSpeedCmd = '3'
    elseif (fanSpeed == 'Fan 4') then fanSpeedCmd = '4'
    elseif (fanSpeed == 'Fan 5') then fanSpeedCmd = '5'
    end

    temperatureCmd = string.format("%02x", temperature)

    modeCmd = '00' .. modelCmd .. powerModeCmd .. fanSpeedCmd .. temperatureCmd

    print(string.format('Mode: %s, fan: %s, temp: %s, modeCmd: %s', mode, fanSpeed, temperature, modeCmd))

    commandArray['UpdateDevice'] = otherdevices_idx[textDev] .. '|0|' .. modeCmd
    commandArray['IR send'] = 'On'

  end
end

return commandArray
</code></pre>
<p dir="auto">The code will generate an eight digit code looking something like this:<br />
12345678<br />
Position 1+2: Always "00", double zero<br />
Position 3: Model code - in my case "4" - refers to Arduino sketch<br />
Position 4+5: Power mode - for example "11" - Auto mode<br />
Position 6: Fan speed - for example "3" - speed 3<br />
Position 7+8: Temperature in hex - for example "18" - 24 degrees</p>
<p dir="auto">Above would result in the string: 00411318 - Auto mode, Fan speed 3, 24 degrees <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">The mode, fanSpeed and temperature variables defined in the first section refers to the dummy devices that were needed on Domoticz</p>
]]></description><link>http://forum.mycontroller.org/post/474</link><guid isPermaLink="true">http://forum.mycontroller.org/post/474</guid><dc:creator><![CDATA[ksga]]></dc:creator><pubDate>Mon, 02 Jan 2017 12:30:22 GMT</pubDate></item><item><title><![CDATA[Reply to AC&#x2F;Heatpump control on Mon, 02 Jan 2017 10:47:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/ksga" aria-label="Profile: ksga">@<bdi>ksga</bdi></a>  Thanks to showing interest with MyController. Can you post your program logic? We can create JavaScript and execute your logic <img src="http://forum.mycontroller.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=2ce0f5c73bf" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:23px;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
]]></description><link>http://forum.mycontroller.org/post/471</link><guid isPermaLink="true">http://forum.mycontroller.org/post/471</guid><dc:creator><![CDATA[jkandasa]]></dc:creator><pubDate>Mon, 02 Jan 2017 10:47:35 GMT</pubDate></item></channel></rss>