Mertik G6R-H4T1 controling with dzvents  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

i have the mertik heard controller and i can send commands with the domoticz ui
i can turn it on/ off and control the valve

with the dzvent i can only sent the on and off command
i have checkt that when i send a comand the value chance for 0 to 6 with each it function
i can

do somone now how i can send the right command for the valve

Code: Select all

return {
	on = {
		devices = {
			'Room Temperature'
		}
	},
	execute = function(domoticz, device, openhaard)
	    tempvalue =  domoticz.devices('Room Temperature').temperature
	    setvalue = domoticz.devices('Room Setpoint').setPoint
		
		diff = setvalue - tempvalue
		domoticz.log(diff, domoticz.LOG_INFO)
		if diff > 2 then
		    domoticz.devices('openhaard').switchOn().checkFirst()
		    domoticz.log(diff, domoticz.LOG_INFO)
		    domoticz.log(openhaard.state, domoticz.LOG_INFO)
		--elseif diff < 1 and diff > 0 then
		  --  domoticz.devices('openhaard').open()
		    --domoticz.log('1', domoticz.LOG_INFO)
	    elseif diff <= 0 then
	        domoticz.devices('openhaard').switchOff().checkFirst()
	        end
	    
		   
	end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Friday 09 October 2020 1:16 Do someone know how I can send the right command for the valve?
Can you show the device as it is on the device tab and as it is on the switch tab?
How do you control the valve with the GUI?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote:
goldman541 wrote: Friday 09 October 2020 1:16 Do someone know how I can send the right command for the valve?
Can you show the device as it is on the device tab and as it is on the switch tab?
How do you control the valve with the GUI?
When you click on the light bulb then comes a popup with 7 options you can choose to operate the valve

ImageImage

Verstuurd vanaf mijn SM-G950F met Tapatalk

User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Friday 09 October 2020 9:20 Verstuurd vanaf mijn SM-G950F met Tapatalk
Thx. I still have some issues replicating this devicetype on my test system. Please execute below identification script and send the logresult. (you can use PM if there is stuff inside you don't want to share in the public part of the forum.

Code: Select all

return
{
    on =
    {
        devices =
        {
            'your device name', -- Change to name of your thermostat and active it once 
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'Identify device', 
    },

    data =
    {
        attributes =
        {
            initial =
            {
                {},
            },
        },
    },

    execute = function(dz, item, info)
         
        local function printt(line)
            line = line or ''
            dz.log(line,dz.LOG_DEBUG)
            dz.data.attributes[#dz.data.attributes + 1] = line
        end

        local function osCommand(cmd)
            local file = io.popen(cmd)
            local output = file:read('*all')
            local rc = { file:close() }
            return output, rc[3]
        end

        local function deviceStatus()
            local _,rc = osCommand('which sqlite3')
            if rc == 0 then
                local cmd = 'sqlite3  -header -column domoticz.db "select * from DeviceStatus where id = ' .. item.id .. ';" '
                return osCommand(cmd)
            else
                dz.log('sqlite3 not available. Please make sure it is installed (sudo apt install sqlite3) and accessible', dz.LOG_ERROR)
            end
        end

        local function dumpTable(t, level, withFunctions )
            local level = level or "> "
            for attr, value in pairs(t or {}) do
                if (type(value) ~= 'function') then
                    if (type(value) == 'table') then
                        if attr ~= 'lastUpdate' and attr ~= '_data' then
                            printt(level .. attr .. ':')
                            dumpTable(value, level .. '    ', withFunctions)
                        elseif attr == 'lastUpdate' then
                            printt(level .. attr .. ':' .. value.raw)
                        end
                    else
                        printt(level .. attr .. ': ' .. tostring(value))
                    end
                elseif withFunctions then
                    printt(level .. attr .. '()')
                end
            end
        end

        dz.data.attributes = {}

        printt('+++++++++++++  Identifying device '  ..  item.name ..  ' +++++++++++++ ')
        dumpTable(item)

        printt() printt('+++++++++++++ deviceStatus of '.. item.name .. ' +++++++++++++ ') printt()
        printt( deviceStatus() )

        printt()
        dz.log('Results are also saved in  ' .. _G.dataFolderPath .. '__data_' .. info.scriptName .. '.lua' ,dz.LOG_DEBUG)
        dz.log('\n\n' ,dz.LOG_DEBUG)
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote: Friday 09 October 2020 11:50 Thx. I still have some issues replicating this devicetype on my test system. Please execute below identification script and send the logresult. (you can use PM if there is stuff inside you don't want to share in the public part of the forum.
this is off
Spoiler: show
2020-10-09 17:40:36.762 Status: EventSystem: Script event triggered: /home/pi/domoticz/dzVents/runtime/dzVents.lua
2020-10-09 17:40:37.109 (433 ontvanger) Thermostat 3 (openhaard)
2020-10-09 17:40:37.102 Status: User: Admin initiated a switch command (26/openhaard/Off)
2020-10-09 17:40:37.215 Status: dzVents: Info: Handling events for: "openhaard", value: "Off"
2020-10-09 17:40:37.215 Status: dzVents: Info: openhaard: ------ Start internal script: Script #1: Device: "openhaard (433 ontvanger)", Index: 26
2020-10-09 17:40:37.215 Status: dzVents: Debug: openhaard: +++++++++++++ Identifying device openhaard +++++++++++++
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > hardwareType: RFXCOM - RFXtrx433 USB 433.92MHz Transceiver
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > sValue: Off
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > isHTTPResponse: false
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > nValue: 0
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > _adapters:
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > 1: Switch device adapter
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > icon: temperature
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > bState: false
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > usedByCamera: false
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > changed: true
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > levelVal: 0
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > name: openhaard
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > signalLevel: 12
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > id: 26
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > _nValue: 0
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > isSecurity: false
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > timedOut: false
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > hardwareTypeValue: 1
2020-10-09 17:40:37.216 Status: dzVents: Debug: openhaard: > hardwareName: 433 ontvanger
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > lastUpdate:2020-10-09 17:40:37
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > isGroup: false
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > active: false
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > maxDimLevel: 0
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > rawData:
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > state: Off
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > deviceId: 000040
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > description:
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > hardwareID: 2
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > hardwareId: 2
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > idx: 26
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > protected: false
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > isDevice: true
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > lastLevel: 0
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > deviceSubType: Mertik G6R-H4T1
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > deviceType: Thermostat 3
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > switchType: On/Off
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > _state: Off
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > isScene: false
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > isTimer: false
2020-10-09 17:40:37.217 Status: dzVents: Debug: openhaard: > switchTypeValue: 0
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard: > baseType: device
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard: > isVariable: false
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard: > level: 0
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard: > unit: 0
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard:
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard: +++++++++++++ deviceStatus of openhaard +++++++++++++
2020-10-09 17:40:37.218 Status: dzVents: Debug: openhaard:
2020-10-09 17:40:37.264 Status: dzVents: Debug: openhaard: ID HardwareID DeviceID Unit Name Used Type SubType SwitchType Favorite SignalLevel BatteryLevel nValue sValue LastUpdate Order AddjValue AddjMulti AddjValue2 AddjMulti2 StrParam1 StrParam2 LastLevel Protected CustomImage Description Options Color
2020-10-09 17:40:37.264 ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ------------ ---------- ---------- ------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------- ---------- ----------
2020-10-09 17:40:37.264 26 2 000040 0 openhaard 1 66 0 0 1 12 255 0 2020-10-09 17:40:37 26 0.0 1.0 0.0 1.0 0 0 0
2020-10-09 17:40:37.264
2020-10-09 17:40:37.264 Status: dzVents: Debug: openhaard:
2020-10-09 17:40:37.264 Status: dzVents: Debug: openhaard: Results are also saved in /home/pi/domoticz/scripts/dzVents/data__data_Script #1.lua
2020-10-09 17:40:37.264 Status: dzVents: Debug: openhaard:
2020-10-09 17:40:37.264
2020-10-09 17:40:37.264
2020-10-09 17:40:37.266 Status: dzVents: Info: openhaard: ------ Finished Script #1
this time i used up command
Spoiler: show
2020-10-09 17:44:18.808 Status: User: Admin initiated a switch command (26/openhaard/Up)
2020-10-09 17:44:18.957 Status: dzVents: Info: Handling events for: "openhaard", value: "Up"
2020-10-09 17:44:18.957 Status: dzVents: Info: openhaard: ------ Start internal script: Script #1: Device: "openhaard (433 ontvanger)", Index: 26
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: +++++++++++++ Identifying device openhaard +++++++++++++
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > isDevice: true
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > _state: Up
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > levelVal: 0
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > hardwareId: 2
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > _nValue: 2
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > switchType: On/Off
2020-10-09 17:44:18.969 Status: dzVents: Debug: openhaard: > unit: 0
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > hardwareTypeValue: 1
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > state: Up
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > deviceType: Thermostat 3
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > isGroup: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > changed: true
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > hardwareType: RFXCOM - RFXtrx433 USB 433.92MHz Transceiver
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > description:
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > hardwareID: 2
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > isHTTPResponse: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > icon: temperature
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > protected: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > maxDimLevel: 0
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > isSecurity: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > switchTypeValue: 0
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > active: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > name: openhaard
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > signalLevel: 12
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > isScene: false
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > _adapters:
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > 1: Switch device adapter
2020-10-09 17:44:18.970 Status: dzVents: Debug: openhaard: > id: 26
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > deviceId: 000040
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > lastLevel: 0
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > level: 0
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > usedByCamera: false
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > timedOut: false
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > baseType: device
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > rawData:
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > deviceSubType: Mertik G6R-H4T1
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > bState: false
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > sValue: Up
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > nValue: 2
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > lastUpdate:2020-10-09 17:44:18
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > idx: 26
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > isTimer: false
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > isVariable: false
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: > hardwareName: 433 ontvanger
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard:
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard: +++++++++++++ deviceStatus of openhaard +++++++++++++
2020-10-09 17:44:18.971 Status: dzVents: Debug: openhaard:
2020-10-09 17:44:19.124 Status: dzVents: Debug: openhaard: ID HardwareID DeviceID Unit Name Used Type SubType SwitchType Favorite SignalLevel BatteryLevel nValue sValue LastUpdate Order AddjValue AddjMulti AddjValue2 AddjMulti2 StrParam1 StrParam2 LastLevel Protected CustomImage Description Options Color
2020-10-09 17:44:19.124 ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ------------ ---------- ---------- ------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------- ----------- ---------- ----------
2020-10-09 17:44:19.124 26 2 000040 0 openhaard 1 66 0 0 1 12 255 2 2020-10-09 17:44:18 26 0.0 1.0 0.0 1.0 0 0 0
2020-10-09 17:44:19.124
2020-10-09 17:44:19.125 Status: dzVents: Debug: openhaard:
2020-10-09 17:44:19.125 Status: dzVents: Debug: openhaard: Results are also saved in /home/pi/domoticz/scripts/dzVents/data__data_Script #1.lua
2020-10-09 17:44:19.125 Status: dzVents: Debug: openhaard:
2020-10-09 17:44:19.125
2020-10-09 17:44:19.125
2020-10-09 17:44:19.127 Status: dzVents: Info: openhaard: ------ Finished Script #1
i see a differents by the nvalue
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Friday 09 October 2020 17:52 i see a differents by the nvalue
Thx. Will have a look but could take some time.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Friday 09 October 2020 17:52 I see a differents by the nvalue
Yes. The nValue is controlling the status of this deviceType.

I will have a look to implement a device-adapter in dzVents for this device and also to see if it can be made possible to change the icon but don't expect that soon. For now I prepared the attached dzVents script that will set the nValue of the device based on the level of a selector switch. Of course you can use the setValues method also in another way

Code: Select all

return
{
    on =
    {
        devices =
        {
            'openhaardSelector',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'openhaard',
    },

    execute = function(dz, item)
        local openhaard = dz.devices('openhaard')

        dz.log('Selector ' .. item.name .. ' set to ' .. item.levelName, dz.LOG_DEBUG)

        openhaard.setValues( item.level / 10 ) -- setting the nValue of the openhaard device to 0,1,2,3,4,5 or 6 depening om the selector
    end
}
openhaard switch tab.png
openhaard switch tab.png (163.89 KiB) Viewed 851 times
openhaard selector.png
openhaard selector.png (54.16 KiB) Viewed 851 times
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote: Saturday 10 October 2020 15:13 Yes. The nValue is controlling the status of this deviceType.

I will have a look to implement a device-adapter in dzVents for this device and also to see if it can be made possible to change the icon but don't expect that soon. For now I prepared the attached dzVents script that will set the nValue of the device based on the level of a selector switch. Of course you can use the setValues method also in another way
it change the mode for the openhaard but it does not send the command

it only send a command when i do it with the popup
Naamloos.png
Naamloos.png (52.64 KiB) Viewed 850 times
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Saturday 10 October 2020 16:17 it change the mode for the openhaard but it does not send the command ; it only send a command when i do it with the popup
Ok back to the drawing board then... :D
can you check if

Code: Select all

http://<domoticz ip:domoticz:port>/json.htm?type=command&param=switchlight&idx=<open haard id>&switchcmd=Run%20Up&level=0
Works ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote: Saturday 10 October 2020 17:42 Ok back to the drawing board then... :D
can you check if

Code: Select all

http://<domoticz ip:domoticz:port>/json.htm?type=command&param=switchlight&idx=<open haard id>&switchcmd=Run%20Up&level=0
Works ?
that works valve is opening and i have tried the other commands and that works also

Code: Select all

/json.htm?type=command&param=switchlight&idx=26&switchcmd=On&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Off&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Up&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Down&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Run%20Up&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Run%20Down&level=0
/json.htm?type=command&param=switchlight&idx=26&switchcmd=Stop&level=0
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by waaren »

goldman541 wrote: Saturday 10 October 2020 17:55
waaren wrote: Saturday 10 October 2020 17:42 Ok back to the drawing board then... :D
can you check if

Code: Select all

http://<domoticz ip:domoticz:port>/json.htm?type=command&param=switchlight&idx=<open haard id>&switchcmd=Run%20Up&level=0
Works ?
that works valve is opening and i have tried the other commands and that works also
OK. Can you also try the same without level 0 ?
I don't have the real device myself so I can only partially check the commands. The device does react in the GUI
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote: Saturday 10 October 2020 19:09 OK. Can you also try the same without level 0 ?
I don't have the real device myself so I can only partially check the commands. The device does react in the GUI
that works also
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents  [Solved]

Post by waaren »

goldman541 wrote: Saturday 10 October 2020 19:32 that works also
Thx.
Until the device adapter is integrated in domoticz Beta you can use something like below. (see for the selector one of the previous posts)

Code: Select all

return
{
    on =
    {
        devices =
        {
            'openhaardSelector',
        },
    },

    logging =
    {
        level = domoticz.LOG_DEBUG,
        marker = 'openhaard',
    },

    execute = function(dz, item)

        local openHaard = dz.devices('openhaard')

        local function setValve(id, action)
            local action = action or 'Off'
            action = action:gsub(' ','%%20')
            local url = dz.settings['Domoticz url'] .. '/json.htm?type=command&param=switchlight&idx=' ..id  ..'&switchcmd=' .. action
            dz.openURL(url)
        end

        if item.nValue == 0 and openHaard.nValue ~= 0 then
            setValve(openHaard.id)
            dz.log('Selector ' .. item.name .. ' switched Off', dz.LOG_DEBUG)
        elseif item.nValue * 10 ~= item.level then
            setValve(openHaard.id, item.levelName)
            dz.log('Selector ' .. item.name .. ' set to ' .. item.levelName, dz.LOG_DEBUG)
        else
            dz.log('openHaard valve is already in state ' .. item.levelName, dz.LOG_DEBUG)
        end

    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
goldman541
Posts: 16
Joined: Saturday 19 November 2016 15:20
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: Netherlands
Contact:

Re: Mertik G6R-H4T1 controling with dzvents

Post by goldman541 »

waaren wrote: Saturday 10 October 2020 20:21 Thx.
Until the device adapter is integrated in domoticz Beta you can use something like below. (see for the selector one of the previous posts)
it's working now thank you
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest