Evohome set Hot Water On and Off status via Dzvents

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

Moderator: leecollings

Post Reply
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

Hi there,

I can not find any example how to set the Evohome Hot Water On and Off via Dzvent.
For example setting the normal TVR: device.updateSetPoint(20,domoticz.EVOHOME_MODE_PERMANENT_OVERRIDE)

But the above does not seem to work with the Hot Water device I guess cause the tvr and the hot water device is slightly different.
It is not possible to set the Hot Water Temp just to On/Off status and the length of the overwrite.

As well as the Hot Water normal Device state is: 33.14;Off;Auto
where as the tvr is: 20.06;15.00;Auto

Any help would be appreciated.

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

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Tuesday 13 November 2018 1:45 I can not find any example how to set the Evohome Hot Water On and Off via Dzvent.
It is not possible to set the Hot Water Temp just to On/Off status and the length of the overwrite.
What is the type and subtype of your device ?
If you don't know please put somewhere in a script

Code: Select all

domoticz.devices("name of your device").dump()
This will dump all information known to dzVents about this device to the domoticz log. If you share these loglines, I might be able to help.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

Hi Waaren,

Please see the device dump.

2018-11-13 11:20:00.371 Status: dzVents: > 1: 34.67
2018-11-13 11:20:00.371 Status: dzVents: > 2: Off
2018-11-13 11:20:00.371 Status: dzVents: > 3: Auto
2018-11-13 11:20:00.371 Status: dzVents: > updateRain()
2018-11-13 11:20:00.371 Status: dzVents: > updateSoilMoisture()
2018-11-13 11:20:00.371 Status: dzVents: > updateRadiation()
2018-11-13 11:20:00.371 Status: dzVents: > armAway()
2018-11-13 11:20:00.371 Status: dzVents: > disarm()
2018-11-13 11:20:00.371 Status: dzVents: > idx: 64
2018-11-13 11:20:00.371 Status: dzVents: > setState()
2018-11-13 11:20:00.371 Status: dzVents: > updateP1()
2018-11-13 11:20:00.371 Status: dzVents: > setRGB()
2018-11-13 11:20:00.371 Status: dzVents: > decreaseBrightness()
2018-11-13 11:20:00.371 Status: dzVents: > updateVoltage()
2018-11-13 11:20:00.371 Status: dzVents: > name: Hot Water
2018-11-13 11:20:00.371 Status: dzVents: > kodiPlayPlaylist()
2018-11-13 11:20:00.371 Status: dzVents: > updateDistance()
2018-11-13 11:20:00.371 Status: dzVents: > switchTypeValue: 0
2018-11-13 11:20:00.371 Status: dzVents: > updateGas()
2018-11-13 11:20:00.371 Status: dzVents: > update()
2018-11-13 11:20:00.371 Status: dzVents: > hardwareType: Evohome USB (for HGI/S80)
2018-11-13 11:20:00.371 Status: dzVents: > onkyoEISCPCommand()
2018-11-13 11:20:00.371 Status: dzVents: > setKelvin()
2018-11-13 11:20:00.371 Status: dzVents: > updateHumidity()
2018-11-13 11:20:00.371 Status: dzVents: > bState: false
2018-11-13 11:20:00.371 Status: dzVents: > isTimer: false
2018-11-13 11:20:00.371 Status: dzVents: > updateText()
2018-11-13 11:20:00.371 Status: dzVents: > changed: false
2018-11-13 11:20:00.371 Status: dzVents: > kodiExecuteAddOn()
2018-11-13 11:20:00.371 Status: dzVents: > deviceSubType: Hot Water
2018-11-13 11:20:00.371 Status: dzVents: > isVariable: false
2018-11-13 11:20:00.371 Status: dzVents: > setPoint: 34.67
2018-11-13 11:20:00.371 Status: dzVents: > deviceType: Heating
2018-11-13 11:20:00.371 Status: dzVents: > hardwareName: Evohome
2018-11-13 11:20:00.371 Status: dzVents: > updateCustomSensor()
2018-11-13 11:20:00.371 Status: dzVents: > _data:
2018-11-13 11:20:00.371 Status: dzVents: > timedOut: false
2018-11-13 11:20:00.371 Status: dzVents: > data:
2018-11-13 11:20:00.371 Status: dzVents: > _nValue: 0
2018-11-13 11:20:00.371 Status: dzVents: > icon: override_mini
2018-11-13 11:20:00.371 Status: dzVents: > temperature: 34.669998168945
2018-11-13 11:20:00.371 Status: dzVents: > hardwareName: Evohome
2018-11-13 11:20:00.371 Status: dzVents: > hardwareID: 2
2018-11-13 11:20:00.371 Status: dzVents: > protected: false
2018-11-13 11:20:00.371 Status: dzVents: > hardwareType: Evohome USB (for HGI/S80)
2018-11-13 11:20:00.371 Status: dzVents: > unit: 1
2018-11-13 11:20:00.371 Status: dzVents: > hardwareTypeValue: 39
2018-11-13 11:20:00.371 Status: dzVents: > _state: 34.67;Off;Auto
2018-11-13 11:20:00.371 Status: dzVents: > baseType: device
2018-11-13 11:20:00.371 Status: dzVents: > name: Hot Water
2018-11-13 11:20:00.371 Status: dzVents: > switchTypeValue: 0
2018-11-13 11:20:00.371 Status: dzVents: > id: 64
2018-11-13 11:20:00.371 Status: dzVents: > lastUpdate: 2018-11-13 11:19:54
2018-11-13 11:20:00.371 Status: dzVents: > deviceID: ****
2018-11-13 11:20:00.371 Status: dzVents: > description:
2018-11-13 11:20:00.371 Status: dzVents: > switchType: On/Off
2018-11-13 11:20:00.371 Status: dzVents: > lastLevel: 0
2018-11-13 11:20:00.371 Status: dzVents: > subType: Hot Water
2018-11-13 11:20:00.371 Status: dzVents: > batteryLevel: 100
2018-11-13 11:20:00.371 Status: dzVents: > signalLevel: 255
2018-11-13 11:20:00.371 Status: dzVents: > rawData:
2018-11-13 11:20:00.371 Status: dzVents: > 1: 34.67
2018-11-13 11:20:00.371 Status: dzVents: > 2: Off
2018-11-13 11:20:00.371 Status: dzVents: > 3: Auto
2018-11-13 11:20:00.371 Status: dzVents: > changed: false
2018-11-13 11:20:00.371 Status: dzVents: > deviceType: Heating
2018-11-13 11:20:00.371 Status: dzVents: > updateSetPoint()
2018-11-13 11:20:00.371 Status: dzVents: > stop()
2018-11-13 11:20:00.371 Status: dzVents: > updateTemperature()
2018-11-13 11:20:00.371 Status: dzVents: > id: 64

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

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Tuesday 13 November 2018 1:45 I can not find any example how to set the Evohome Hot Water On and Off via Dzvent.
Any help would be appreciated.
Can you please test script below and report your findings ?
I tried to create a dummy hotWater device but domoticz won't let me. Seems that there is a kind of test if it is created using the evoHome hardware.
So I could only test if the syntaxis is OK

Code: Select all

-- setHotwater

return {

    on =        {       timer  =   { "every minute"}},
              
    logging =   {       level   =   domoticz.LOG_DEBUG,
                        marker  =   "hotWater" },

    execute = function(dz, item )
       
        local hotWaterDevice = dz.devices(1154)             -- Change to your device idx
        local newState       = "Off"                        -- can be "Off" or "On"  
        local newMode        = "PermanentOverride"          -- mode can be "Auto, "TemporaryOverride", 'PermanentOverride', "FollowSchedule"
        
        local function logWrite(str,level)
            dz.log(str,level or dz.LOG_DEBUG)
        end

        local function setHotWater(idx,state,mode)
                local  url = dz.settings['Domoticz url'] .. "/json.htm?type=setused&idx=" .. idx ..
                                                            "&setpoint=&state=" .. state ..
                                                            "&mode=" .. mode ..
                                                            "&used=true"
                dz.openURL(url)
        end
              
        logWrite("HotWater deviceState: " .. hotWaterDevice.state)
       
       -- setHotWater(idx,state,mode)
       setHotWater(hotWaterDevice.idx,newState,newMode)
    end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

It worked out of the box.
Brilliant!
I guess Dzvent does not support it out of the box.
Now I just need to figure out the url syntax in case I'd like to set a TemporaryOverride so that I can pass in the TemporaryOverride expire time.

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

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Tuesday 13 November 2018 18:12 I guess Dzvent does not support it out of the box.
Now I just need to figure out the url syntax in case I'd like to set a TemporaryOverride so that I can pass in the TemporaryOverride expire time.
Thx for reporting back and glad it worked.

No dzVents does not yet support this natively and I searched for a more direct solution but somehow domoticz does not like it if dzVents or Lua update the sValue of this type of device direct. Using sqlite3 it also works but that is not a very elegant way of modifying data.
I will have a chat with @dannybloe (creator of dzVents) to check if switching the evo hotWater with this JSON approach is the best way of implementing it as a native dzVents functionality.

According to this this domotic API/JSON wiki No until time can be added but it is worth a try to just add it and see how the system reacts.
I am very much interested in the outcome of your tests.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

I've tweaked it a bit and now the `TemporaryOverride` works as well.
It'd awesome if the dzvent support can be implemented.

Let me know if you'd like me to run few test.

Code: Select all

return {

    on =        {       timer  =   { "every minute"}},

    logging =   {       level   =   domoticz.LOG_DEBUG,
        marker  =   "hotWater" },

    execute = function(dz, item )

        local hotWaterDevice = dz.devices(64)                 -- Change to your device idx
        local newState       = "On"                        		  -- can be "Off" or "On"
        local newMode       = "TemporaryOverride"          -- mode can be "Auto, "TemporaryOverride", 'PermanentOverride', "FollowSchedule"
        local timer	     = "'2018-11-13T22:00:00.000Z"
    
        local function logWrite(str,level)
            dz.log(str,level or dz.LOG_DEBUG)
        end



        local function setHotWater(idx,state,mode, timer)
            if mode == 'TemporaryOverride' and timer ~= nil then
                mode = string.format("TemporaryOverride&until=%s", timer)
            end
            print 
            local  url = dz.settings['Domoticz url'] .. "/json.htm?type=setused&idx=" .. idx ..
                    "&setpoint=&state=" .. state ..
                    "&mode=" .. mode ..
                    "&used=true"
            dz.openURL(url)
        end

        logWrite("HotWater deviceState: " .. hotWaterDevice.state)

        -- setHotWater(idx,state,mode)
        -- setHotWater(hotWaterDevice.idx,newState,newMode, nil)
        setHotWater(hotWaterDevice.idx,newState,newMode, timer)
    end
}
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Tuesday 13 November 2018 20:51 I've tweaked it a bit and now the `TemporaryOverride` works as well.
It'd awesome if the dzvent support can be implemented.
Let me know if you'd like me to run few test.
Thx for testing. I ran a few tests myself and found that the until date does not change nor will be removed when calling the url with another mode than PermanentOverride.
Did you see the same ? My workaround would be to clear that until date by calling the API with mode PermanentOverride just before the actual call.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

Just tested it again and it works fine.

I've set first TemporaryOverride then PermanentOverride then FollowSchedule all went fine.

Let me send you the latest version:

I've put everything in global_data:

Code: Select all

return {
    helpers = {
        get_device_details = function(domoticz, name)
            device =  domoticz.devices(name)
            device_state = device.state
            device_state_lastUpdate = device.lastUpdate.minutesAgo
            return device, device_state, device_state_lastUpdate
        end,
        
        -- state: On/Off, mode: mode can be "Auto", "PermanentOverride", "FollowSchedule", "TemporaryOverride" with timer: "2018-11-13T22:00:00.000Z",
        setHotWater = function(domoticz, device_name, state, mode, timer)
            device, _, _ = domoticz.helpers.get_device_details(domoticz, device_name)
            idx = device.idx
            
            if mode == 'TemporaryOverride' and timer ~= nil then
                mode = string.format("TemporaryOverride&until=%s", timer)
            end
            
            local  url = domoticz.settings['Domoticz url'] .. "/json.htm?type=setused&idx=" .. idx ..
                    "&setpoint=&state=" .. state ..
                    "&mode=" .. mode ..
                    "&used=true"
            domoticz.openURL(url)
            domoticz.log("HotWater: " .. device_name .. "deviceState: " .. device.state)
        end

    }
}
Then I just call it from my Event script

Code: Select all

	   --domoticz.helpers.setHotWater(domoticz, 'Hot Water', 'Off', 'TemporaryOverride', '2018-11-14T22:00:00.000Z')
	   --domoticz.helpers.setHotWater(domoticz, 'Hot Water', 'Off', 'PermanentOverride', nil)
	   domoticz.helpers.setHotWater(domoticz, 'Hot Water', 'Off', 'FollowSchedule', nil)
I have not seen the until time hanging around also I've checked on the EvoHome controller and all get set fine.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Wednesday 14 November 2018 11:35 Just tested it again and it works fine.
I've set first TemporaryOverride then PermanentOverride then FollowSchedule all went fine.
I have not seen the until time hanging around also I've checked on the EvoHome controller and all get set fine.
Thx, can you please test also another sequence; TemporaryOverride then FollowSchedule ? I noticed that the untildate was not cleared with this sequence on my (virtual) Hotwater evo device.
I also replied to your PM
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

I've tired the TemporaryOverride then FollowSchedule that worked too.
All works as expected.
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by waaren »

sexyboy wrote: Wednesday 14 November 2018 14:18 I've tired the TemporaryOverride then FollowSchedule that worked too.
All works as expected.
Now implemented natively in dzVents 2.4.9
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
sexyboy
Posts: 14
Joined: Tuesday 25 September 2018 16:34
Target OS: Linux
Domoticz version:
Contact:

Re: Evohome set Hot Water On and Off status via Dzvents

Post by sexyboy »

great thx for letting me know
Post Reply

Who is online

Users browsing this forum: assp22, RonkA and 1 guest