Daikin Hardware

For heating/cooling related questions in Domoticz

Moderator: leecollings

reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

Hi guys,

Great work! and have been using the Daikin integration successfully for 2 weeks now. Just one think I am confused about. What does the LED Indicator do? I was thinking this would (hopefully) turn off the On/Off LED on my unit, even when the unit is turned On. But it doesn't seem to do that. Maybe I am missing something here?
So what does it do and is it possible to turn off the LED at all? I hope it is as the unit is hanging above and near to our bed and shining quite a bright light.

Thanks!
User avatar
bitjeverkeerd
Posts: 30
Joined: Monday 13 April 2015 20:39
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Contact:

Re: Daikin Hardware

Post by bitjeverkeerd »

the Daikin integration in domoticz works perfectly.

In the Daikin app it is also possible to see the electricity consumption. Is it possible to get this information to Domoticz?
Jumper3126
Posts: 105
Joined: Thursday 31 December 2015 15:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by Jumper3126 »

Jumper3126 wrote: Friday 05 June 2020 10:02 This works if I turn off the airco with the domoticz airco power switch, but not via the app. Further inspection showed that not all daikin domoticz devices are frequently updated. The temperatures, wind setting, ventilation and LED are updated every 5 minutes, but the mode, power and setpoint are not. This explains why my script doesnt run as intended.

Do others have this as well?
What is the reason that not all devices are frequently updated?
Is there a solution (apart from asking for an update of those parameters via a command)?
As I wasn't satisfied with the infrequent update of the different Daikin devices, I have found a different approach. The following script checks the airco every minute for the current settings:

Code: Select all

return {
	active = true,

	on = {
		timer 			= {'every minute'},
		httpResponses 	= {'DataFromAirco'}
	},

	execute = function(domoticz, item)

        if item.isTimer then
		
			domoticz.openURL({
				url = 'http://AIRCO_IP/aircon/get_control_info',
				callback = 'DataFromAirco',
			})
			
        elseif (item.isHTTPResponse) then
			if item.ok then -- self.statusCode >= 200 and self.statusCode <= 299
				domoticz.log('Succesful connection')
				domoticz.log(item.data)
				local response = item.data
				local firstSplit = domoticz.utils.stringSplit(response,',') -- split the response string on comma -> one assignment per row
                local results = {}
                for _, row in ipairs(firstSplit) do
                	local hTable = domoticz.utils.stringSplit(row,'=') -- split every row into a helper table containing a key and a value
                 	local key = hTable[1]
                	local value = tonumber(hTable[2]) or hTable[2] -- store value as number when possible. If not store as string 
                	results[key] = value 
                end	

                	domoticz.log(results.pow)
                	domoticz.log(results.mode)
                	domoticz.log(results.stemp)
                	domoticz.log(results.f_rate)
                	domoticz.log(results.f_dir)
                	
                	domoticz.devices('Temp Setpoint (airco serre)').updateSetPoint(results.stemp)
                	if (results.pow == 1) then domoticz.devices('Power (airco serre)').switchOn() end
                	if (results.pow == 0) then domoticz.devices('Power (airco serre)').switchOff() end                	
                	if (results.mode == 0) or (results.mode == 1) or (results.mode == 7) then domoticz.devices('Mode (airco serre)').switchSelector('AUTO')
                	elseif (results.mode == 2) then domoticz.devices('Mode (airco serre)').switchSelector('DEHUMDIFICATOR')
                	elseif (results.mode == 3) then domoticz.devices('Mode (airco serre)').switchSelector('COLD')
                    elseif (results.mode == 4) then domoticz.devices('Mode (airco serre)').switchSelector('HOT')
                	elseif (results.mode == 6) then domoticz.devices('Mode (airco serre)').switchSelector('FAN')
    	            end
                	if (results.f_rate == 'A') then domoticz.devices('Ventilation (airco serre)').switchSelector('AUTO')
                	elseif (results.f_rate == 'B') then domoticz.devices('Ventilation (airco serre)').switchSelector('Silence')
                	elseif (results.f_rate == 3) then domoticz.devices('Ventilation (airco serre)').switchSelector('Lev 1')
                	elseif (results.f_rate == 4) then domoticz.devices('Ventilation (airco serre)').switchSelector('Lev 2')
                	elseif (results.f_rate == 5) then domoticz.devices('Ventilation (airco serre)').switchSelector('Lev 3')
                	elseif (results.f_rate == 6) then domoticz.devices('Ventilation (airco serre)').switchSelector('Lev 4')
                	elseif (results.f_rate == 7) then domoticz.devices('Ventilation (airco serre)').switchSelector('Lev 5')
                	end
                	if (results.f_dir == 0) then domoticz.devices('Winds (airco serre)').switchSelector('Stopped')
                	elseif (results.f_dir == 1) then domoticz.devices('Winds (airco serre)').switchSelector('Vert')
                	elseif (results.f_dir == 2) then domoticz.devices('Winds (airco serre)').switchSelector('Horiz')
                	elseif (results.f_dir == 3) then domoticz.devices('Winds (airco serre)').switchSelector('Both')
                    end

			else
				domoticz.notify('Unsuccesful connection airco settings')
			end
        end
	end
}
Till now, this works very well. Together with my earlier post, this does completely bypass the current Daikin hardware already predefined in Domoticz.

A second script allowed for getting the sensor data from domoticz. For my airco, this also gives info on the power consumption and the compressor frequency. Still exploring this. The power consumption is given in non-continuous value between 1 to 8, which isnt much resolution. But the profile looks the same as that of the powerplug I have it attached to.

Code: Select all

return {
	active = true,

	on = {
		timer 			= {'every minute'},
		httpResponses 	= {'TempFromAirco'}
	},

	execute = function(domoticz, item)

        if item.isTimer then
		
			domoticz.openURL({
				url = 'http://AIRCO_IP/aircon/get_sensor_info',
				callback = 'TempFromAirco',
			})
			
        elseif (item.isHTTPResponse) then
			if item.ok then -- self.statusCode >= 200 and self.statusCode <= 299
				domoticz.log('Succesful connection')
				domoticz.log(item.data)
				local response = item.data
				local firstSplit = domoticz.utils.stringSplit(response,',') -- split the response string on comma -> one assignment per row
                local results = {}
                for _, row in ipairs(firstSplit) do
                	local hTable = domoticz.utils.stringSplit(row,'=') -- split every row into a helper table containing a key and a value
                 	local key = hTable[1]
                	local value = tonumber(hTable[2]) or hTable[2] -- store value as number when possible. If not store as string 
                	results[key] = value 
                end	

                	domoticz.log(results.htemp)
                	domoticz.devices('Temp Serre (airco serre)').updateTemperature(results.htemp)
                	domoticz.log(results.otemp)
                	domoticz.devices('Temp Outside (airco serre)').updateTemperature(results.otemp)
                	domoticz.log(results.err)
                	domoticz.devices('Airco error code').updateCustomSensor(results.err)
                	domoticz.log(results.cmpfreq)
                	domoticz.devices('Airco compressor freq').updateCustomSensor(results.cmpfreq)
                	domoticz.log(results.mompow)
                	domoticz.devices('Airco power').updateCustomSensor(results.mompow)

			else
				domoticz.notify('Unsuccesful connection airco sensor')
			end
        end
	end
}
reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

That looks promising. However, I just tried the get_sensor_info URL again and all I get is this:

ret=OK,htemp=24.0,hhum=60,otemp=20.0,err=0,cmpfreq=17

I tried it on our two different models and neither shows a 'mompow'.
Nevertheless, the Daikin app is showing great logs for the power usage so it must get it from somewhere!?
I am confused... any ideas?

Thanks, Rene.
Jumper3126
Posts: 105
Joined: Thursday 31 December 2015 15:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by Jumper3126 »

Hi Rene
Your are indeed having a different response then I'm getting with my perfera. You do get humidity, which I haven't ;)
I would just test out the different command from the API https://github.com/ael-code/daikin-control and see which one might indicate power usage. You could rewrite the script above to log the data, to see if it fits the power usage profile.
reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

None of the commands listed there work for my models (floor model FVXM and Stylish FTXA).
I have now used Packet Capture to see what commands the Daikin app is using.
And it is all clear to me now... these are the commands that work for me with its output samples:

/aircon/get_day_power_ex
ret=OK,curr_day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_heat=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,curr_day_cool=2/1/2/1/0/1/1/1/0/0/0/0/0/0/0/0/0/0/0/0/1/0/0/0,prev_1day_cool=1/1/1/1/1/1/1/1/1/0/1/0/0/0/0/0/0/0/0/0/0/0/0/1

/aircon/get_week_power_ex
ret=OK,s_dayw=1,week_heat=0/0/0/0/0/0/1/0/0/0/0/0/0/0,week_cool=10/11/10/7/6/6/5/7/7/20/19/24/20/21

/aircon/get_year_power_ex
ret=OK,curr_year_heat=0/0/0/0/0/2/0/0/0/0/0/0,prev_year_heat=0/0/0/0/0/0/0/0/0/0/0/0,curr_year_cool=0/0/0/0/0/261/50/0/0/0/0/0,prev_year_cool=0/0/0/0/0/0/0/0/0/0/0/0

Still need to figure out what these numbers mean and how to get them into my domoticz UI but will have a look at it later.
Jumper3126
Posts: 105
Joined: Thursday 31 December 2015 15:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by Jumper3126 »

Nice, that works for me as well.

curr_day_cool=2/1/2/1/0/1/1/1/0/0/0/0/0/0/0/0/0/0/0/0/1/0/0/0
I think these are the power usage per hour. the value 1 is 100 Wh.

In the figure in the app each bar represents 2 hours, so you probably see something like 0.3/0.3/0.1/0.2/0/0/0/0/0/0/0.1/0 kWh, from 0:00 to 22:00 hr
reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

Right, that's exactly what I see. I am still missing the 'mompow' though. They must still have a sensor for it as they measure it but maybe they don't expose it anymore. Do you see this current power usage 'mompow' in the Daikin app at some screen? I don't see it but maybe I am missing it. In that case I would be able to see what command it is using for my models.
For the used power values, I think that is still interesting to have in my Domoticz. Still would need a way to convert and display somehow.
Jumper3126
Posts: 105
Joined: Thursday 31 December 2015 15:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by Jumper3126 »

No, I dont see the current power in the app. just the usage per 2 hours
reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

I believe it is shown in the /aircon/get_model_info which shows 'en_mompow=0' so it seems it is disabled somehow. Can you check if you see 'en_mompow=1' when you do a get_model_info?
Just not sure how to enable it if at all possible. Maybe it is a firmware thing as there seems no easy way to change this...
yomark
Posts: 9
Joined: Tuesday 10 November 2020 10:34
Target OS: Linux
Domoticz version:
Contact:

Re: Daikin Hardware

Post by yomark »

Hello,

Last week I received my three daikins.
The default domoticz plugin works perfectly well for my needs, but was missing power usage, so I created a dzVents script for that:

Code: Select all

return 
{
    on = 
    {
         timer = { 
                'at *:05 except at 00:05', 
                'at 23:55'
              
            },
        httpResponses = { 'energyRetrievedWoonkamer' }
    },
    logging = 
    {
        level = domoticz.LOG_DEBUG, -- for debugging
        --level = domoticz.LOG_INFO,
        marker = "DaikinWoonkamerPowerUur"
    },

    execute = function (dz, item)
        -- Split functie, het lijkt erop alsof basis spring functies ontbreken in LUA. Kan niets beters vinden. 
        function split(str,sep)
            local array = {}
            local reg = string.format("([^%s]+)",sep)
            for mem in string.gmatch(str,reg) do
                table.insert(array, mem)
            end
            return array
        end
        
        -- Op een nette manier ophalen via HTTP 
        if (item.isTimer) then
            dz.openURL({
            url = 'http://192.168.0.113/aircon/get_day_power_ex',
            method = 'GET',
            callback = 'energyRetrievedWoonkamer'
        })
        elseif (item.isHTTPResponse) then
         if (item.ok) then -- statusCode == 2xx
            local HTTPRaWData = item.data
           
            --dz.log ('ItemData = '  ..  HTTPRaWData)
             --local s = "ret=OK,curr_day_heat=2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1day_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0"
            
             -- "/" toevoegen of vervangen zodat we daar hieronder op kunnen splitsen. 
            local HTTPEditData = HTTPRaWData:gsub( "ret=OK,curr_day_heat=", "/") 
            local x = HTTPEditData:gsub( "curr_day_cool=", "/") 
             
            --dz.log ('x = '  ..  x)
            --Voorbeeld: /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1day_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
    
            -- Daarna words op "," gesplitst, waarna array waarde 1 curr_day_heat bevat en 3 is curr_day_cool
            words1 = {}
            for word1 in x:gmatch("([^,]+)") do table.insert(words1, word1) end
            --dz.log ('words1 = '  ..words1[1])   -- /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0 
            --dz.log ('CurrentdayHeat = '  ..words1[1])  -- Curdayheat
            --dz.log ('CurrentDayCool= '  ..words1[3]) -- curdayCool
                
            -- De words bovenin verder splitten met functie.  
            local arrayHeat = split(words1[1],"/") 
            local arrayCool = split(words1[3],"/")
            
            -- Dagtotalen
            local NieuwTotaal = 0
            local TotaalVandaagHeat=0
            local TotaalVandaagCool=0
            local TotaalVandaag=0
            local TotaalVandaagWatth=0
            
            -- Vorig uur.
            -- Dit klopt niet, vebruik in respone is al van het afgelopen uur.
            --local VorigUur=dz.time.hour-1
            -- Dus
            local VorigUur=dz.time.hour
            -- Behalve als 23, dan 23. Schedulen om 23:55
            if (dz.time.min==55) then
                VorigUur=24
            end
            local VorigUurHeat=0
            local VorigUurCool=0
            local VorigUurTotaal=0
            local VorigUurWatth=0
    
            -- Curdayheat
            for n, w in ipairs(arrayHeat) do
                local KWhHeat = w / 10 -- naar kwh
                dz.log ('Hele Reeks: Uur ' .. n ..':00'.. '  Verbruikt verwarming in KWh '.. KWhHeat)
                if (n == VorigUur) then
                    dz.log ('Vorig uur: ' .. VorigUur .. ' Verbruikt verwarming in KWh '.. KWhHeat)
                    VorigUurHeat = KWhHeat
                end
                TotaalVandaagHeat=TotaalVandaagHeat + KWhHeat
            end
                
            -- CurdayCool
            for n, w in ipairs(arrayCool) do
                local KWhCool = w / 10
                --dz.log ('Uur ' .. n ..':00'.. '  Verbruikt koelen in KWh '.. KWhCool)
                if (n == VorigUur) then
                    dz.log ('Vorig uur: ' .. VorigUur .. ' Verbruikt koelen in KWh '.. KWhCool)
                    VorigUurCool = KWhCool
                end
                TotaalVandaagCool=TotaalVandaagCool + KWhCool
            end
                
                --Dag Totalen koelen en verwarmen
            TotaalVandaag = TotaalVandaagHeat + TotaalVandaagCool
                
            -- Dagtotalen Naar Wh
            TotaalVandaagWatth = TotaalVandaag * 1000
            
            --Dag Totalen koelen en verwarmen
            VorigUurTotaal = VorigUurHeat + VorigUurCool
                
            -- Dagtotalen Naar Wh
            VorigUurWatth = VorigUurTotaal * 1000
                
            -- Tijd /uur. Misschien in de toekomst script per uur laten draaien op n-1?  
            dz.log ('het uur is nu: ' .. dz.time.hour)
            dz.log ('de minuut is nu: ' .. dz.time.min)
                
            dz.log ('TotaalVandaagHeat: ' .. TotaalVandaagHeat)
            dz.log ('TotaalVandaagCool: ' .. TotaalVandaagCool)
            dz.log ('TotaalVandaagSamen: ' .. TotaalVandaag)
            dz.log ('TotaalVandaagSamenWatth: ' ..  TotaalVandaagWatth)
            dz.log ('VorigUurWatth: ' ..  VorigUurWatth)
    
                
            --local NieuwTotaal = DummyDaikinVerbruik.WhTotal +  TotaalVandaagWatth 
            
            local DaikinVerbruikWoonkamer = dz.devices(151) -- Elektrische Dummy Counter
            dz.log ('Oude totaal van device DaikinVerbruikWoonkamer = '  ..  DaikinVerbruikWoonkamer.WhTotal) 
            
            -- Updaten device met verbruik per uur
            NieuwTotaal = DaikinVerbruikWoonkamer.WhTotal +  VorigUurWatth
            dz.log ('Nieuwe totaal = '  ..  NieuwTotaal)
            
            -- Device updaten
            DaikinVerbruikWoonkamer.updateElectricity ( VorigUurWatth , NieuwTotaal )
            
            -- Of per dag
             --NieuwTotaal = DummyDaikinVerbruik.WhTotal +  TotaalVandaagWatth
            --DummyDaikinVerbruik.updateElectricity ( TotaalVandaagWatth , NieuwTotaal )
            
         end
      end
    end
}
Normally I create scripts in english, but this time I started of of the wrong foot, so it's in Dutch.

What you'll need to do is create a Dummy electrical "instant+counter" device.
Change the device id in this line: " local DaikinVerbruikWoonkamer = dz.devices(151) -- Elektrische Dummy Counter"
Change the IP in this line " url = 'http://192.168.0.113/aircon/get_day_power_ex',"
If you have multiple daikins, also change this line "httpResponses = { 'energyRetrievedWoonkamer' }" to something unique.
And match it with this line "callback = 'energyRetrievedWoonkamer'"

About the script, I had in running for one day, and it seems to give the same results as the app. However, it's has some quirks. This is also my first lua script.
Problem: It seems the daikin http page does not give the "current" usage for the last hour, so it seems hour "24" is only updated after 24:00u. In which case you would only be able to retrieve it the "next day" in "the previous day" part of the http page after 0:00u , but the issue then is that you'll need to upload that to the domoticz device "in the past". Not sure if that's even possible, and if so, I was not willing to invest the time, because my daikins are turned off then anyway. So it could be the script running at 'at 23:55' has no use.
I'm not even sure, but it could be you're missing the usage between 23:00 and 24:00.
image_2020-11-10_110126.png
image_2020-11-10_110126.png (269.87 KiB) Viewed 4184 times
Good luck.

Edit:
If someone want to improve, change and re-post this script : be my guest. :!:
riob
Posts: 8
Joined: Thursday 06 February 2014 21:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by riob »

Hello
According to my log i have the following problem, any solution?


2020-11-10 16:11:00.202 Error: EventSystem: in Daikin: [string "commandArray = {}..."]:2: attempt to index a nil value (global 'devicechanged')


2020-11-10 16:12:00.233 Error: EventSystem: in Daikin: [string "commandArray = {}..."]:2: attempt to index a nil value (global 'devicechanged')

Regards Rickard
MarsaultP
Posts: 33
Joined: Wednesday 27 November 2019 13:31
Target OS: Linux
Domoticz version: 2024.7
Location: France
Contact:

Re: Daikin Hardware

Post by MarsaultP »

So, only the same script translated to english :

Code: Select all

return 
{
    on = 
    {
         timer = { 
                'at *:05 except at 00:05', 
                'at 23:55'
              
            },
        httpResponses = { 'energyRetrievedLiving_room' }
    },
    logging = 
    {
        level = domoticz.LOG_DEBUG, -- for debugging
        --level = domoticz.LOG_INFO,
        marker = "DaikinLiving_roomPowerHour"
    },

    execute = function (dz, item)
        -- Split function, it looks like basic spring functions are missing from LUA. Can't find anything better. 
        function split(str,sep)
            local array = {}
            local reg = string.format("([^%s]+)",sep)
            for mem in string.gmatch(str,reg) do
                table.insert(array, mem)
            end
            return array
        end
        
        -- Retrieve in a neat way via HTTP
        if (item.isTimer) then
            dz.openURL({
            url = 'http://192.168.2.121/aircon/get_Electric_power_ex',
            method = 'GET',
            callback = 'energyRetrievedLiving_room'
        })
        elseif (item.isHTTPResponse) then
         if (item.ok) then -- statusCode == 2xx
            local HTTPRaWData = item.data
           
            --dz.log ('ItemData = '  ..  HTTPRaWData)
             --local s = "ret=OK,curr_Electric_heat=2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1Electric_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0"
            
             -- "/" add or replace so that we can break it down below.
            local HTTPEditData = HTTPRaWData:gsub( "ret=OK,curr_Electric_heat=", "/") 
            local x = HTTPEditData:gsub( "curr_Electric_cool=", "/") 
             
            --dz.log ('x = '  ..  x)
            --Voorbeeld: /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1Electric_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
    
            -- Then split words on "," after which array value 1 contains curr_Electric_heat and 3 is curr_Electric_cool
            words1 = {}
            for word1 in x:gmatch("([^,]+)") do 
				table.insert(words1, word1) 
			end
            --dz.log ('words1 = '  ..words1[1])   -- /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0 
            --dz.log ('CurrentElectricHeat = '  ..words1[1])  -- CurElectricheat
            --dz.log ('CurrentElectricCool= '  ..words1[3]) -- curElectricCool
                
            -- Split the words at the top further with function.  
            local arrayHeat = split(words1[1],"/") 
            local arrayCool = split(words1[3],"/")
            
            -- DayTotals
            local NewTotal       =0
            local TotalTodayHeat =0
            local TotalTodayCool =0
            local TotalToday     =0
            local TotalTodayWatth=0
            
            -- Last Hour.
            -- This is not correct, use in response is already from the last Hour.
            --local LastHour=dz.time.hour-1
            -- Dus
            local LastHour=dz.time.hour
            -- Except as 23, then 23. Schedule at 11:55 PM
            if (dz.time.min==55) then
                LastHour=24
            end
            local LastHourHeat =0
            local LastHourCool =0
            local LastHourTotal=0
            local LastHourWatth=0
    
            -- CurElectricheat
            for n, w in ipairs(arrayHeat) do
                local KWhHeat = w * 0.1 -- To kwh
                dz.log ('Whole Series: Hour ' .. n ..':00'.. '  Consumptiont heating in KWh '.. KWhHeat)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumptiont heating in KWh '.. KWhHeat)
                    LastHourHeat = KWhHeat
                end
                TotalTodayHeat=TotalTodayHeat + KWhHeat
            end
                
            -- CurElectricCool
            for n, w in ipairs(arrayCool) do
                local KWhCool = w * 0.1
                --dz.log ('Hour ' .. n ..':00'.. '  Consumptiont cooling in KWh '.. KWhCool)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumptiont cooling in KWh '.. KWhCool)
                    LastHourCool = KWhCool
                end
                TotalTodayCool=TotalTodayCool + KWhCool
            end
                
                --Day Totals cooling and heating
            TotalToday = TotalTodayHeat + TotalTodayCool
                
            -- DayTotals To Wh
            TotalTodayWatth = TotalToday * 1000
            
            --Day Totals cooling and heating
            LastHourTotal = LastHourHeat + LastHourCool
                
            -- DayTotals To Wh
            LastHourWatth = LastHourTotal * 1000
                
            -- Time / Hour. Maybe run script per Hour on n-1 in the future ?  
            dz.log ('het Hour is nu: '       .. dz.time.hour)
            dz.log ('de minuut is nu: '      .. dz.time.min)
                
            dz.log ('TotalTodayHeat: '       .. TotalTodayHeat)
            dz.log ('TotalTodayCool: '       .. TotalTodayCool)
            dz.log ('TotalTodaySamen: '      .. TotalToday)
            dz.log ('TotalTodaySamenWatth: ' .. TotalTodayWatth)
            dz.log ('LastHourWatth: '        .. LastHourWatth)
    
                
            --local NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth 
            
            local DaikinConsumptionLiving_room = dz.devices(99) -- Electric Dummy Counter
            dz.log ('Old Total of device DaikinConsumptionLiving_room = '  ..  DaikinConsumptionLiving_room.WhTotal) 
            
            -- Updating device with Consumption per Hour
            NewTotal = DaikinConsumptionLiving_room.WhTotal +  LastHourWatth
            dz.log ('New Total = '  ..  NewTotal)
            
            -- Device update
            DaikinConsumptionLiving_room.updateElectricity ( LastHourWatth , NewTotal )
            
            -- Of per Day
             --NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth
            --DummyDaikinConsumption.updateElectricity ( TotalTodayWatth , NewTotal )
            
         end
      end
    end
}

This script, even translated, seems to work well (!)
reneklomp
Posts: 30
Joined: Monday 20 February 2017 23:07
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by reneklomp »

The URL seems to be changed in the translation from get_day_power_ex into get_Electric_power_ex and this seems to break the script. Is this a typo or translation mistake or am I missing someting?
MarsaultP
Posts: 33
Joined: Wednesday 27 November 2019 13:31
Target OS: Linux
Domoticz version: 2024.7
Location: France
Contact:

Re: Daikin Hardware

Post by MarsaultP »

Sorry : I had change URL to test with my own Daikin et I do a mistake during translation (!). I also adapt device index.
So, generic line must be :
url = 'http://192.168.x.xxx/aircon/get_day_power_ex',
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Daikin Hardware

Post by waaren »

riob wrote: Tuesday 10 November 2020 16:16 According to my log i have the following problem, any solution?
2020-11-10 16:11:00.202 Error: EventSystem: in Daikin: [string "commandArray = {}..."]:2: attempt to index a nil value (global 'devicechanged')
Did you save the script as a dzVents one?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
fenx2002
Posts: 9
Joined: Wednesday 11 November 2020 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by fenx2002 »

spiderjn wrote: Sunday 07 January 2018 9:36 Image20180107282.png

done, need to be tested by other user.

Pull created : https://github.com/domoticz/domoticz/pull/2044

Have fun
Hello
i'm a little bit lost
i thought that everything was ready when i selected Daikin Airconditioning with LAN (HTTP) interface
I just installed 4 split in my house
i added in domoticz one split and i have 8 modules but only switches
How do i do to have the same board as you have above?
with the winds selection, mode selection etc...

Thanks a lot for your help
MarsaultP
Posts: 33
Joined: Wednesday 27 November 2019 13:31
Target OS: Linux
Domoticz version: 2024.7
Location: France
Contact:

Re: Daikin Hardware

Post by MarsaultP »

Oooops, sorry again, I post too early (!) So, a mistake during translation replacement is on "Electricity" and "Day". I correct again, verify and test during 10 hours ... So, new script updated :

Code: Select all

