Set points re-setting

Easy to use, 100% Lua-based event scripting framework.
Post Reply
ChrisKerswell
Posts: 9
Joined: Sunday 17 December 2017 4:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Set points re-setting

Post by ChrisKerswell » Monday 01 October 2018 0:51

Hi,

So I have been running Domoticz for Z-Wave for 6 months or so.
Generally everything has been going smoothly, then in the last week or so strange things have started to happen...

My setup
* Domoticz running on Synology (v4.9700)
* Aeotec ZW090 Z-Stick Gen5 EU USB Z-Wave Controller
* Stella-Z and POPP TRVs

Configuration
I have a virtual switch to turn on/off heating for each room.
When a set point or room temperature update is received, my dzVents script checks temp vs set point and switches on/off the boiler.
When I switch the virtual room switch on, it calls a JSON URL to update the set point for that TRV (domoticz.devices('Set Point Device').UpdateSetpoint(xx.xx) doesn't seem to do anything at all?).
Domoticz reports the set point has updated an runs the associated set point / temp compare, switching the boiler on/off as required.
When the next Z-Wave update comes in from the TRV, the Domoticz set point is reset to the previous value.

If I update the set point manually on the web interface or app, then all works correctly.

This behaviour happens on both the Stella-Z and POPP TRVs, although the POPP TRVs do then seem to immediately realise and send another update, changing to the new set point value.

It's almost as if Domoticz is not sending the set point update into the Z-Wave message queue??

Any ideas??!

ChrisKerswell
Posts: 9
Joined: Sunday 17 December 2017 4:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Set points re-setting

Post by ChrisKerswell » Saturday 27 October 2018 19:15

Is anyone else having this issue or am I the only one??!

I have recently also worked out that timer plans still work and update the set points correctly.

User avatar
waaren
Posts: 1332
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Set points re-setting

Post by waaren » Saturday 27 October 2018 20:16

ChrisKerswell wrote:
Saturday 27 October 2018 19:15
Is anyone else having this issue or am I the only one??!

I have recently also worked out that timer plans still work and update the set points correctly.
Can you show us the script and relevant loglines ? That might help
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

ChrisKerswell
Posts: 9
Joined: Sunday 17 December 2017 4:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Set points re-setting

Post by ChrisKerswell » Tuesday 13 November 2018 1:44

Hi, thanks for the reply,

The simplified script I am using is:
Spoiler: show

Code: Select all

return {

	-- 'active' controls if this entire script is considered or not
	active = true, -- set to false to disable this script

	-- trigger
	-- can be a combination:
	on = {
		devices = {
			-- scripts is executed if the device that was updated matches with one of these triggers

			'Heating Hall',
			'Hall Temp',
			'Hall Set Point',

		},

	},

	execute = function(domoticz, item)


    -- ### SCRIPT VARIABLES START ###
        local RoomName = ''

    -- ### SCRIPT VARIABLES END ###

    -- ### HALL START [Function v2] ###
        RoomName = 'Hall'

        -- If we get a Switch for the room, run the RoomSwitch function
		if (item.name == 'Heating '..RoomName or item.name == 'Heating '..RoomName..' Boost') then
        -- RoomSwitch(domoticz,item,RoomName)
            if (domoticz.devices('Heating '..RoomName).state == 'On') then
                -- Set the set point to on target
                -- this use to work, but now sets it in domoticz but does not update TRV, when TRV next reports temp it resets domotics
                domoticz.openURL('http://127.0.0.1:9080/json.htm?type=command&param=udevice&idx='..domoticz.devices(RoomName..' Set Point').idx..'&nvalue=0&svalue='..domoticz.variables('Heating_Target_On_'..RoomName).value)
            else
                -- Set the set point to off target
                domoticz.openURL('http://127.0.0.1:9080/json.htm?type=command&param=udevice&idx='..domoticz.devices(RoomName..' Set Point').idx..'&nvalue=0&svalue='..domoticz.variables('Heating_Target_Off_'..RoomName).value)
                --domoticz.notify('Heating',RoomName..' heating OFF') 
            end
		end

        -- If we get a Temperature or Set Point update then run the RoomTemp function
		if (item.name == RoomName..' Temp' or item.name == RoomName..' Set Point') then
            if (domoticz.devices(RoomName..' Temp').state < domoticz.devices(RoomName..' Set Point').state) then
                -- only call for heat if it was not already called for
                if (domoticz.variables('Heating_Call_'..RoomName).value == 0) then
                    domoticz.variables('Heating_Call_'..RoomName).set(1)
                    domoticz.variables('Heating_Call_TOTAL').set(domoticz.variables('Heating_Call_TOTAL').value + 1)
                    domoticz.notify('Heating - Call ON - '..RoomName,'Temp is '..domoticz.devices(RoomName..' Temp').state..', Set Point is '..domoticz.devices(RoomName..' Set Point').state..' (last updated '..domoticz.devices(RoomName..' Temp').lastUpdate.minutesAgo..' mins ago)')
                end
            -- Otherwise room temp must be warmer than or same as set point
            else
                -- Only proceed to do anything if we were already calling for heating
                if (domoticz.variables('Heating_Call_'..RoomName).value == 1) then
                    -- remove this heating call from the total, which will trigger the script to run again and check for boiler state
                    domoticz.variables('Heating_Call_TOTAL').set(domoticz.variables('Heating_Call_TOTAL').value - 1)
               		domoticz.variables('Heating_Call_'..RoomName).set(0)
               		domoticz.notify('Heating - Call OFF - '..RoomName,'Temp is '..domoticz.devices(RoomName..' Temp').state..', Set Point is '..domoticz.devices(RoomName..' Set Point').state..' (last updated '..domoticz.devices(RoomName..' Temp').lastUpdate.minutesAgo..' mins ago)')
               	end
            end
	    end
	-- ### HALL END ###

	end
}

The log file is:
Spoiler: show

### PREVIOUS HALL TEMPERATURE UPDATE ###
2018-11-12 23:24:17.691 (ZWave) Temp (Hall Temp)
2018-11-12 23:24:17.704 (ZWave) General/Thermostat Mode (Thermostat Mode)
2018-11-12 23:24:18.302 Status: dzVents: Info: Handling events for: "Hall Temp", value: "16.5"
2018-11-12 23:24:18.303 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Hall Temp (ZWave)", Index: 241
2018-11-12 23:24:18.313 Status: dzVents: Info: ------ Finished HeatingTest

### SWITCH HALL HEATING VIRTUAL SWITCH TO ON ###
2018-11-12 23:30:00.354 (Virtual Switches) Light/Switch (Heating Hall)
2018-11-12 23:30:00.308 Status: User: admin initiated a switch command (305/Heating Hall/On)
2018-11-12 23:30:00.883 Status: dzVents: Info: Handling events for: "Heating Hall", value: "On"
2018-11-12 23:30:00.884 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Heating Hall (Virtual Switches)", Index: 305
2018-11-12 23:30:00.894 Status: dzVents: Info: ------ Finished HeatingTest
2018-11-12 23:30:01.640 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2018-11-12 23:30:02.561 Sending SetPoint to device....

### SCRIPT TRIGGERED HALL SET POINT UPDATE ###
2018-11-12 23:30:04.255 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "13.5"
2018-11-12 23:30:04.255 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-12 23:30:04.268 Status: dzVents: Info: ------ Finished HeatingTest

### ????????? ###
2018-11-12 23:30:47.116 Status: EventSystem: reset all events...
2018-11-12 23:30:47.147 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/Washing Machine.lua
2018-11-12 23:30:47.148 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/Heating.lua
2018-11-12 23:30:47.149 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/Tumble Dryer.lua
2018-11-12 23:30:47.150 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/Dining Room Light.lua
2018-11-12 23:30:47.151 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/Testing.lua
2018-11-12 23:30:47.152 Status: dzVents: Write file: /usr/local/domoticz/var/scripts/dzVents/generated_scripts/HeatingTest.lua

### SWITCH HALL HEATING VIRTUAL SWITCH TO ON ###
2018-11-12 23:30:54.382 (Virtual Switches) Light/Switch (Heating Hall)
2018-11-12 23:30:54.963 Sending SetPoint to device....
2018-11-12 23:30:54.312 Status: User: admin initiated a switch command (305/Heating Hall/Off)
2018-11-12 23:30:54.675 Status: dzVents: Info: Handling events for: "Heating Hall", value: "Off"
2018-11-12 23:30:54.675 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Heating Hall (Virtual Switches)", Index: 305
2018-11-12 23:30:54.682 Status: dzVents: Info: ------ Finished HeatingTest
2018-11-12 23:30:54.929 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua

### SCRIPT TRIGGERED HALL SET POINT UPDATE ###
2018-11-12 23:30:55.221 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "12.5"
2018-11-12 23:30:55.221 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-12 23:30:55.226 Status: dzVents: Info: ------ Finished HeatingTest

### NEXT HALL TEMPERATURE UPDATE ###
2018-11-12 23:32:23.040 (ZWave) Temp (Hall Temp)
2018-11-12 23:32:23.053 (ZWave) General/Thermostat Mode (Thermostat Mode)
2018-11-12 23:32:23.076 (ZWave) Thermostat (Hall Set Point)
2018-11-12 23:32:23.324 Status: dzVents: Info: Handling events for: "Hall Temp", value: "16.5"
2018-11-12 23:32:23.324 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Hall Temp (ZWave)", Index: 241
2018-11-12 23:32:23.327 Status: dzVents: Info: ------ Finished HeatingTest

### ALSO COMING ALONG WITH THE TEMPERATURE UPDATE IS A SET POINT UPDATE - BACK TO THE OLD VALUE ###
2018-11-12 23:32:23.857 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "20.00"
2018-11-12 23:32:23.857 Status: dzVents: Info: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-12 23:32:23.865 Status: dzVents: Info: ------ Finished HeatingTest
Remember, if I set the setpoint manually, either on the web interface, Set Point timer, Domoticz App or via ImperiHome (via MyDomoAtHome) then it updates correctly and stays!

User avatar
waaren
Posts: 1332
Joined: Tuesday 03 January 2017 15:18
Target OS: Raspberry Pi
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Set points re-setting

Post by waaren » Wednesday 14 November 2018 12:14

ChrisKerswell wrote:
Tuesday 13 November 2018 1:44
Remember, if I set the setpoint manually, either on the web interface, Set Point timer, Domoticz App or via ImperiHome (via MyDomoAtHome) then it updates correctly and stays!
Hi Chris,
if you change

Code: Select all

},

	execute = function(domoticz, item)
