Page 1 of 2

Heatpump/air conditioner as a Domoticz device

Posted: Thursday 05 November 2015 19:20
by Toni
I've been playing around with heatpump/air conditioner control with MySensors (see http://forum.mysensors.org/topic/622/he ... controller and https://github.com/mysensors/Arduino/tr ... Controller). It's now technically possible to control many heatpumps/air conditioners with Domoticz, but it's quite clumsy as there's no support for this device type on Domoticz side. Right now I'm using a 'Text' sensor with an encoded hex string as the value, and a switch to trigger the 'Text' sensor value to be sent. And some custom Lua events...

Would it be possible to implement support for a heatpump/air conditioner device? I think it would be enough if a 'MySensors' sensor type 'S_IR' could be defined as a heatpump/air conditioner sensor. In the settings (behind 'Edit') there should be the possibility to define the model somehow (it could be a plain number, or a name of a heatpump/air conditioner device). The UI itself should have capability to set these properties
  • Power state (ON/OFF)
  • Temperature (integer)
  • Operating mode (auto, cool, heat, fan)
  • Fan speed
I have attached some quick mock-ups I made about the intended UI design (I made these by editing the HTML in browser 'developer' view). The 'Set' operation should change all properties at once, and then trigger the 'V_IR_SEND' type of message towards the sensor. The message could be encoded for example like I have done in https://github.com/mysensors/Arduino/bl ... /README.md.

Comments?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Wednesday 11 November 2015 11:27
by Toni
Is there really no interest in this?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Tuesday 01 December 2015 21:23
by panoz
I just added a feature request on the tracker for support of the s_hvac sensor of my sensors.
It's up to the developers from here on..

Re: Heatpump/air conditioner as a Domoticz device

Posted: Wednesday 02 December 2015 14:06
by Toni
Thanks panoz :)

Re: Heatpump/air conditioner as a Domoticz device

Posted: Monday 07 December 2015 15:32
by Sateetje
Hi,

I'm dealing with the same issue. I'm considering to buy 4 of the Remotec zxt-120 to control 4 of my Mitsubishi Heavy air conditioners.

I did a little reverse engineering on the Mitshubioshi Heavy remote control IR codes (used AnalysIR).

The idea was to setup some Arduinos (in a ZBee network) with IR leds to control the air conditioners. This idea stopped because of time consumption.

Now I installed Domoticz with RFXOM and Z-wave USB stick to make a more generic solution.

So if I could eliminate the 4 Remotecs and develop a MySensors solution with IR leds, temperature, humidity, CO, etc. for each room with an air conditioner, it would be great.

Controlling my 4 air conditioners from Domoticz would be a nice christmas present :D

Re: Heatpump/air conditioner as a Domoticz device

Posted: Sunday 10 January 2016 20:38
by mKotek
I am going to test the solution for Arduino with my Midea air-cons and if it works (and I suppose so), I would be very interested in full control via Domoticz.

Re: Heatpump/air conditioner as a Domoticz device

Posted: Wednesday 03 February 2016 21:57
by Sateetje
mKotek wrote:I am going to test the solution for Arduino with my Midea air-cons and if it works (and I suppose so), I would be very interested in full control via Domoticz.
Did you get it up and running already?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Monday 11 July 2016 7:34
by coles123
Sateetje wrote:Hi,

I'm dealing with the same issue. I'm considering to buy 4 of the Remotec zxt-120 to control 4 of my Mitsubishi Heavy climate control portland.

I did a little reverse engineering on the Mitshubioshi Heavy remote control IR codes (used AnalysIR).

The idea was to setup some Arduinos (in a ZBee network) with IR leds to control the air conditioners. This idea stopped because of time consumption.

Now I installed Domoticz with RFXOM and Z-wave USB stick to make a more generic solution.

So if I could eliminate the 4 Remotecs and develop a MySensors solution with IR leds, temperature, humidity, CO, etc. for each room with an air conditioner, it would be great.

Controlling my 4 air conditioners from Domoticz would be a nice christmas present :D
Do you share some more details about Heatpump/air conditioner?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Tuesday 12 July 2016 21:27
by Sateetje
What do you want to know? The specific information about the Mitsubishi Heavy? Or how to control an air conditioner with Domoticz?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Tuesday 27 September 2016 22:32
by madrian
Toni added support for my AC into his great arduino-heatpump project. Using that project, and with his plugin for ESP EASY, I am able to control my AC in form:

$ curl http://192.168.1.7/control?cmd=heatpump ... 0,3,1,23,3

Where the last numbers are the control commands for AC (on/off, tempaerature, fan speed, AC mode).

What Toni said in the first post, it's still not available a device like this? Even a dummy device would be great, If we can make it work with ESP EASY&HEATPUMP plugin.

Re: Heatpump/air conditioner as a Domoticz device

Posted: Sunday 11 December 2016 0:18
by Sushukka
Bump for this. World is full of heatpumps and that's also one of the juiciest areas to do some home automation. Even there are plenty of different models the basic requirements/control needs are the same: temperature, mode, fan speed. Like RGB light/dimmer there should definitely be a heatpump option in Domoticz's device type list.

Re: Heatpump/air conditioner as a Domoticz device

Posted: Sunday 18 December 2016 0:37
by bjacobse
hpapagaj wrote: using Esp Easy firmware on my Wemos D1 with Heatpump plugin + an Ir transmitter.
How did you put the ESP Easy together with the ESP EASY plugin? I have been searching around but not easy to get the complete picture is there a block diagram I have overlooked?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Sunday 18 December 2016 15:26
by Toni
I'm using this version of ESPEasy on my projects: https://github.com/ToniA/ESPEasy, build it with PlatformIO (http://platformio.org/), as I needed to increase the MQTT message size buffer (Domoticz is VERY verbose). With Arduino IDE you need to manually modify the PubSubClient code...

In Domoticz I have a 'text' sensor on the dummy hardware. This sensor has a text value like 'panasonic_nke,1,6,5,10,0,0'. This value is calculated by the event scripts, and it's the value the ESPEasy looks for. In the event script I update the text value like this:

Code: Select all

commandArray[1] = {['OpenURL'] = 'http://127.0.0.1:8080/json.htm?type=command&param=udevice&idx=' .. otherdevices_idx[apartment .. ': ' .. textDev] .. '&svalue=' .. modeCmd}
Then I need to have an MQTT broker running, I'm using Mosquitto on the Domoticz host.

Finally, the ESPEasy firmware is configured to connect to the MQTT broker on the Domoticz host, and it has a device definition like this:
* Device: Heatpump IR transmitter
* IDX/Var: Domoticz IDX of the text sensor
* 1st GPIO: The pin the IR led is connected to (connect in series with a resistor, then connect between G and the GPIO pin of your choice). Remember that the IR transmission range is not that great without any amplifier, something like 1 meter will work fine

Re: Heatpump/air conditioner as a Domoticz device

Posted: Sunday 18 December 2016 21:22
by bjacobse
Toni wrote:
Not sure I understood all the steps in details, but now I will search around to gather some knowledge, now I know which path to follow. Meanwhile waiting for my Wemos D1 mini pro to arrive at home, I hope to be able to use one to this nice project.
Paljon kiitos sinun nopea vastataa, Thank you :-)

Re: Heatpump/air conditioner as a Domoticz device

Posted: Thursday 19 January 2017 18:46
by bjacobse
Now I got the Espeeasy + Toni's heatpumpir working, I can now control the heatpump with http/url commands.
Did anyone create a script that combines the modes, fan speed and temperature? or is the Daikin-wifi script handling this?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Saturday 21 January 2017 22:25
by bjacobse
I realized that there is something similar in this thread
http://domoticz.com/forum/viewtopic.php ... =20#p97750

I managed to get Toni's heatpumpir + Wemos D1 mini + ESPEASY + P115 heatpumpir plugin to work
I also created a script, and found hapagaj's lua script, so I copied some code from him
domo_AC.png
domo_AC.png (84.39 KiB) Viewed 10617 times

Code: Select all

--[[
Script created by bjacobse. I have copied some code code from hpapagaj
to use with ToniA's heatpumpir lib + ESpeasy and _P115_heatpumpir 

Create the following dummy switches (Note that LUA are case sensitiv):
'AC Mode''AC Fan Speed''AC Set Temperature'

and if your AC/heatpoump support then also create:
'AC Hor dir''AC Vert dir'
And add -- in front of line 27. And remove -- in line 29


 https://github.com/ToniA/arduino-heatpumpir/blob/master/HeatpumpIR.h


Changelog:
 
    Version 1.0, 2017 January
    - Initial release
]]

--Set espeasy heatpump IP address
local ipadress = '192.168.2.6'
local model = 'ivt'

commandArray = {}
for key, value in pairs(devicechanged) do
  --if (key == 'AC Mode' or key == 'AC Fan Speed' or key == 'AC Set Temperature' or key == 'AC Hor Dir' or key == 'AC Ver dir') then
  if (key == 'AC Mode' or key == 'AC Fan Speed' or key == 'AC Set Temperature') then

    print ("HeatpumpIR event started")


-- Power mode is ON if operating modes are in use
--// Power state
--#define POWER_OFF   0
--#define POWER_ON    1
    local power = 1


--// Operating modes
--#define MODE_AUTO   1
--#define MODE_HEAT   2
--#define MODE_COOL   3
--#define MODE_DRY    4
--#define MODE_FAN    5
--#define MODE_MAINT  6
    local mode = 2
    if (otherdevices['AC Mode']) == 'Off' then
        mode = 0
        power = 0
    elseif (otherdevices['AC Mode'] == 'Auto') then
        mode = 1        
    elseif (otherdevices['AC Mode'] == 'Heat') then
        mode = 2        
    elseif (otherdevices['AC Mode'] == 'Cool') then
        mode = 3        
    elseif (otherdevices['AC Mode'] == 'Dry') then
        mode = 4        
    elseif (otherdevices['AC Mode'] == 'fan') then
        mode = 5        
    elseif (otherdevices['AC Mode'] == 'Maint') then
        mode = 6        
    end

--print (otherdevices_svalues['AC mode'])
 --for i, v in pairs(devicechanged) do print(i, v) end

--// Fan speeds. Note that some heatpumps have less than 5 fan speeds
--#define FAN_AUTO    0
--#define FAN_1       1
--#define FAN_2       2
--#define FAN_3       3
--#define FAN_4       4
--#define FAN_5       5
    local fan = 1
    if (otherdevices['AC Fan Speed']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Fan Speed']) == '1' then
        fan = 1        
    elseif (otherdevices['AC Fan Speed']) == '2' then
        fan = 2        
    elseif (otherdevices['AC Fan Speed']) == '3' then
        fan = 3        
    elseif (otherdevices['AC Fan Speed']) == '4' then
        fan = 4        
    elseif (otherdevices['AC Fan Speed']) == '5' then
        fan = 5
    end

--Set temperature
    local settemperature = 23
    settemperature = tonumber(otherdevices['AC Set Temperature'])


--// Vertical air directions. Note that these cannot be set on all heat pumps
--#define VDIR_AUTO   0
--#define VDIR_MANUAL 0
--#define VDIR_SWING  1
--#define VDIR_UP     2
--#define VDIR_MUP    3
--#define VDIR_MIDDLE 4
--#define VDIR_MDOWN  5
--#define VDIR_DOWN   6
    local verdir = 0
    if (otherdevices['AC Ver dir']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Ver dir']) == 'Manual' then
        fan = 0        
    elseif (otherdevices['AC Ver dir']) == 'Swing' then
        fan = 1        
    elseif (otherdevices['AC Ver dir']) == 'Up' then
        fan = 2        
    elseif (otherdevices['AC Ver dir']) == 'Mup' then
        fan = 3        
    elseif (otherdevices['AC Ver dir']) == 'Middle' then
        fan = 4        
    elseif (otherdevices['AC Ver dir']) == 'Mdown' then
        fan = 5
    elseif (otherdevices['AC Ver dir']) == 'Down' then
        fan = 6
    end


--// Horizontal air directions. Note that these cannot be set on all heat pumps
--#define HDIR_AUTO   0
--#define HDIR_MANUAL 0
--#define HDIR_SWING  1
--#define HDIR_MIDDLE 2
--#define HDIR_LEFT   3
--#define HDIR_MLEFT  4
--#define HDIR_MRIGHT 5
--#define HDIR_RIGHT  6
    local hordir = 0
    if (otherdevices['AC Hor dir']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Hor dir']) == 'Manual' then
        fan = 0        
    elseif (otherdevices['AC Hor dir']) == 'Swing' then
        fan = 1        
    elseif (otherdevices['AC Hor dir']) == 'Middle' then
        fan = 2        
    elseif (otherdevices['AC Hor dir']) == 'Left' then
        fan = 3        
    elseif (otherdevices['AC Hor dir']) == 'Mleft' then
        fan = 4        
    elseif (otherdevices['AC Hor dir']) == 'Mright' then
        fan = 5
    elseif (otherdevices['AC Hor dir']) == 'Right' then
        fan = 6
    end
 

    print ("HeatpumpIR event transmitted")

    print ('http://' ..ipadress.. '/control?cmd=heatpumpir,' .. model..','..power..','..mode..','..fan..','..settemperature..','..verdir..','..hordir)
    commandArray['OpenURL'] = 'http://' ..ipadress.. '/control?cmd=heatpumpir,' .. model..','..power..','..mode..','..fan..','..settemperature..','..verdir..','..hordir
    end
end
return commandArray
I ended up creating a WIKI page:
https://www.domoticz.com/wiki/AC_/_heat ... heatpumpIR

Re: Heatpump/air conditioner as a Domoticz device

Posted: Friday 28 April 2017 14:23
by Gaston
Toni wrote:I'm using this version of ESPEasy on my projects: https://github.com/ToniA/ESPEasy
Hi Toni,

I'm also automate my airco and while building a proto, it didn't took me long before I came across your great piece of code.
Thank you very much, this helped me a lot as I needed a kickstart to use it with a esp8266 without PWM.
The Carrier codes look a lot like the Toshiba, but not fully.

I've decoded a Toshiba WH-H04JE remote for a split unit.
I like the challenge to continue and update your code.

What is the best way to reach you and share my data?
The forums I'm subscribed to, don't allow me to send private messages yet :)

Regards,
Gaston

Re: Heatpump/air conditioner as a Domoticz device

Posted: Friday 28 April 2017 15:36
by Derik
Dear Toni,

What is the brand and type of you pump/airco?
How is your opinion/experience to this stuff?

Happy with it?

Re: Heatpump/air conditioner as a Domoticz device

Posted: Friday 28 April 2017 17:00
by Toni
This works quite well, but you have to remember that this is one-way communication, so the A/C device does not give any feedback. I have support for quite a few different models, just see the readme of the library: https://github.com/ToniA/arduino-heatpumpir

I have for example built an automation project for a village of summer cottages, where the aim is to remotely control both the A/C heatpump devices and the electric radiators, so that the indoor temperature can be kept at ~8C - ~10C while the apartments are not rented, and then remotely switched up to normal heating when the apartment is rented.

You can for example PM me on this forum, or find my email address in Github...

Re: Heatpump/air conditioner as a Domoticz device

Posted: Wednesday 22 November 2017 23:49
by zulfiqaradil
bjacobse wrote: Saturday 21 January 2017 22:25 I realized that there is something similar in this thread
http://domoticz.com/forum/viewtopic.php ... =20#p97750

I managed to get Toni's heatpumpir + Wemos D1 mini + ESPEASY + P115 heatpumpir plugin to work
I also created a script, and found hapagaj's lua script, so I copied some code from him
domo_AC.png

Code: Select all

--[[
Script created by bjacobse. I have copied some code code from hpapagaj
to use with ToniA's heatpumpir lib + ESpeasy and _P115_heatpumpir 

Create the following dummy switches (Note that LUA are case sensitiv):
'AC Mode''AC Fan Speed''AC Set Temperature'

and if your AC/heatpoump support then also create:
'AC Hor dir''AC Vert dir'
And add -- in front of line 27. And remove -- in line 29


 https://github.com/ToniA/arduino-heatpumpir/blob/master/HeatpumpIR.h


Changelog:
 
    Version 1.0, 2017 January
    - Initial release
]]

--Set espeasy heatpump IP address
local ipadress = '192.168.2.6'
local model = 'ivt'

commandArray = {}
for key, value in pairs(devicechanged) do
  --if (key == 'AC Mode' or key == 'AC Fan Speed' or key == 'AC Set Temperature' or key == 'AC Hor Dir' or key == 'AC Ver dir') then
  if (key == 'AC Mode' or key == 'AC Fan Speed' or key == 'AC Set Temperature') then

    print ("HeatpumpIR event started")


-- Power mode is ON if operating modes are in use
--// Power state
--#define POWER_OFF   0
--#define POWER_ON    1
    local power = 1


--// Operating modes
--#define MODE_AUTO   1
--#define MODE_HEAT   2
--#define MODE_COOL   3
--#define MODE_DRY    4
--#define MODE_FAN    5
--#define MODE_MAINT  6
    local mode = 2
    if (otherdevices['AC Mode']) == 'Off' then
        mode = 0
        power = 0
    elseif (otherdevices['AC Mode'] == 'Auto') then
        mode = 1        
    elseif (otherdevices['AC Mode'] == 'Heat') then
        mode = 2        
    elseif (otherdevices['AC Mode'] == 'Cool') then
        mode = 3        
    elseif (otherdevices['AC Mode'] == 'Dry') then
        mode = 4        
    elseif (otherdevices['AC Mode'] == 'fan') then
        mode = 5        
    elseif (otherdevices['AC Mode'] == 'Maint') then
        mode = 6        
    end

--print (otherdevices_svalues['AC mode'])
 --for i, v in pairs(devicechanged) do print(i, v) end

--// Fan speeds. Note that some heatpumps have less than 5 fan speeds
--#define FAN_AUTO    0
--#define FAN_1       1
--#define FAN_2       2
--#define FAN_3       3
--#define FAN_4       4
--#define FAN_5       5
    local fan = 1
    if (otherdevices['AC Fan Speed']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Fan Speed']) == '1' then
        fan = 1        
    elseif (otherdevices['AC Fan Speed']) == '2' then
        fan = 2        
    elseif (otherdevices['AC Fan Speed']) == '3' then
        fan = 3        
    elseif (otherdevices['AC Fan Speed']) == '4' then
        fan = 4        
    elseif (otherdevices['AC Fan Speed']) == '5' then
        fan = 5
    end

--Set temperature
    local settemperature = 23
    settemperature = tonumber(otherdevices['AC Set Temperature'])


--// Vertical air directions. Note that these cannot be set on all heat pumps
--#define VDIR_AUTO   0
--#define VDIR_MANUAL 0
--#define VDIR_SWING  1
--#define VDIR_UP     2
--#define VDIR_MUP    3
--#define VDIR_MIDDLE 4
--#define VDIR_MDOWN  5
--#define VDIR_DOWN   6
    local verdir = 0
    if (otherdevices['AC Ver dir']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Ver dir']) == 'Manual' then
        fan = 0        
    elseif (otherdevices['AC Ver dir']) == 'Swing' then
        fan = 1        
    elseif (otherdevices['AC Ver dir']) == 'Up' then
        fan = 2        
    elseif (otherdevices['AC Ver dir']) == 'Mup' then
        fan = 3        
    elseif (otherdevices['AC Ver dir']) == 'Middle' then
        fan = 4        
    elseif (otherdevices['AC Ver dir']) == 'Mdown' then
        fan = 5
    elseif (otherdevices['AC Ver dir']) == 'Down' then
        fan = 6
    end


--// Horizontal air directions. Note that these cannot be set on all heat pumps
--#define HDIR_AUTO   0
--#define HDIR_MANUAL 0
--#define HDIR_SWING  1
--#define HDIR_MIDDLE 2
--#define HDIR_LEFT   3
--#define HDIR_MLEFT  4
--#define HDIR_MRIGHT 5
--#define HDIR_RIGHT  6
    local hordir = 0
    if (otherdevices['AC Hor dir']) == 'Auto' then
        fan = 0
    elseif (otherdevices['AC Hor dir']) == 'Manual' then
        fan = 0        
    elseif (otherdevices['AC Hor dir']) == 'Swing' then
        fan = 1        
    elseif (otherdevices['AC Hor dir']) == 'Middle' then
        fan = 2        
    elseif (otherdevices['AC Hor dir']) == 'Left' then
        fan = 3        
    elseif (otherdevices['AC Hor dir']) == 'Mleft' then
        fan = 4        
    elseif (otherdevices['AC Hor dir']) == 'Mright' then
        fan = 5
    elseif (otherdevices['AC Hor dir']) == 'Right' then
        fan = 6
    end
 

    print ("HeatpumpIR event transmitted")

    print ('http://' ..ipadress.. '/control?cmd=heatpumpir,' .. model..','..power..','..mode..','..fan..','..settemperature..','..verdir..','..hordir)
    commandArray['OpenURL'] = 'http://' ..ipadress.. '/control?cmd=heatpumpir,' .. model..','..power..','..mode..','..fan..','..settemperature..','..verdir..','..hordir
    end
end
return commandArray
I ended up creating a WIKI page:
https://www.domoticz.com/wiki/AC_/_heat ... heatpumpIR
Very nice. I do the almost same thing but with just only one PWM pin for test purpose and soon plan to handle my all house fans and heaters with it .
Here I am facing with

Code: Select all

print("String Print: = "..'http://' ..IP.. '/control?cmd=PWM,' .. PIN..','..CalcValue..'')
commandArray['OpenURL'] = 'http://' ..IP.. '/control?cmd=PWM,' .. PIN..','..CalcValue..''
and in this commandArray['OpenURL']=........ line after executing I found error in log like this
2017-11-23 03:00:36.181 Error: Error opening url: http://192.168.1.50/control?cmd=PWM,2,854
2017-11-23 03:00:46.188 Error: Error opening url: http://192.168.1.50/control?cmd=PWM,2,564
2017-11-23 03:00:56.193 Error: Error opening url: http://192.168.1.50/control?cmd=PWM,2,84
2017-11-23 03:01:06.193 Error: Error opening url: http://192.168.1.50/control?cmd=PWM,2,944
Any one have any clue for this and I think its look like its not properly executing CommandArray[]=... with variables
But on when I do fixed values with CommandArray[].... like this
commandArray['OpenURL'] = "http://192.168.2.50/control?cmd=PWM,2,1";
It did and I saw changing LED behavior on my LED and it work