state attribute and battery level evohome devices [SOLVED]
Moderator: leecollings
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
state attribute and battery level evohome devices
I just did a fresh install on a rasberry pi and went to the last beta version of domoticz 4.11388
I connected my evohome system with the HGI80.
Now my scripts are not running anymore because the .state attribute has a value nil. The .active attribute does work for a HR92, but not for an extra relay i binded.
I did check the values with the <device>.dump() method and there i see the _state field is correctly filled.
I also don't see the battery levels anymore
Greetz Bert
I connected my evohome system with the HGI80.
Now my scripts are not running anymore because the .state attribute has a value nil. The .active attribute does work for a HR92, but not for an extra relay i binded.
I did check the values with the <device>.dump() method and there i see the _state field is correctly filled.
I also don't see the battery levels anymore
Greetz Bert
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: state attribute and battery level evohome devices
What was the version before this in which your scripts did work ?
Can you please enable debug logging in the script and share the logfile ?
Can you please share the script that is no longer working ?
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices
Thanks for reacting so quicly.
I don't know the exact beta version anymore, but i updated the last time in the beginning of july 2019.
I had to do a fresh install because my SD card was corrupt.
Tonight i will provide you the information you asked for.
I don't know the exact beta version anymore, but i updated the last time in the beginning of july 2019.
I had to do a fresh install because my SD card was corrupt.
Tonight i will provide you the information you asked for.
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices
I did enable the logfile, can you tell me where i can find the log-file so i can share this?
Greetz Bert
Greetz Bert
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: state attribute and battery level evohome devices
You can find the location of the logfile in the same file where you enabled it.
look in /etc/init.d/domoticz.sh
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices
Hereby i send you the files you asked for
The first results are with the line ...device.state... enabled
Script file: Script_1.txt
Logfile : domoticz_1.lua.txt
domoticzData.lua.txt
In the second test i disabled the line ...device.state...
Script file Script_2.lua.txt
Logfile : domoticz_2.txt
I also tried ...device.active... , this always gives False
Remark: I had to add .txt to the lua file, otherwise i couldn't attach them
The last two file i put in a separete post
Greetz Bert
The first results are with the line ...device.state... enabled
Script file: Script_1.txt
Logfile : domoticz_1.lua.txt
domoticzData.lua.txt
In the second test i disabled the line ...device.state...
Script file Script_2.lua.txt
Logfile : domoticz_2.txt
I also tried ...device.active... , this always gives False
Remark: I had to add .txt to the lua file, otherwise i couldn't attach them
The last two file i put in a separete post
Greetz Bert
- Attachments
-
- Script_1.lua.txt
- (778 Bytes) Downloaded 186 times
-
- domoticzData.lua.txt
- (14.48 KiB) Downloaded 130 times
-
- domoticz_1.txt
- (43.68 KiB) Downloaded 122 times
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices
Herby the last two attachments.
- Attachments
-
- Script_2.lua.txt
- (786 Bytes) Downloaded 177 times
-
- domoticz_2.txt
- (34.45 KiB) Downloaded 121 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: state attribute and battery level evohome devices
Can you please test below modified evohome device adapter and report your findings ?
Code: Select all
cp <domoticz dir>/dzVents/runtime/device-adapters/evohome_device.lua <domoticz dir>/dzVents/runtime/device-adapters/evohome_device.luaKeep
Can you explain in a bit more detail what you mean with his ? domoticz only reports a valid battery-level for device 'Woonkamer (V)'I also don't see the battery levels anymore
Code: Select all
local TimedCommand = require('TimedCommand')
return {
baseType = 'device',
name = 'Evohome device adapter',
matches = function (device, adapterManager)
local res = (
device.hardwareTypeValue == 39 or
device.hardwareTypeValue == 40 or
device.hardwareTypeValue == 106 or
device.hardwareTypeValue == 75
)
if (not res) then
adapterManager.addDummyMethod(device, 'updateSetPoint')
adapterManager.addDummyMethod(device, 'setHotWater')
adapterManager.addDummyMethod(device, 'setMode')
end
return res
end,
process = function (device, data, domoticz, utils, adapterManager)
if device.deviceSubType == "Hot Water" then
if device.rawData[2] == "On" then device.state = "On" else device.state = "Off" end
device.mode = tostring(device.rawData[3] or "n/a")
device.untilDate = tostring(device.rawData[4] or "n/a")
function device.setHotWater(state, mode, untilDate)
if mode == 'TemporaryOverride' and untilDate then
mode = mode .. "&until=" .. untilDate
end
local url = domoticz.settings['Domoticz url'] ..
"/json.htm?type=setused&idx=" .. device.id ..
"&setpoint=&state=" .. state ..
"&mode=" .. mode ..
"&used=true"
return domoticz.openURL(url)
end
elseif device.deviceSubType == "Relay" then
if device._state == "On" then
device.state = "On"
device.active = true
else
device.state = "Off"
device.active = false
end
else
device.state = device.rawData[2]
device.setPoint = tonumber(device.rawData[1] or 0)
device.mode = tostring(device.rawData[3])
device.untilDate = tostring(device.rawData[4] or "n/a")
function device.updateSetPoint(setPoint, mode, untilDate)
return TimedCommand(domoticz,
'SetSetPoint:' .. tostring(device.id),
tostring(setPoint) .. '#' ..
tostring(mode) .. '#' ..
tostring(untilDate) , 'setpoint')
end
function device.setMode(mode, dParm, action, ooc)
local function checkTimeAndReturnISO(tm)
local now = domoticz.time
local iso8601Pattern = "(%d+)-(%d+)-(%d+)T(%d+):(%d+):(%d+)Z"
local iso8601Format = "%Y-%m-%dT%TZ"
local function inFuture(tmISO)
local function makeFutureISOTime(str, hours)
local xyear, xmonth, xday, xhour, xminute, xseconds = str:match(iso8601Pattern)
local seconds = os.time({year = xyear, month = xmonth, day = xday, hour = xhour, min = xminute, sec = xseconds})
local offset = (seconds + ( hours or 0 ) * 3600)
return os.date(iso8601Format,offset), offset
end
local _, epoch = makeFutureISOTime(tmISO)
return epoch >= now.dDate and tmISO
end
if type(tm) == 'string' and tm:find(iso8601Pattern) then return inFuture(tm) end -- Something like '2016-04-29T06:32:58Z'
if type(tm) == 'table' and tm.getISO then return inFuture(tm.getISO()) end -- a dzVents time object
if type(tm) == 'table' and tm.day then return inFuture(os.date(iso8601Format,os.time(tm))) end -- a standard time object
if type(tm) == 'number' and tm > now.dDate then return inFuture(os.date(iso8601Format,tm)) end -- seconds since epoch
if type(tm) == 'number' and tm > 0 and tm < ( 365 * 24 * 60 ) then return inFuture(os.date(iso8601Format,now.dDate + ( tm * 60 ))) end -- seconds since epoch + tm
domoticz.log('dParm ' .. tostring(dParm) .. ' cannot be processed. (it will be ignored)',utils.LOG_ERROR)
return false -- not a time as we know it
end
local function isValid(mode)
for _, value in pairs(domoticz) do
local res = type(value) == 'string' and value == mode
if res then return res end
end
return mode == 'Busted' or false
end
local function binary(num, default)
if num == 0 or num == 1 then return num else return default end
end
if isValid( tostring(mode) ) then -- is it in the list of valid modes ?
local dParm = dParm and checkTimeAndReturnISO(dParm) -- if there is a dParm then check if valid and make a valid ISO date
dParm = ( dParm and '&until=' .. dParm ) or ''
local action = ( action and '&action=' .. binary(action, 1) ) or '&action=1'
local ooc = ( ooc and '&ooc=' .. binary(ooc, 0) ) or '&ooc=0'
local url = domoticz.settings['Domoticz url'] ..
'/json.htm?type=command¶m=switchmodal&idx=' .. device.id ..
"&status=" .. mode ..
dParm ..
action ..
ooc
return domoticz.openURL(url)
else
utils.log('Unknown status for setMode requested: ' .. tostring(mode),utils.LOG_ERROR)
end
end
end
end
}
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices
I changed the evohome_device.lua file like you asked.
Now i can use the attibute state again.
There is still one strange thing the relay "Schuur (P)".
If i manually change the state on the physical device, then no event is triggered.
So the device attributes are not correct.
I bound the relay 'Schuur (P)' in the 'Hardware tab' with the 'Bind Relay' (See attachment).
About the batterylevel:
In the old environment all the evohome zone devices and some of the Relay devices showed the batterylevel in the devices tab.
Now only one zone device shows the batterylevel ( See attachments )
Greetz Bert
Now i can use the attibute state again.
There is still one strange thing the relay "Schuur (P)".
If i manually change the state on the physical device, then no event is triggered.
So the device attributes are not correct.
I bound the relay 'Schuur (P)' in the 'Hardware tab' with the 'Bind Relay' (See attachment).
About the batterylevel:
In the old environment all the evohome zone devices and some of the Relay devices showed the batterylevel in the devices tab.
Now only one zone device shows the batterylevel ( See attachments )
Greetz Bert
- Attachments
-
- Evohome zone devices.png (40.3 KiB) Viewed 6050 times
-
- Evohome hardware.png (14.35 KiB) Viewed 6050 times
-
- Evohome devices old instance.png (115.73 KiB) Viewed 6050 times
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: state attribute and battery level evohome devices
Will push the fix of the evohome device adapter to the next BetaBertvdw wrote: ↑Tuesday 29 October 2019 23:11 I changed the evohome_device.lua file like you asked. Now i can use the attibute state again.
If i manually change the state on the physical device, then no event is triggered.
In the old environment all the evohome zone devices and some of the Relay devices showed the batterylevel in the devices tab.
I have no clue on the relay stuf. Maybe one of the other forum members can help.
Reported the battery issue on Github. Hopefully someone can shed some light on this.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 19
- Joined: Sunday 08 October 2017 23:39
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: state attribute and battery level evohome devices [SOLVED]
Thank you so far for your help.
Gr. Bert
Gr. Bert
Who is online
Users browsing this forum: No registered users and 0 guests