return 
{
--
-- Show power consumption from Daikin server
--
-- doc : https://github.com/ael-code/daikin-control
--
    on = 
    {
         timer = { 
                'at *:05 except at 00:05', 
                'at 23:55'
              
            },
        httpResponses = { 'energyRetrievedLiving_room' }
    },
    logging = 
    {
        level = domoticz.LOG_DEBUG, -- for debugging
        --level = domoticz.LOG_INFO,
        marker = "Daikin Wh"
    },

    execute = function (dz, item)

        -- Split function, it looks like basic spring functions are missing from LUA. Can't find anything better. 
        function split(str,sep)
            local array = {}
            local reg = string.format("([^%s]+)",sep)
            for mem in string.gmatch(str,reg) do
                table.insert(array, mem)
            end
            return array
        end
        
        -- Retrieve in a neat way via HTTP
        if (item.isTimer) then
            dz.openURL({
            url = 'http://192.168.2.121/aircon/get_day_power_ex',
            method = 'GET',
            callback = 'energyRetrievedLiving_room'
        })
        elseif (item.isHTTPResponse) then
         if (item.ok) then -- statusCode == 2xx
            local HTTPRaWData = item.data
           
            --dz.log ('ItemData = '  ..  HTTPRaWData)
             --local s = "ret=OK,curr_Electric_heat=2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1Electric_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0"
            
             -- "/" add or replace so that we can break it down below.
            local HTTPEditData = HTTPRaWData:gsub ( "ret=OK,curr_day_heat=", "/") 
            local x            = HTTPEditData:gsub( "curr_day_cool="       , "/") 
             
            --dz.log ('x = '  ..  x)
            --Example: /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1day_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
    
            -- Then split words on "," after which array value 1 contains curr_day_heat and 3 is curr_day_cool
            words1 = {}
            for word1 in x:gmatch("([^,]+)") do 
				table.insert(words1, word1) 
			end
            --dz.log ('words1 = '  ..words1[1])   -- /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0 
            --dz.log ('CurrentDayHeat = ' ..words1[1]) -- CurDayheat
            --dz.log ('CurrentDayCool= '  ..words1[3]) -- curDayCool
                
            -- Split the words at the top further with function.  
            local arrayHeat = split(words1[1],"/") 
            local arrayCool = split(words1[3],"/")
            
            -- DayTotals
            local NewTotal       =0
            local TotalTodayHeat =0
            local TotalTodayCool =0
            local TotalToday     =0
            local TotalTodayWatth=0
            
            -- Last Hour.
            -- This is not correct, use in response is already from the last Hour.
            --local LastHour=dz.time.hour-1
            -- Dus
            local LastHour=dz.time.hour
            -- Except as 23, then 23. Schedule at 11:55 PM
            if (dz.time.min==55) then
                LastHour=24
            end
            local LastHourHeat =0
            local LastHourCool =0
            local LastHourTotal=0
            local LastHourWatth=0
    
            -- CurDayheat
            for n, w in ipairs(arrayHeat) do
                local KWhHeat = w * 0.1 -- To kwh
                --dz.log ('Whole Series: Hour ' .. n ..':00'.. '  Consumption heating in KWh '.. KWhHeat)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumption heating in KWh '.. KWhHeat)
                    LastHourHeat = KWhHeat
                end
                TotalTodayHeat=TotalTodayHeat + KWhHeat
            end
                
            -- CurDayCool
            for n, w in ipairs(arrayCool) do
                local KWhCool = w * 0.1
                --dz.log ('Hour ' .. n ..':00'.. '  Consumption cooling in KWh '.. KWhCool)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumption cooling in KWh '.. KWhCool)
                    LastHourCool = KWhCool
                end
                TotalTodayCool=TotalTodayCool + KWhCool
            end
                
                --Day Totals cooling and heating
            TotalToday = TotalTodayHeat + TotalTodayCool
                
            -- DayTotals To Wh
            TotalTodayWatth = TotalToday * 1000
            
            --Day Totals cooling and heating
            LastHourTotal = LastHourHeat + LastHourCool
                
            -- DayTotals To Wh
            LastHourWatth = LastHourTotal * 1000
                
            -- Time / Hour. Maybe run script per Hour on n-1 in the future ?  
            dz.log ('het Hour is nu: '       .. dz.time.hour)
            dz.log ('de minuut is nu: '      .. dz.time.min)
                
            dz.log ('TotalTodayHeat: '       .. TotalTodayHeat)
            dz.log ('TotalTodayCool: '       .. TotalTodayCool)
            dz.log ('TotalTodaySamen: '      .. TotalToday)
            dz.log ('TotalTodaySamenWatth: ' .. TotalTodayWatth)
            dz.log ('LastHourWatth: '        .. LastHourWatth)
    
                
            --local NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth 
            
            local DaikinConsumptionLiving_room = dz.devices(99) -- Electric Dummy Counter
            dz.log ('Old Total of device DaikinConsumptionLiving_room = '  ..  DaikinConsumptionLiving_room.WhTotal) 
            
            -- Updating device with Consumption per Hour
            NewTotal = DaikinConsumptionLiving_room.WhTotal +  LastHourWatth
            dz.log ('New Total = '  ..  NewTotal)
            
            -- Device update
            DaikinConsumptionLiving_room.updateElectricity ( LastHourWatth , NewTotal )
            
            -- Of per Day
             --NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth
            --DummyDaikinConsumption.updateElectricity ( TotalTodayWatth , NewTotal )
            
         end
      end
    end
}
I hope that now translation is Ok ...(!)
fenx2002
Posts: 9
Joined: Wednesday 11 November 2020 10:17
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Daikin Hardware

Post by fenx2002 »

MarsaultP wrote: Wednesday 11 November 2020 12:45 Oooops, sorry again, I post too early (!) So, a mistake during translation replacement is on "Electricity" and "Day". I correct again, verify and test during 10 hours ... So, new script updated :

Code: Select all