to

Code: Select all

	},
		logging =   {       level   =   domoticz.LOG_DEBUG,
                                    marker  =   "roomControl" },
	
	execute = function(domoticz, item)
You might see some additional information on what happens when dzVents execute your script.
Can you also show us what the value of domoticz.devices(TRV device IDX).state is for the TRV devices after the various methods of updating ? And please note that dzVents will only see the new values after the script finished, so you need another script to see the updated values.
If they are the same it might be something in the way the hardware code updates the Zwave TRV devices.
Raspberry (debian stretch via berryboot on Synology DS916+) , Domoticz (almost) latest Beta, , dzVents 2.6, RFLink, RFXtrx433e, P1, Youless, Harmony, Hue, Yeelight, Xiaomi, HomeWizard, Zwave, Amazon echo

ChrisKerswell
Posts: 9
Joined: Sunday 17 December 2017 4:05
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: Set points re-setting

Post by ChrisKerswell » Thursday 15 November 2018 0:41

Log after additional debug lines added to start of script and additional state value reads:
Spoiler: show
### GET INITIAL STATE VALUE ###
2018-11-14 22:23:05.628 Status: User: admin initiated a switch command (337/Test Switch/On)
2018-11-14 22:23:05.904 Status: dzVents: Info: Handling events for: "Test Switch", value: "On"
2018-11-14 22:23:05.904 Status: dzVents: Info: ------ Start internal script: Testing: Device: "Test Switch (Virtual Switches)", Index: 337
2018-11-14 22:23:05.905 Status: dzVents: Info: Test Script Started
2018-11-14 22:23:05.910 Status: dzVents: Info: domoticz.devices(238).state = 13.00
2018-11-14 22:23:05.910 Status: dzVents: Info: Test Script Complete
2018-11-14 22:23:05.910 Status: dzVents: Info: ------ Finished Testing

### UPDATE SETPOINT VIA SCRIPT (JSON COMMAND) ###
2018-11-14 22:23:13.136 Status: User: admin initiated a switch command (305/Heating Hall/Off)
2018-11-14 22:23:13.736 Status: dzVents: Info: Handling events for: "Heating Hall", value: "Off"
2018-11-14 22:23:13.736 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Heating Hall (Virtual Switches)", Index: 305
2018-11-14 22:23:13.746 Status: dzVents: Debug: roomControl: Processing device-adapter for Hall Set Point: Thermostat setpoint device adapter
2018-11-14 22:23:13.748 Status: dzVents: Debug: roomControl: OpenURL: url = http://127.0.0.1:9080/json.htm?type=com ... value=12.5
2018-11-14 22:23:13.749 Status: dzVents: Debug: roomControl: OpenURL: method = GET
2018-11-14 22:23:13.749 Status: dzVents: Debug: roomControl: OpenURL: post data = nil
2018-11-14 22:23:13.755 Status: dzVents: Debug: roomControl: OpenURL: headers = nil
2018-11-14 22:23:13.756 Status: dzVents: Debug: roomControl: OpenURL: callback = nil
2018-11-14 22:23:13.756 Status: dzVents: Info: roomControl: ------ Finished HeatingTest
2018-11-14 22:23:14.341 Sending SetPoint to device....
2018-11-14 22:23:14.288 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2018-11-14 22:23:14.929 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "12.5"
2018-11-14 22:23:14.929 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-14 22:23:14.937 Status: dzVents: Debug: roomControl: Processing device-adapter for Hall Temp: Temperature device adapter
2018-11-14 22:23:14.938 Status: dzVents: Info: roomControl: ------ Finished HeatingTest
2018-11-14 22:23:14.939 Status: dzVents: Info: Handling events for: "Hall Temp", value: "16.5"
2018-11-14 22:23:14.939 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Hall Temp (ZWave)", Index: 241
2018-11-14 22:23:14.939 Status: dzVents: Info: roomControl: ------ Finished HeatingTest

### CHECK STATE VALUE ###
2018-11-14 22:24:48.507 Status: User: admin initiated a switch command (337/Test Switch/On)
2018-11-14 22:24:48.785 Status: dzVents: Info: Handling events for: "Test Switch", value: "On"
2018-11-14 22:24:48.785 Status: dzVents: Info: ------ Start internal script: Testing: Device: "Test Switch (Virtual Switches)", Index: 337
2018-11-14 22:24:48.785 Status: dzVents: Info: Test Script Started
2018-11-14 22:24:48.789 Status: dzVents: Info: domoticz.devices(238).state = 12.5
2018-11-14 22:24:48.789 Status: dzVents: Info: Test Script Complete
2018-11-14 22:24:48.789 Status: dzVents: Info: ------ Finished Testing

### CHECK STATE VALUE AGAIN ###
2018-11-14 22:26:50.573 (Virtual Switches) Light/Switch (Test Switch)
2018-11-14 22:26:50.558 Status: User: admin initiated a switch command (337/Test Switch/On)
2018-11-14 22:26:50.838 Status: dzVents: Info: Handling events for: "Test Switch", value: "On"
2018-11-14 22:26:50.838 Status: dzVents: Info: ------ Start internal script: Testing: Device: "Test Switch (Virtual Switches)", Index: 337
2018-11-14 22:26:50.838 Status: dzVents: Info: Test Script Started
2018-11-14 22:26:50.840 Status: dzVents: Info: domoticz.devices(238).state = 12.5
2018-11-14 22:26:50.841 Status: dzVents: Info: Test Script Complete
2018-11-14 22:26:50.841 Status: dzVents: Info: ------ Finished Testing

### TEMP/SETPOINT UPDATE RECEIVED FROM TRV - RESETS SETPOINT TO PREVIOUS VALUE ###
2018-11-14 22:27:14.576 (ZWave) Thermostat (Hall Set Point)
2018-11-14 22:27:14.818 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "13.00"
2018-11-14 22:27:14.818 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-14 22:27:14.821 Status: dzVents: Debug: roomControl: Processing device-adapter for Hall Temp: Temperature device adapter
2018-11-14 22:27:14.822 Status: dzVents: Info: roomControl: ------ Finished HeatingTest

### CHECK STATE VALUE - UPDATED TO PREVIOUS VALUE ###
2018-11-14 22:27:53.717 (Virtual Switches) Light/Switch (Test Switch)
2018-11-14 22:27:53.699 Status: User: admin initiated a switch command (337/Test Switch/Off)
2018-11-14 22:27:53.972 Status: dzVents: Info: Handling events for: "Test Switch", value: "Off"
2018-11-14 22:27:53.972 Status: dzVents: Info: ------ Start internal script: Testing: Device: "Test Switch (Virtual Switches)", Index: 337
2018-11-14 22:27:53.972 Status: dzVents: Info: Test Script Started
2018-11-14 22:27:53.975 Status: dzVents: Info: domoticz.devices(238).state = 13.00
2018-11-14 22:27:53.975 Status: dzVents: Info: Test Script Complete
2018-11-14 22:27:53.975 Status: dzVents: Info: ------ Finished Testing

### MANUALLY UPDATE VIA DOMOTICZ APP TO 18.0 ###
2018-11-14 22:29:13.521 Sending SetPoint to device....
2018-11-14 22:29:14.154 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2018-11-14 22:29:14.201 Status: Set UserVariable Heating_Call_Hall = 1
2018-11-14 22:29:14.203 Status: Set UserVariable Heating_Call_TOTAL = 2

### CHECK STATE VALUE - UPDATED TO 18.0 ###
2018-11-14 22:30:23.877 Status: dzVents: Info: domoticz.devices(238).state = 18.0
2018-11-14 22:30:23.877 Status: dzVents: Info: Test Script Complete
2018-11-14 22:30:23.877 Status: dzVents: Info: ------ Finished Testing
2018-11-14 22:30:24.328 Status: EventSystem: Script event triggered: /usr/local/domoticz/dzVents/runtime/dzVents.lua
2018-11-14 22:30:24.340 Status: Notification: Variable Search after if
2018-11-14 22:30:26.023 Notification sent (email) => Success
2018-11-14 22:30:26.099 Notification sent (gcm) => Success
2018-11-14 22:30:26.740 Status: Notification sent (Email)

### TEMP/STATE UPDATE FROM TRV KEEPS NEW STATE VALUE ###
2018-11-14 22:31:18.574 (ZWave) Thermostat (Hall Set Point)
2018-11-14 22:31:18.825 Status: dzVents: Info: Handling events for: "Hall Temp", value: "16.5"
2018-11-14 22:31:18.825 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Hall Temp (ZWave)", Index: 241
2018-11-14 22:31:18.829 Status: dzVents: Debug: roomControl: Processing device-adapter for Hall Set Point: Thermostat setpoint device adapter
2018-11-14 22:31:18.831 Status: dzVents: Info: roomControl: ------ Finished HeatingTest
2018-11-14 22:31:19.356 Status: dzVents: Info: Handling events for: "Hall Set Point", value: "18.00"
2018-11-14 22:31:19.356 Status: dzVents: Info: roomControl: ------ Start internal script: HeatingTest: Device: "Hall Set Point (ZWave)", Index: 238
2018-11-14 22:31:19.361 Status: dzVents: Debug: roomControl: Processing device-adapter for Hall Temp: Temperature device adapter
2018-11-14 22:31:19.363 Status: dzVents: Info: roomControl: ------ Finished HeatingTest

### CHECK STATE VALUE - STILL CORRECT ###
2018-11-14 22:32:19.093 (Virtual Switches) Light/Switch (Test Switch)
2018-11-14 22:32:19.071 Status: User: admin initiated a switch command (337/Test Switch/Off)
2018-11-14 22:32:19.625 Status: dzVents: Info: Handling events for: "Test Switch", value: "Off"
2018-11-14 22:32:19.635 Status: dzVents: Info: ------ Start internal script: Testing: Device: "Test Switch (Virtual Switches)", Index: 337
2018-11-14 22:32:19.636 Status: dzVents: Info: Test Script Started
2018-11-14 22:32:19.639 Status: dzVents: Info: domoticz.devices(238).state = 18.00
2018-11-14 22:32:19.639 Status: dzVents: Info: Test Script Complete
2018-11-14 22:32:19.639 Status: dzVents: Info: ------ Finished Testing
It's like the update via JSON does not get pushed out to ZWave, whereas the manual update does...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest