Koppla upp din tvättmaskin till ditt smarta hem

På plats 9 av de bästa smarta funktioner jag har i mitt uppkopplade hem 2020 så hittar vi uppkopplingen av tvättmaskinen för att göra den lite smartare.

Plats 9 i mitt smarta hem

Funktionen handlar om att notifiera oss när tvätten är klar och det är dags att plocka ut den. Och detta för att inte glömma kvar den i maskinen så att den börjar lukta illa och man behöver tvätta om allt igen.

Lösningen är enkel, du kopplar in en smart plugg i tvättmaskinens uttag och sedan gör ett litet script som är nog smart att veta när tvättmaskinen har tvättat klart. När det sker så skickar den ut en push-notis till mobilerna att det är dags att hänga tvätt.

Funktionen är helt automatiskt och man behöver inte göra något när man tvättar, push-notisen kommer alltid göras när tvättmaskinen är klar med ett kört program.

Scriptet är skrivet i LUA och körs i min Home center 2 från Fibaro.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
--[[
%% properties
152 power
%% globals
--]]

local powerId = 152 -- Power outlet ID
local lowPower = 20 -- Lower power level the machine is using in idle
local lowIdleMaxLimit = 10 -- Machine idle power usage
local lowPowerThreshold = 360 -- Seconds since power to idle when to trigger

local powerValue = fibaro:getValue(powerId, "power")
local powerNow = math.floor(powerValue)
local timeNow = os.time()

fibaro:debug("Current power used: " .. powerNow)

if fibaro:getGlobal("WashMRunning") == "0" then

fibaro:debug("Machine is not running")
if powerNow >= 100 then
fibaro:setGlobal("WashMRunning", timeNow)
fibaro:debug("Machine is running, setting state to running")
end

else -- Here we have a machine running loop ..

-- Machine is running
fibaro:debug("The machine is in running state")

-- Machine is running
if powerNow > lowPower then
fibaro:debug("++++++ Washingmachine has power over resting limit. Resetting timer...")
fibaro:setGlobal("WashMRunning", timeNow)
end

if powerNow < lowIdleMaxLimit then
-- Power is low, lets see if its time to notice
fibaro:debug("We are in low power mode on a started machine")
-- Check time since last power update
-- If over limit then send notice
local washRunningValue = fibaro:getGlobal("WashMRunning")

--fibaro:debug(timeNow)
timediff = timeNow - washRunningValue
fibaro:debug("Time diff since going into low power: " .. timediff .. " - Threshold is " .. lowPowerThreshold)

if timediff > lowPowerThreshold then
fibaro:debug("Machine is DONE I think. Time to send notice to wife")
fibaro:setGlobal("WashMRunning", "0")
fibaro:call(226, "sendPush", "Tvätten är klar - Empty, hang, repeat")
fibaro:call(351, "sendPush", "Tvätten är klar - Empty, hang, repeat")
end
else
fibaro:debug("High power detected.")
end

end