Xiaomi Aqara stuff Works Natively

copy it with a watch to another variable is safe. something like this should be enough for Vera to show the icon:

function updateBatteryInfo(dev_id, service, variable, oldValue, newValue)
	if tonumber(oldValue) ~= tonumber(newValue) then
		luup.variable_set("urn:micasaverde-com:serviceId:HaDevice1", "BatteryLevel", newValue, dev_id)
	end
end

luup.variable_watch("updateBatteryInfo", "urn:micasaverde-com:serviceId:ZigbeeDevice1", "PowerSourceLevel", dev_id)

dev_id is the device ID. Add to your startup code and you should be good.

1 Like