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


Recommended Posts

  • Topic Author
  • Posted
    21 hours ago, ChristianSogaard said:

    Please login or register to see this code.

    Hi Jan - a small update...

    im still getting Crash for the ASK function, if nothing is answered at the Phone

     

    rule([[HouseIsEmpty & ask(PeopleMap[LastPerson].phone,'Vil du aktivere alarm?', 'Tryk yes at aktivere alarm?', 10) => 
        log('Ask Lastperson to ARM '++LastPerson);
        log('PeopleMap[LastPerson]. '++PeopleMap[LastPerson].phone);
        1:tryArm
    ]])

     

    Ok, I will look into this. The previous fix was not satisfactory as I couldn't understand why it worked... 😕 

    • Thanks 1
    Posted (edited)
    21 hours ago, ChristianSogaard said:

    [Partly SOLVED - but still have double trigger]
    I get a secondary trigger with Epoch time - can i Filter that out?

     

    Please login or register to see this code.



    Value was an fload and not a string ;-) changed from %s to %f
     

    var.value = ""
    var.initGas = 9678
    rule("#device{id=2046, value='$value'} => log('Gasmåling .... %.2f',initGas+(value/100)) ")

     

    21 hours ago, ChristianSogaard said:

    How do i create my own trigger ??

     

    I have a GAS meter im reading consumption from a pulse counter

    Please login or register to see this attachment.

    .

    Using Swagger i see my Data is stored in properties.parameters.value 

     

     

    Please login or register to see this spoiler.

     

     

    Please login or register to see this code.

     

    Edited by ChristianSogaard
    Typo
    Posted
    17 hours ago, jgab said:

     

    Ok, that's interesting because if I edit your qa and save it, it will not generate a ghost for me. I had to really abuse it with QAUpdater before I got a ghost.

    I actually suspected that saving the QA from the editor could also causes ghosts because I assume the editor and QAUpdater use the same APIs to save the QA files.

    That would also explain issues that people had in the past with other QAs.

     

    So, there could be a couple of reason (and maybe combined)

    So, a QA that has a lot of active timers and outstanding http requests could have issues if code is replaced and being forced to restart.

    That's why I'm now disabling the QA before updating because then no timers or http requests are active when the files are updated.

     

    I'm not sure what to do in your case. Try to slim down the QA by removing unnecessary QA files (I saw that some of them only had commented code lines)

    May disable the QA before editing it and then enable it using the web ui?

     

     

    Jan, i want to correct myself a bit. It is not generating ghost processes on every save, it generates only after the firts save, so i will have always two paralell processings. So i reproduced it like this: 

    1. HC3 restarted

    2. Checked ER5 and there were no ghosts

    3. Made some changes to the ER5 QA, and saved it

    4. One ghost proccess appeared

    5. Made another change in QA and saved,

    6. Still only that one ghosts presented.

    So it remains on 2 processes paralell. I will test it on other problematic systems too. This result is on one problematic system.

    It is quite hard for me to make tests on customers systems, as every time a save the edited QA it creates a ghost, so i have to restart HC3, and that is what i cant do nowodays, becuase all families are at home, it is not the right time to restart their systems. 

  • Topic Author
  • Posted
    1 hour ago, Neo Andersson said:

    Jan, i want to correct myself a bit. It is not generating ghost processes on every save, it generates only after the firts save, so i will have always two paralell processings. So i reproduced it like this: 

    1. HC3 restarted

    2. Checked ER5 and there were no ghosts

    3. Made some changes to the ER5 QA, and saved it

    4. One ghost proccess appeared

    5. Made another change in QA and saved,

    6. Still only that one ghosts presented.

    So it remains on 2 processes paralell. I will test it on other problematic systems too. This result is on one problematic system.

    It is quite hard for me to make tests on customers systems, as every time a save the edited QA it creates a ghost, so i have to restart HC3, and that is what i cant do nowodays, becuase all families are at home, it is not the right time to restart their systems. 

    Yes, I suspect it can be partly the system that causes it. It's also consistent with the random errors others have had with their systems. Maybe it would be worthwhile to contact fibaro support and let them log into the system to see the problem...

    Posted
    2 hours ago, jgab said:

    Yes, I suspect it can be partly the system that causes it. It's also consistent with the random errors others have had with their systems. Maybe it would be worthwhile to contact fibaro support and let them log into the system to see the problem...

    @jgab @A.Socha @m.roszak Jan, i tagged some Fibaro members to this problem, so i don't know how deeply are they familiar with this entire topic. Maybe a short question for them would be worth a try, but i don't know how to formulate the question to be understandable for them. I bet one of these guys would give us some support. I don't know if telling them, that paralell processes are created would be enough for them to understand what is going on.  Would be ?

  • Topic Author
  • Posted
    On 12/22/2023 at 3:26 PM, ChristianSogaard said:

    How do i create my own trigger ??

     

    I have a GAS meter im reading consumption from a pulse counter

    Please login or register to see this attachment.

    .

    Using Swagger i see my Data is stored in properties.parameters.value 

     

     

    So, I see the 182 (or rather 183) stored in the properties.value, not properties.parameters.value

    Access to the 183 value is just 

    rule("2046:value")

     

    There is no trigger that picks up changes to properties.parameters.value...

    In fact, there is no properties.parameters.value, properties.parameters is a table so there is ex.

    properties.parameters[1].value for parameter with id=9.

    But, there is no triggers for them.

     

    On 12/22/2023 at 3:26 PM, ChristianSogaard said:

     

    Please login or register to see this code.

    But here, i never gets a trigger

     

    Here I get the trigger, but no Value

    rule("#device{id=2046, value='$value'} =>  log('Gasmåling .... trigger fra ',value) ")

     

     

    The 2 rules triggers on the same event. If 2046's property value changes.

    Please login or register to see this code.

     

     

    Btw, device 2046 has a parent 2032. Maybe the values you are after is stored in that device?

    Posted
    1 hour ago, jgab said:

     

    So, I see the 182 (or rather 183) stored in the properties.value, not properties.parameters.value

    Access to the 183 value is just 

    rule("2046:value")

     

    There is no trigger that picks up changes to properties.parameters.value...

    In fact, there is no properties.parameters.value, properties.parameters is a table so there is ex.

    properties.parameters[1].value for parameter with id=9.

    But, there is no triggers for them.

     

     

    The 2 rules triggers on the same event. If 2046's property value changes.

    Please login or register to see this code.

     

     

    Btw, device 2046 has a parent 2032. Maybe the values you are after is stored in that device?

     

    Thank you Jan, and merry Christmas 

    This is working.

    This is filtering out the double trigger with EPOC time

    Please login or register to see this code.

     

    I learned a little about LUA formatting.  

    Because "value" not was a string - the "Gasmåling %s" didnt show anything

    So i started using %d instead, but this stopped working when dividing with 100 so i %.2f gave me two decimals :)

     

    So below have a working trigger, filtering out the EPOC and syncs the GAS meter data with the pulses from the

    Please login or register to see this link.

    Please login or register to see this code.

     

  • Topic Author
  • Posted
    19 minutes ago, ChristianSogaard said:

     

    Thank you Jan, and merry Christmas 

    This is working.

    This is filtering out the double trigger with EPOC time

    Please login or register to see this code.

     

    I learned a little about LUA formatting.  

    Because "value" not was a string - the "Gasmåling %s" didnt show anything

    So i started using %d instead, but this stopped working when dividing with 100 so i %.2f gave me two decimals :)

     

    So below have a working trigger, filtering out the EPOC and syncs the GAS meter data with the pulses from the

    Please login or register to see this link.

    Please login or register to see this code.

     

    But %s should. In Lua %s will call tostring() on the value and then print it out - so it kind of works with everything - but you don't have much control over the format.

    %d will complain if it's not an integer. %f will complain if it's not an integer or float.

     

    This should also work

    Please login or register to see this code.

     

    Posted
    10 minutes ago, jgab said:

    But %s should. In Lua %s will call tostring() on the value and then print it out - so it kind of works with everything - but you don't have much control over the format.

    %d will complain if it's not an integer. %f will complain if it's not an integer or float.

     

    This should also work

    Please login or register to see this code.

     

    Yes i works  - and thank you for showing the 2046:value at the Action side - I didnt know or i forgot ;-) 

    Posted (edited)

    Jan do you have a description how I work with Childs ?

    This creates the Child for me, but the dont update the Child?

    Please login or register to see this code.

     

     

     

    Edited by ChristianSogaard
    Typo
  • Topic Author
  • Posted
    8 minutes ago, ChristianSogaard said:

    Jan do you have a description how I work with Childs ?

    This creates the Child for me, but the dont update the Child?

    Please login or register to see this code.

     

     

     

    Please login or register to see this code.

     

    The deviceID of the created child is assigned <ID>_D

    ID1_D in this case.

    It's a multilevelSensor so you can set the value immediately with :value =

    A multilevelSensor typically takes a value between 0 and 100.

    Should it be initGas+(2046:value/100) ?

     

    Posted (edited)
    3 hours ago, jgab said:

     

     

    Please login or register to see this code.

     

    The deviceID of the created child is assigned <ID>_D

    ID1_D in this case.

    It's a multilevelSensor so you can set the value immediately with :value =

    A multilevelSensor typically takes a value between 0 and 100.

    Should it be initGas+(2046:value/100) ?

     

    Thank you Jan

    Not sure why i get this one ?

    [24.12.2023] [14:49:39] [ERROR] [ER2059]: [Rule:1:3]>> [Rule:1:2046:value < 16030080 => ID1_D:value = initGas+(2046:value/100)] Runtime: nil is not a valid device

     

    Changed ID name to GAS while testing , but the error keeps the same

    rule("2046:value < 16030080  => GAS_D:value = initGas+(2046:value/100) ")

     

    Please login or register to see this attachment.

     

    I tried shorten it down for test

    Please login or register to see this code.

    but get same error 

    Runtime: nil is not a valid device

     

    Edited by ChristianSogaard
    Typo
  • Topic Author
  • Posted (edited)
    19 hours ago, ChristianSogaard said:

    Thank you Jan

    Not sure why i get this one ?

    [24.12.2023] [14:49:39] [ERROR] [ER2059]: [Rule:1:3]>> [Rule:1:2046:value < 16030080 => ID1_D:value = initGas+(2046:value/100)] Runtime: nil is not a valid device

     

    Changed ID name to GAS while testing , but the error keeps the same

    rule("2046:value < 16030080  => GAS_D:value = initGas+(2046:value/100) ")

     

    Please login or register to see this attachment.

     

    I tried shorten it down for test

    Please login or register to see this code.

    but get same error 

    Runtime: nil is not a valid device

     

    Ok it urned out to be a bit more complex.

    First, the identifier 'ID1_D' is not set to the id of the child device, but to the device structure of the child so

    ID1_D.id:value = ...  would have been right.

    Secondly, a :value = ... uses the device action setValue, but a sensor doesn't have a setValue because sensors in general is expected to get their values from other sources...

     

    So, I addded a new identifier <ID>_ID that is bound to the deviceId of the child. ID1_ID in your case.

    I also added a :prop = {name, value}. function that sets the property with <name> to <value> using updateProperty that works with devices/QAs without setValue

     

    So, with v0.94 that I just pushed you can do

    Please login or register to see this code.

     

    Edited by jgab
    • Like 1
  • Topic Author
  • Posted
    2 minutes ago, ChristianSogaard said:

    Thank You Jan

    i used the QA Updater, v:0.72, (12/25/23 10:02:04) to update EventRunner5, deviceId:2059, version:0.94

     

    Looks like i have a Ghost Running 

     

    And thank you for GAS_ID:prop - it works like a charm

     

    [25.12.2023] [10:33:39] [ERROR] [ER2059]: [Rule:1:1]>> [Rule:1:2046:value < 16030080 => GAS_D:value = initGas+(2046:value/100)] Runtime: nil is not a valid device
    2046:value < 16030080  => GAS_D:value = initGas+(2046:value/100)

    [25.12.2023] [10:33:39] [ERROR] [ER2059]: [Rule:2:1]>> [Rule:2:2046:value < 16030080 => GAS_D:value = 90] Runtime: nil is not a valid device
    2046:value < 16030080  => GAS_D:value = 90

     

    My ruleset looks like -

    and the hardcoded "value = 90" was in the old version.

     

    Something you want me to check before reboot?

     

     

    Please login or register to see this code.

     

     

    Please login or register to see this code.

     

     

    You could download the QA (for backup) and then remove it and verify if the ghost still runs/logs if you want.

    Posted
    2 minutes ago, jgab said:

     

    You could download the QA (for backup) and then remove it and verify if the ghost still runs/logs if you want.

     

    Thank you Jan - I was 100% sure that i had a ghost. i didnt reboot, but pushed a few changes to the rules and now I dont see the extra triggers. So checkling my logs again i seems to have read them wrong :-(

    - i am sorry...

    • Like 1
    Posted (edited)

    Hi Jan

     

    I want to create a table and ADD Gas data into it. - Best would be to subtract the counter from yesterday, to store the day consummation.

    I need a global variable to store the data, right ?

     

    Can i use my own Gas table instead of HTTab ?

    And how can i use Now (or date in this format 2023-12-25 as the Key for the value)?

    Please login or register to see this code.

     

    Or perhaps i should install, an Influx DB and show in Grafana ?

    Edited by ChristianSogaard
    Typo
  • Topic Author
  • Posted (edited)

    Please login or register to see this code.

     

    This will create a fibaro global GasCounter if it doesn't already exist.

    Every night at 23:59:55 it will record date, total consumption and daily consumption.

    The first day you run it, it will only get a total and not a daily.

    GasCounter will be a Lua list with

    { {date = <date>, total=<value>, daily=<value>}, {date = <date>, total=<value>, daily=<value>},...

    sorted so that the most recent date is first in the list.

    If the list exceeds 360 entries it starts to prune the oldest dates from the list.

    Edited by jgab
    • Thanks 1
    Posted
    34 minutes ago, jgab said:

    Please login or register to see this code.

     

    This will create a fibaro global GasCounter if it doesn't already exist.

    Every night at 23:59:55 it will record date, total consumption and daily consumption.

    The first day you run it, it will only get a total and not a daily.

    GasCounter will be a Lua list with

    { {date = <date>, total=<value>, daily=<value>}, {date = <date>, total=<value>, daily=<value>},...

    sorted so that the most recent date is first in the list.

    If the list exceeds 360 entries it starts to prune the oldest dates from the list.

    Thank you Jan for your support and patience with me :-)

  • Topic Author
  • Posted
    1 hour ago, ChristianSogaard said:

    Thank you Jan for your support and patience with me :-)

    No problem, it's like a Sunday morning sudoko to solve these exercises :-)

    Posted
    6 hours ago, jgab said:

    No problem, it's like a Sunday morning sudoko to solve these exercises :-)

    :-) I like Sudoko... 

     

    Would you see this as a morning exercise as well ;-)

    Im using these contacts - you probably already know ;

     

     

    image.png.0f78313c23bcc1d99807b292de67771b.png 

     

    Depending time og day the background light will be Off / week / strong

    Im using rules like $DayControl below to Set the background light

     

    This is my HTTab - and values below are the 4led in each contact.

    I set the HTTab in a scene - below is a small section of the whole HTTab

    Please login or register to see this code.

     

    I use your :color function to set the Background light.

    Please login or register to see this code.

     

    A few of the LED are also used for indication eg. the CO2 level in the living room or if my Alarm is enabled.

    When special setting has been set, how do I add writeprotect for the LED so the special settings wont be overwritten for the $DayControl rules?

    And when Special settings are over, how do i add the right color to the LED based on what $DayControl has gone to ?

    I still want to use the :color so i guess I need a clever way to add and remove the LEDs from the active HTTab ?

     

     

     

     

    Join the conversation

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

    Guest
    Reply to this topic...

    ×   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...