Welcome to Smart Home Forum by FIBARO
Dear Guest,
as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.
As a member you can:
- Start new topics and reply to others
- Follow topics and users to get email updates
- Get your own profile page and make new friends
- Send personal messages
- ... and learn a lot about our system!
Regards,
Smart Home Forum by FIBARO Team
Question
snowflakes 0
Hi,
HC2 Scene:
--[[
%% properties
%% events
%% globals
--]]
local deviceWallPlug = 200
local currentStateOfWallPlug
fibaro:debug("Initial state of WallPlug")
currentStateOfWallPlug = fibaro:get(deviceWallPlug, 'value')
fibaro:debug("currentStateOfWallPlug: " .. currentStateOfWallPlug)
fibaro:debug("Turn On")
fibaro:call(deviceWallPlug, 'turnOn')
currentStateOfWallPlug = fibaro:get(deviceWallPlug, 'value')
fibaro:debug("currentStateOfWallPlug: " .. currentStateOfWallPlug)
fibaro:sleep(2 * 1000)
fibaro:debug("Turn Off")
fibaro:call(deviceWallPlug, 'turnOff')
currentStateOfWallPlug = fibaro:get(deviceWallPlug, 'value')
fibaro:debug("currentStateOfWallPlug: " .. currentStateOfWallPlug)
Actual output:
[DEBUG] 22:54:08: Initial state of WallPlug
[DEBUG] 22:54:08: currentStateOfWallPlug: 0
[DEBUG] 22:54:08: Turn On
[DEBUG] 22:54:08: currentStateOfWallPlug: 0
[DEBUG] 22:54:10: Turn Off
[DEBUG] 22:54:10: currentStateOfWallPlug: 1
Expected output:
[DEBUG] 22:54:08: Initial state of WallPlug
[DEBUG] 22:54:08: currentStateOfWallPlug: 0
[DEBUG] 22:54:08: Turn On
[DEBUG] 22:54:08: currentStateOfWallPlug: 1
[DEBUG] 22:54:10: Turn Off
[DEBUG] 22:54:10: currentStateOfWallPlug: 0
Why is this? It seems to be returning its previous value.
Can someone please explain?
Edited by snowflakes10 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.