return 
{
--
-- Show power consumption from Daikin server
--
-- doc : https://github.com/ael-code/daikin-control
--
    on = 
    {
         timer = { 
                'at *:05 except at 00:05', 
                'at 23:55'
              
            },
        httpResponses = { 'energyRetrievedLiving_room' }
    },
    logging = 
    {
        level = domoticz.LOG_DEBUG, -- for debugging
        --level = domoticz.LOG_INFO,
        marker = "Daikin Wh"
    },

    execute = function (dz, item)

        -- Split function, it looks like basic spring functions are missing from LUA. Can't find anything better. 
        function split(str,sep)
            local array = {}
            local reg = string.format("([^%s]+)",sep)
            for mem in string.gmatch(str,reg) do
                table.insert(array, mem)
            end
            return array
        end
        
        -- Retrieve in a neat way via HTTP
        if (item.isTimer) then
            dz.openURL({
            url = 'http://192.168.2.121/aircon/get_day_power_ex',
            method = 'GET',
            callback = 'energyRetrievedLiving_room'
        })
        elseif (item.isHTTPResponse) then
         if (item.ok) then -- statusCode == 2xx
            local HTTPRaWData = item.data
           
            --dz.log ('ItemData = '  ..  HTTPRaWData)
             --local s = "ret=OK,curr_Electric_heat=2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1Electric_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0"
            
             -- "/" add or replace so that we can break it down below.
            local HTTPEditData = HTTPRaWData:gsub ( "ret=OK,curr_day_heat=", "/") 
            local x            = HTTPEditData:gsub( "curr_day_cool="       , "/") 
             
            --dz.log ('x = '  ..  x)
            --Example: /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0,prev_1day_heat=2/2/2/3/3/3/6/7/6/6/6/6/5/4/4/5/4/4/4/4/0/0/1/1,curr_day_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0,prev_1Electric_cool=0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0/0
    
            -- Then split words on "," after which array value 1 contains curr_day_heat and 3 is curr_day_cool
            words1 = {}
            for word1 in x:gmatch("([^,]+)") do 
				table.insert(words1, word1) 
			end
            --dz.log ('words1 = '  ..words1[1])   -- /2/3/3/3/4/4/6/6/8/8/4/4/4/4/4/4/0/0/0/0/0/0/0/0 
            --dz.log ('CurrentDayHeat = ' ..words1[1]) -- CurDayheat
            --dz.log ('CurrentDayCool= '  ..words1[3]) -- curDayCool
                
            -- Split the words at the top further with function.  
            local arrayHeat = split(words1[1],"/") 
            local arrayCool = split(words1[3],"/")
            
            -- DayTotals
            local NewTotal       =0
            local TotalTodayHeat =0
            local TotalTodayCool =0
            local TotalToday     =0
            local TotalTodayWatth=0
            
            -- Last Hour.
            -- This is not correct, use in response is already from the last Hour.
            --local LastHour=dz.time.hour-1
            -- Dus
            local LastHour=dz.time.hour
            -- Except as 23, then 23. Schedule at 11:55 PM
            if (dz.time.min==55) then
                LastHour=24
            end
            local LastHourHeat =0
            local LastHourCool =0
            local LastHourTotal=0
            local LastHourWatth=0
    
            -- CurDayheat
            for n, w in ipairs(arrayHeat) do
                local KWhHeat = w * 0.1 -- To kwh
                --dz.log ('Whole Series: Hour ' .. n ..':00'.. '  Consumption heating in KWh '.. KWhHeat)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumption heating in KWh '.. KWhHeat)
                    LastHourHeat = KWhHeat
                end
                TotalTodayHeat=TotalTodayHeat + KWhHeat
            end
                
            -- CurDayCool
            for n, w in ipairs(arrayCool) do
                local KWhCool = w * 0.1
                --dz.log ('Hour ' .. n ..':00'.. '  Consumption cooling in KWh '.. KWhCool)
                if (n == LastHour) then
                    dz.log ('Last Hour: ' .. LastHour .. ' Consumption cooling in KWh '.. KWhCool)
                    LastHourCool = KWhCool
                end
                TotalTodayCool=TotalTodayCool + KWhCool
            end
                
                --Day Totals cooling and heating
            TotalToday = TotalTodayHeat + TotalTodayCool
                
            -- DayTotals To Wh
            TotalTodayWatth = TotalToday * 1000
            
            --Day Totals cooling and heating
            LastHourTotal = LastHourHeat + LastHourCool
                
            -- DayTotals To Wh
            LastHourWatth = LastHourTotal * 1000
                
            -- Time / Hour. Maybe run script per Hour on n-1 in the future ?  
            dz.log ('het Hour is nu: '       .. dz.time.hour)
            dz.log ('de minuut is nu: '      .. dz.time.min)
                
            dz.log ('TotalTodayHeat: '       .. TotalTodayHeat)
            dz.log ('TotalTodayCool: '       .. TotalTodayCool)
            dz.log ('TotalTodaySamen: '      .. TotalToday)
            dz.log ('TotalTodaySamenWatth: ' .. TotalTodayWatth)
            dz.log ('LastHourWatth: '        .. LastHourWatth)
    
                
            --local NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth 
            
            local DaikinConsumptionLiving_room = dz.devices(99) -- Electric Dummy Counter
            dz.log ('Old Total of device DaikinConsumptionLiving_room = '  ..  DaikinConsumptionLiving_room.WhTotal) 
            
            -- Updating device with Consumption per Hour
            NewTotal = DaikinConsumptionLiving_room.WhTotal +  LastHourWatth
            dz.log ('New Total = '  ..  NewTotal)
            
            -- Device update
            DaikinConsumptionLiving_room.updateElectricity ( LastHourWatth , NewTotal )
            
            -- Of per Day
             --NewTotal = DummyDaikinConsumption.WhTotal +  TotalTodayWatth
            --DummyDaikinConsumption.updateElectricity ( TotalTodayWatth , NewTotal )
            
         end
      end
    end
}
I hope that now translation is Ok ...(!)
Hello
You seem to be french may i contact you in french for my problem? thanks
yomark
Posts: 9
Joined: Tuesday 10 November 2020 10:34
Target OS: Linux
Domoticz version:
Contact:

Re: Daikin Hardware

Post by yomark »

fenx2002 wrote: Wednesday 11 November 2020 10:23 i added in domoticz one split and i have 8 modules but only switches
Could you please create a screenshot?

You should have these devices when adding one unit:
image_2020-11-11_164007.png
image_2020-11-11_164007.png (69.89 KiB) Viewed 4136 times
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest