Jump to content

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


  • 3

[SCENE] Main scene FTBE v1.3.4


Sankotronic

Question

Main scene FTBE v 1.3.4

 

Hello everyone!

 

NEW version is OUT!

 

More about scene and download you can find here:

 

WHAT'S NEW:

 

  • Main scene FTBE 1.3.4 - changed function for time of day calculation and added use of SleepState global to set time of day to morning when Awake  regardless of current time
  • Main scene FTBE 1.3.0 - cleaned some bugs, added some more checks to prevent scene from stop running due to errors. Optimized and compacted code, removed unnecessary comments. DemoMode only stops changing timers while user code and scheduled events will continue to execute. Darkness can now be changed by measured lux level or global variable that is set to lux value measured by light measuring devices placed outside. Scene is now running on setTimeout function instead on sleep for better timing and also aligns to 0 seconds or exact minute.
  • Sunrise & Sunset VD v1.4.0 - Modified main loop code to better handle global variables. Variables are now automatically repaired and are not reset to default settings after HC2 reboot. Added variable SunriseIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically.
  • Home Status VD v1.1 - Added variable HomeStatIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically. Added label that shows most important values on VD when closed.
  • Home Timers VD v1.1 - Added variable HomeTimersIcon to store VD icon ID and now when main icon for VD is set also all button icons are set automatically. Added label that shows most important values on VD when closed.

 

 

Please login or register to see this attachment.

 

 

NOTE - This version is compatible with previous versions so need to do any changes in your current code of other scenes and VD's.

 

REQUEST - If you like my work and found it useful please give me support by rating and writing short review. Thank you! :-)

 

PS

Dear friends from Slovakia you can find this scene and VD translated to your language here: 

Please login or register to see this link.

 

 

Edited by Sankotronic
Updated to new version
  • Like 16
  • Thanks 6
Link to comment
Share on other sites

Recommended Posts

  • 0
  • Inquirer
  • Hi @AutoFrank,

     

    Thank you for your kind words and I'm very happy that you find this scene valuable for your system. If you have any questions or suggestions please come forward. I also use @cag014 solution for devices and scenes ID and I can't thank him enough for that great idea which already save me a great deal of time!

    Link to comment
    Share on other sites

    • 0
    13 minutes ago, Sankotronic said:

    Hi @AutoFrank,

     

    Thank you for your kind words and I'm very happy that you find this scene valuable for your system. If you have any questions or suggestions please come forward. I also use @cag014 solution for devices and scenes ID and I can't thank him enough for that great idea which already save me a great deal of time!

     

    no worries....

    one of my next challenges is weather and I was very interested in the weather announcement in your story

     

    I don't have Netatmo (yet) and was looking for something to get me started.

    Could your weather Status help (btw, the link in your signature doesn't work)

     

    thx

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 3 minutes ago, AutoFrank said:

     

    no worries....

    one of my next challenges is weather and I was very interested in the weather announcement in your story

     

    I don't have Netatmo (yet) and was looking for something to get me started.

    Could your weather Status help (btw, the link in your signature doesn't work)

     

    thx

     

     

    Hi, @AutoFrank,

     

    I posted Weather status VD around 20 hours ago and is still waiting for forum administrator to approve and make it public. I send message to mr. @T.Konopka half hour ago that it will be nice to approve this solution. I posted two versions, one is standalone that can work without Netatmo weather station or with weather station with indoor and outdoor modules only. Another solution consists of three VD and two scenes and supports Netatmo weather station with rain and wind sensors. I found openweathermap.org as very accurate source for weather status and forecast and is really simple to use with very good instructions for their API so I hope that I will in time also make VD that can show 5 day weather forecast.

     

    Since I take care that VD do most of the job with global variables and you already use Darkness it should be very easy installation.

    Link to comment
    Share on other sites

    • 0
    1 minute ago, Sankotronic said:

    Hi, @AutoFrank,

     

    I posted Weather status VD around 20 hours ago and is still waiting for forum administrator to approve and make it public. I send message to mr. @T.Konopka half hour ago that it will be nice to approve this solution. I posted two versions, one is standalone that can work without Netatmo weather station or with weather station with indoor and outdoor modules only. Another solution consists of three VD and two scenes and supports Netatmo weather station with rain and wind sensors. I found openweathermap.org as very accurate source for weather status and forecast and is really simple to use with very good instructions for their API so I hope that I will in time also make VD that can show 5 day weather forecast.

     

    Since I take care that VD do most of the job with global variables and you already use Darkness it should be very easy installation.

     

    Thanks 

    I'll await the approval process, sound like what I want.

    Which one do you use for your weather TTS ?

     

    Link to comment
    Share on other sites

    • 0
    1 minute ago, AutoFrank said:

     

    Thanks 

    I'll await the approval process, sound like what I want.

    Which one do you use for your weather TTS ?

     

     

    and do you think the outdoor Netatmo worth the money

    I was looking at the native zwave popp device as well...

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 8 minutes ago, AutoFrank said:

     

    and do you think the outdoor Netatmo worth the money

    I was looking at the native zwave popp device as well...

     

    @AutoFrank,

     

    I have Complete Netatmo set (indoor, outdoor, rain & wind) and I'm really happy with it. Since it updates every 5 to 10 minutes it is not good enough for summer sudden rain showers and closing windows but it is reliable and can be used for many other ways of integration. My TTS weather report is on the list to be posted here but before I do that I want to make it more simple and user friendly because at the moment is complete mess even to me :)

    Link to comment
    Share on other sites

    • 0
    3 minutes ago, Sankotronic said:

    @AutoFrank,

     

    I have Complete Netatmo set (indoor, outdoor, rain & wind) and I'm really happy with it. Since it updates every 5 to 10 minutes it is not good enough for summer sudden rain showers and closing windows but it is reliable and can be used for many other ways of integration. My TTS weather report is on the list to be posted here but before I do that I want to make it more simple and user friendly because at the moment is complete mess even to me :)

     

    thanks

    I'm okay with the TTS part as I have jishi's api up and running

    it more the source of the "weather text" I'm interested in ...

     

     

     

    Link to comment
    Share on other sites

    • 0

    Hi,

     

    I'm trying to install this scene but I'm facing different problems.

     

    I've installed first VD Sunrise and sunset, then created LUA scene and pasted code. First debug output was "Line 74 - #1 to match (string expected, got nil) - Reading the forum I've understood that the two following lines had to be deleted

     

    -- get the table from global if NOT using then DELETE BELLOW LINE!!!
    local jT           = json.decode(fibaro:getGlobalValue("HomeTable"));

     

    Done that, debug output was: line 178 attempt to index global JT

     

    So I've deleted all JT.users reported in this line, moving from this

     

    local userID        = {jT.users.admin, jT.users.zoran, jT.users.marina, jT.users.tina};

     

    to this

     

    local userID        = {};

     

    Then, similar error with line 183

     

    local iosDeviceID   = {jT.ios.zoran, jT.ios.marina};

     

    So I've changed into this:

     

    local iosDeviceID   = {};

     

    Then ok, but debug reports this error: line 822, attempt to concatenate a nil value, and line 822 is the following:

     

    " TimeOfDay: " .. fibaro:getGlobalValue(timeOfDay)) end

     

    What I've to do now?

     

    Thanks for your help!

     

    Giovanni

     

     

     

     

     

    Link to comment
    Share on other sites

    • 0
    8 minutes ago, viga81 said:

    Hi,

     

    I'm trying to install this scene but I'm facing different problems.

     

    I've installed first VD Sunrise and sunset, then created LUA scene and pasted code. First debug output was "Line 74 - #1 to match (string expected, got nil) - Reading the forum I've understood that the two following lines had to be deleted

     

    -- get the table from global if NOT using then DELETE BELLOW LINE!!!
    local jT           = json.decode(fibaro:getGlobalValue("HomeTable"));

     

    Done that, debug output was: line 178 attempt to index global JT

     

    So I've deleted all JT.users reported in this line, moving from this

     

    local userID        = {jT.users.admin, jT.users.zoran, jT.users.marina, jT.users.tina};

     

    to this

     

    local userID        = {};

     

    Then, similar error with line 183

     

    local iosDeviceID   = {jT.ios.zoran, jT.ios.marina};

     

    So I've changed into this:

     

    local iosDeviceID   = {};

     

    Then ok, but debug reports this error: line 822, attempt to concatenate a nil value, and line 822 is the following:

     

    " TimeOfDay: " .. fibaro:getGlobalValue(timeOfDay)) end

     

    What I've to do now?

     

    Thanks for your help!

     

    Giovanni

     

     

     

     

     

     

    In addition, after some minutes values of global variables like MarginDay, MarginNight etc seem to lose "decimal", e.g. MarginDay becomes equal to 2, instead of being 2:00. So the scene stops working properly....

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hello @viga81,

     

    Sorry for the trouble with jT part, I forget to delete from scene before posting. Now I updated code to be clean from my remains and tested it OK.

    Error on line 822 is because one of the variables is missing value due to MarginDay, MarginNight, etc loosing proper value. As it was already discussed here in this thread this will happen if you press SAVE button in variable panel. After that they get messed up. I will try to add some code to check that mess but Fibaro make it difficult to solve that problem. Also this mess that came out after pressing SAVE in variable panel is bug form Fibaro side.

     

    Only way to clean that mess with global variables is to delete them and then go to Sunrise & Sunset VD open advanced tab and press SAVE button there so that global variables are generated again with default values. You can check that global vars are properly generated by pressing button Debug under Main loop code window. Please just make sure that you downloaded latest version of Sunrise & Sunset VD so that all variables are generated. In last version v1.2 I added two more global variables Latitude and Longitude and last version of Main scene v1.2.3 need this variables to work properly.

     

    So please after regenerating global variables do NOT press SAVE button in global variables panel or you will make mess again. If you need to test how scene works then please download other two virtual devices Home Status and Timers and use them to change value of the global variables. Don't do that in global variable panel. This is not only problem with this VD, there are many other nice virtual devices that have same problem with messed variables after pressing SAVE button in variables panel.

    Link to comment
    Share on other sites

    • 0
    18 minutes ago, Sankotronic said:

    Hello @viga81,

     

    Sorry for the trouble with jT part, I forget to delete from scene before posting. Now I updated code to be clean from my remains and tested it OK.

    Error on line 822 is because one of the variables is missing value due to MarginDay, MarginNight, etc loosing proper value. As it was already discussed here in this thread this will happen if you press SAVE button in variable panel. After that they get messed up. I will try to add some code to check that mess but Fibaro make it difficult to solve that problem. Also this mess that came out after pressing SAVE in variable panel is bug form Fibaro side.

     

    Only way to clean that mess with global variables is to delete them and then go to Sunrise & Sunset VD open advanced tab and press SAVE button there so that global variables are generated again with default values. You can check that global vars are properly generated by pressing button Debug under Main loop code window. Please just make sure that you downloaded latest version of Sunrise & Sunset VD so that all variables are generated. In last version v1.2 I added two more global variables Latitude and Longitude and last version of Main scene v1.2.3 need this variables to work properly.

     

    So please after regenerating global variables do NOT press SAVE button in global variables panel or you will make mess again. If you need to test how scene works then please download other two virtual devices Home Status and Timers and use them to change value of the global variables. Don't do that in global variable panel. This is not only problem with this VD, there are many other nice virtual devices that have same problem with messed variables after pressing SAVE button in variables panel.

    Hi,

     

    thanks for your prompt reply! I've done what you suggested and now it seems everything ok, except VD Home Status, in which "Present State", "House State" and "Guest mode" are not updated - I've created related predefined variables (GuestState, PresentState etc) but don't know what I'm doing wrong....are there more detailed instructions on how to configure this VD?

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 1 minute ago, viga81 said:

    Hi,

     

    thanks for your prompt reply! I've done what you suggested and now it seems everything ok, except VD Home Status, in which "Present State", "House State" and "Guest mode" are not updated - I've created related predefined variables (GuestState, PresentState etc) but don't know what I'm doing wrong....are there more detailed instructions on how to configure this VD?

     

     

     

    @viga81

     

    I didn't write anything special about configuring Home State and Timers. But it is simple code so all you need to do is open advanced tab and in code for each button and main loop just check names of global variables and value mapping and correct to your values. After that it should work.

     

    Link to comment
    Share on other sites

    • 0
    11 minutes ago, viga81 said:

    Hi,

     

    thanks for your prompt reply! I've done what you suggested and now it seems everything ok, except VD Home Status, in which "Present State", "House State" and "Guest mode" are not updated - I've created related predefined variables (GuestState, PresentState etc) but don't know what I'm doing wrong....are there more detailed instructions on how to configure this VD?

     

     

     

     

    From debug of VD Home Status, the problem seems to be in line 19 - attempt to concatenate global value (a nil value).

     

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 9 minutes ago, viga81 said:

     

    From debug of VD Home Status, the problem seems to be in line 19 - attempt to concatenate global value (a nil value).

     

     

     

    I believe you are talking about Main loop code line 19? Just put comment (two dashes --) in front of the lines that point to global variables that you don't have yet.

    Link to comment
    Share on other sites

    • 0
    29 minutes ago, Sankotronic said:

    I believe you are talking about Main loop code line 19? Just put comment (two dashes --) in front of the lines that point to global variables that you don't have yet.

     

     

    Everything is now ok after proper global variable definition.

     

    Thanks a lot!

     

    Giovanni

     

    Link to comment
    Share on other sites

    • 0

    Hi Sankotronic

     

    I'm having an issue with your script. This is my code section:

     

    -- SCHEDULED VD SETUP ---------------------------------------------------
    -- here you can setup VDs that will be executed at predefined time of
    -- day in format "00:00". You can set up more than one time during day.
    -- Also you can enter flag for each day of the week when VD will be
    -- executed or not. See more details bellow.
    -- enter VD IDs that will run at scheduled time separated by comma.
    local runVDSchedID       = {337,354,354};
    -- enter here which button to press to execute command
    local runVDSchedButton   = {1,1,2};
    -- enter at what time of day will VD button be pressed separated by comma.
    -- You can define more than one time in format "00:00" for one VD
    -- or even use local or global variables like sunsettime or sunrisetime
    -- Example: {{"13:30", "19:20"}, {sunrisetime, "13:00", sunsettime}}
    -- in above example first VD button will be pressed at 13:30 and 19:20
    -- while second VDs button will be pressed at sunrisetime, 13:00 and
    -- at sunsettime
    local runVDSchedHour     = {"09:00","20:25","02:00"};
    -- enter here flag for each day of the week for VD to press button
    -- at above scheduled time. if flag 1 the VD button will be pressed and
    -- if flag 0 then will not be pressed for that day. Remeber, Sunday is
    -- first day of the week on HC2! Example for two VDs:
    -- {{1, 0, 0, 0, 0, 0, 0}, {0, 1, 1, 1, 1, 1, 0}} - in this example
    -- first VDs button will be pressed only on Sunday, and second VDs
    -- button will be pressed on weekdays but not on weekends (Saturday
    -- and Sunday).
    local runVDSchedWeek     = {{1,0,0,0,0,0,0,},{1,1,1,1,1,1,1,},{1,1,1,1,1,1,1,}};
    -- enter here flag for sending push message when VD buttons is pressed
    -- 1 for sending message, 0 no messages
    local runVDSchedPushFlag = {0,0,0};
    -- enter here message content that will be sent to you when VD is
    -- executed. If above flag is 0 for any of the VDs then just put
    -- empty "" for it.
    local runVDSchedPushMessage = {"","",""};

     

    Have I set this up right , it seems very straight forward but clearly I am doing something wrong.

     

    I want to press button 1 on VD 354 at 20:25 and button 2 on the same VD at 02:00 - doesn't seem to work and if I set the exDebug option to True I get:

     

    [DEBUG] 20:32:22: Main scene for time events version 1.2.3 - © 2016 Sankotronic
    [DEBUG] 20:32:23: Day time: 12:51, Night time: 22:23, Time to raise blinds: 18:51
    [DEBUG] 20:32:23: [email protected] distance from home is: 44.237808360094 meters
    [DEBUG] 20:32:23: Jane distance from home is: 53.836099366527 meters
    [DEBUG] 20:32:23: Time of day set to: Evening - Day of week is Thursday
    [DEBUG] 20:32:23: Season is Winter, Month is December
    [DEBUG] 20:32:23: Scheduled VD Battery Status Report weekday flag is: 0
    [DEBUG] 20:32:23: Scheduled VD Outside Light Control weekday flag is: 1
    [DEBUG] 20:32:23: line 651: attempt to concatenate field '?' (a nil value)

     
     
    I can't see any values I have missed. If I comment out part of line as I can't figure out which value is missing I get
     
    [DEBUG] 20:44:55: Season is Winter, Month is December
    [DEBUG] 20:44:55: Scheduled VD Battery Status Report weekday flag is: 0
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control weekday flag is: 1
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control weekday flag is: 1
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Scheduled VD Outside Light Control
    [DEBUG] 20:44:55: Darkness: 1 Sunset: 15:54 (set:16:23) Sunrise: 08:21 (set:07:51) TimeOfDay: Evening
     
     
    Can you advise what I am doing wrong

     

     

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Hi @andyp and @virgojavier,

     

    I checked your code and both of you have same mistake with setting up runVDSchedHour 

    So @andyp your line should look like this:

    Please login or register to see this code.

    Braces are used to define multiple scheduled times for each VD so for example if you want first VD with ID 337 to run at two different times at 9:00h and also at 19:00 then your line would look like this:

    Please login or register to see this code.

    @virgojavier your line should look like this:

    Please login or register to see this code.

    Same explanation is for you too. Even if you have only one VD to be started at only one time like 20:00 you have to put double braces so that scene can recognize that time belongs to first VD as bellow:

    Please login or register to see this code.

     

    Enjoy coding! :) 

     

     

    Link to comment
    Share on other sites

    • 0

    Hi Sankotronic

     

    Thanks for the prompt reply. The script now runs, didn't think the VD was working at first but then figured the first button is not necessarily id 1.

     

    Great work by the way, I think I need to play a lot more to code scripts to your standard. Follow your postings with great interest. Even the ones I don't use help me learn more every day.

     

    Andy

    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • 10 minutes ago, andyp said:

    Hi Sankotronic

     

    Thanks for the prompt reply. The script now runs, didn't think the VD was working at first but then figured the first button is not necessarily id 1.

     

    Great work by the way, I think I need to play a lot more to code scripts to your standard. Follow your postings with great interest. Even the ones I don't use help me learn more every day.

     

    Andy

     

    To find out number of button you have to count all objects on VD (labels, sliders, buttons) from top to bottom and from left to right until the one you want to press. VD for Holiday lights has one label and one button, label is first so button number is 2. See bellow example:

    Please login or register to see this attachment.

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...