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


HC3 QuickApps coding - tips and tricks


jgab

Recommended Posts

57 minutes ago, jgab said:

You have to look if someone have done a HC3 QA for openweather. It's nothing that I'm using myself.

grabing information from com.fibaro.weather IMHO is common solution instead of getting info from any QA

Edited by 10der
Link to comment
Share on other sites

Thanks, but you are much smarter in this kind off stuff as me.

I have no clue how to finalize this

Can you write the rule to retrieve clouds in all various discriptions, Flushing is my town?

Thanks in advance,

//Sjakie

Link to comment
Share on other sites

1 hour ago, jgab said:

You have to look if someone have done a HC3 QA for openweather.


@Sjakie You do use the quickapp from @irekk ?

 

Please login or register to see this link.

 

Edited by SmartHomeEddy
Link to comment
Share on other sites

On 10/25/2020 at 12:41 PM, jgab said:

A new version of. ChildrenOfHue. v1.14.

 

Please login or register to see this attachment.

It's a "simple" QA that relies on the QuickAppChildren to realise the Hue devices.

This means that the user interfaces are limited to what are supported by the child app classes.

Supported Hue device classes:

 

ZLLSwitch.

Hue switch with 4 buttons. Creates centralSceneEvents similar to a Fibaro keyFob (com.fibaro.remoteController)

The interpretation is

     keyId = hueKeyValue // 1000

     keyAttribute = ({"Pressed","HeldDown","Released","Released"})[hueKeyValue % 1000 +1]

It also supports setValue('value',value) to simulate a key press.

 

ZLLTemperature.

Hue temperature sensor. Behaves like a standard fibaro.com.temperatureSensor.

 

ZLLLightLevel.

Hue light sensor. Behaves like a standard fibaro.com.lightSensor.

The device quickAppVariables  'daylight' and 'dark' is updated with resp. Hue attribute.

 

ZLLPresence

Hue presence sensor. Behaves like a standard fibaro.com.motionSensor.

 

Extended color light

Hue RGB light. Behaves like a fibaro.com.philipsHueLight.

supports:

fibaro.call(<id>,"turnOn")

fibaro.call(<id>,"turnOff")

fibaro.call(<id>,"toggle")

fibaro.call(<id>,"setValue",value)                   -- dim value 0..100

   If the value is a table the value is sent directly to the Hue light as a Hue property table. 

  Ex. fibaro.call(<id>,"setValue",{effect='colorloop',bri=50})

        fibaro.call(<id>,"setValue",{startup={customsettings={xy={0.73500005089041,0.26499994910959}}}})

fibaro.call(<id>,"setColor",red, green,blue).  -- color 0..255

fibaro.call(<id>,"changeBrightness")             -- brightness 0..255

fibaro.call(<id>,"changeHue")                        -- 0..65535

fibaro.call(<id>,"changeSaturation")              -- 0..255

fibaro.call(<id>,"startLevelIncrease")

fibaro.call(<id>,"startLevelDecrease")

fibaro.call(<id>,"stopLevelChange")

fibaro.call(<id>,"toggleDim",<boolean>) -- Toggle dim direction. true with 'stop'

The device quickAppVariable  'state' is updated with the Hue state

 

Dimmable light

Hue dimmable white light. Behaves like a fibaro.com.multilevelSwitch.

supports:

fibaro.call(<id>,"turnOn")

fibaro.call(<id>,"turnOff")

fibaro.call(<id>,"toggle")

fibaro.call(<id>,"setValue",value)                   --- dim value 0..100

   If the value is a table the value is sent directly to the Hue light as a Hue property table. 

fibaro.call(<id>,"changeBrightness")             -- brightness 0..255

fibaro.call(<id>,"startLevelIncrease")

fibaro.call(<id>,"startLevelDecrease")

fibaro.call(<id>,"stopLevelChange")

fibaro.call(<id>,"toggleDim",<boolean>) -- Toggle dim direction. true with 'stop'

The device quickAppVariable  'state' is updated with the Hue state

 

Color temperature light

Mapped as a Dimmable light

 

Color light

Hue color light. Behaves like a fibaro.com.colorController.

supports:

fibaro.call(<id>,"turnOn")

fibaro.call(<id>,"turnOff")

fibaro.call(<id>,"toggle")

fibaro.call(<id>,"setValue",value)                   --- dim value 0..100

   If the value is a table the value is sent directly to the Hue light as a Hue property table. 

fibaro.call(<id>,"setColor",red, green,blue).  -- color 0..255

fibaro.call(<id>,"changeBrightness")             -- brightness 0..255

fibaro.call(<id>,"startLevelIncrease")

fibaro.call(<id>,"startLevelDecrease")

fibaro.call(<id>,"stopLevelChange")

The device quickAppVariable  'state' is updated with the Hue state

fibaro.call(<id>,"toggleDim",<boolean>) -- Toggle dim direction. true with 'stop'

 

Room

Hue light group. 

Behaves like a fibaro.com.multilevelSwitch.

fibaro.call(<id>,"turnOn")

fibaro.call(<id>,"turnOff")

fibaro.call(<id>,"toggle")

fibaro.call(<id>,"setValue",value)                   --- dim value 0..100

   If the value is a table the value is sent directly to the Hue group as a Hue property table. 

fibaro.call(<id>,"changeBrightness")             -- brightness 0..255

fibaro.call(<id>,"startLevelIncrease")

fibaro.call(<id>,"startLevelDecrease")

fibaro.call(<id>,"stopLevelChange")

fibaro.call(<id>,"setScene",<Hue scene ID or scene name>)

fibaro.call(<id>,"toggleDim",<boolean>) -- Toggle dim direction. true with 'stop'

 

Hue CLIPS devices

CLIPPresence          => com.fibaro.motionSensor          class='ZLLPresence'
CLIPTemperature.   => com.fibaro.temperatureSensor class='ZLLTemperature'
CLIPPressure           => com.fibaro.binarySwitch           class='BinarySwitch'
CLIPHumidity           => com.fibaro.humiditySensor.      class='Humidity'
CLIPOpenClose.      => com.fibaro.binarySensor.          class='BinarySensor'

 

 

The startLevelIncrease, startLevelDecrease, and stopLevelChange makes it possible to bind a remote controller that support centralSceneEvent to dim when a button is held down and stop dimming when the button is released.

 

The lights store their Hue values in a quickAppVariable 'state'.

This can be retrieved like below and ex. used to set default startup values for Hue lights...

Please login or register to see this code.

 

v 1.1 - Fixed bug with ZLLSwitch

v 1.4 - better startLevelIncrease & friends

v 1.5 - fix for color light

v 1.7 - New dim approach

v 1.9 - Support Zones (same as Groups)

v 1.10 - start dim up with brightness=1

v 1.11 - setValue > 0 turns on light

v 1.12 - startDimLevel

v 1.14 - startDimLevel -> toggleDim

Hi Jan

 

Can you check if you have same behavior in Children of HUE v1.14?

When I turn off a zone or a group - with Pressed (toggle command)

It turn off fine. The next toggle dont work - So i cant to turn on.

Though a Pressed2 ('setValue',99) turn on the zone/group again.

 

Single bulb works fine with toggle, both for turn on and turn off.

 

matrix_bar_bund is also in the code, but not showed here

 

Please login or register to see this code.

 

 

 

Edited by ChristianSogaard
P
Link to comment
Share on other sites

Jan,

This morning no curtain opening.

I did  first @09:00 nothing happend>> backup HC3 than:

             Rule.eval([[@09:08 =>   post(#morningCurtain);            log('TRIGGER:%s',tjson(env.event)); log('Januari Sensor lux Voor- AchterTuin #morningCurtain 30/20 - remote')      ]]
Nothing in debug
All time rule are not in debug or executed
Ships I am almost finished with moving all from HC2>>>HC3,
What can I do?
Please advice,
//Sjakie
Link to comment
Share on other sites

Restart didt help

Back up from yesterday is functioning, hehehe, should now set QA for QA back to see who caused it, if its caused by a QA?

 

Link to comment
Share on other sites

Jan,

Just to inform:

I guess a glitch in HC3 after restore back up and put all newer QA's in time rules are functioning again.

Weird disruption.

 

Link to comment
Share on other sites

Jan, 

I have the QA for OWMbut I cant get it in ER4.

The OWM id clouds = 772 it will give a value in % (as shown is the Child device)

I cant find any example how to retrieve the value in this tread, or did i over looked it?

Please advice,

Thanks in advance

//Sjakie

Link to comment
Share on other sites

8 minutes ago, jgab said:

It should work if you do 

Please login or register to see this code.

'towel_dryer' should be accessible inside the rule.

Note that it has to be a Lua global. You can't declare it local

local towel_dryer = matrix_badV + 5 -- Will not work!

 

You could also create a rule variables

Please login or register to see this code.

towel_dryer and matrix_badV is only accessible inside rules and not visible to outside Lua code.

 

20 hours ago, ChristianSogaard said:

Hi Jan

 

Can you check if you have same behavior in Children of HUE v1.14?

When I turn off a zone or a group - with Pressed (toggle command)

It turn off fine. The next toggle dont work - So i cant to turn on.

Though a Pressed2 ('setValue',99) turn on the zone/group again.

 

Single bulb works fine with toggle, both for turn on and turn off.

 

matrix_bar_bund is also in the code, but not showed here

 

Please login or register to see this code.

 

 

 

Hi Jan - I did some more testing on this - and i have same issue in all my zones. - not sure to provide additional information on this. All triggers are ok ... and send to COH

Link to comment
Share on other sites

Jan,

version 5.050.13

is there a limmit on the number off QA's?

HC3 skip time rules again and now it doest work after restore back to this afternoon.

Switch off and after 1 min on result the same

Block scene works.

Anything else I can try? >>>>> I dont want to go back to HC2 now

//Sjakie

 

 

Please login or register to see this attachment.

Link to comment
Share on other sites

2 hours ago, Sjakie said:

Jan,

version 5.050.13

is there a limmit on the number off QA's?

HC3 skip time rules again and now it doest work after restore back to this afternoon.

Switch off and after 1 min on result the same

Block scene works.

Anything else I can try? >>>>> I dont want to go back to HC2 now

//Sjakie

 

 

Please login or register to see this attachment.

I had the same issue when some rules wont work at all - try comment out last changed rule. or your first rule

Link to comment
Share on other sites

  • Topic Author
  • 7 minutes ago, ChristianSogaard said:

    I had the same issue when some rules wont work at all - try comment out last changed rule. or your first rule

     

    If a rule throws an error the rule is disabled and the rule needs. to be fixed and the QA restarted (saved again).

    Other rules should still work.

    If you have an example where you get an error and everything in ER4 stops to work, can you try to capture the error being logged? - because then I can fix it.

    Link to comment
    Share on other sites

    8 minutes ago, jgab said:

     

    If a rule throws an error the rule is disabled and the rule needs. to be fixed and the QA restarted (saved again).

    Other rules should still work.

    If you have an example where you get an error and everything in ER4 stops to work, can you try to capture the error being logged? - because then I can fix it.

     

    Adding this rules

    Please login or register to see this code.

    stops EV4 from evaluating - its most sure my own mistake. let me look a little more into this, and see which rookie mistakes i made this time ?

     

    Please login or register to see this attachment.

     

     

    Link to comment
    Share on other sites

    Jan,

    If I have a error due to not added device (device still in HC2) must I comment it out?

    As far as I can see in some QA's it does run after saving it shows as last line:

     

    [true]>>'Rule:1[@{catch,05:00} => Util.checkForUpdates()]'

     

    I asume all is well.

    //Sjakie

    Link to comment
    Share on other sites

  • Topic Author
  • 6 hours ago, Sjakie said:

    Jan,

    If I have a error due to not added device (device still in HC2) must I comment it out?

    As far as I can see in some QA's it does run after saving it shows as last line:

     

    [true]>>'Rule:1[@{catch,05:00} => Util.checkForUpdates()]'

     

    I asume all is well.

    //Sjakie

    Under normal circumstances it should juts disable that specific rule. SO it should work.

    Link to comment
    Share on other sites

  • Topic Author
  • 18 hours ago, ChristianSogaard said:

     

    Hi Jan - I did some more testing on this - and i have same issue in all my zones. - not sure to provide additional information on this. All triggers are ok ... and send to COH

    Ok, I have verified that there is something strange with the zone/group and childrenOfHue.

    I will look into it...

    • Thanks 1
    Link to comment
    Share on other sites

    a question about SetColor.

    I created this rule - Winsensors is sensative strips guard - and Ledlights are LEDs in the Logic Group Matrix.

    The native command for Matrix change color for is is

    Please login or register to see this code.

     

    In this example LEDLights - are the two lower LED in the Matrix.

    So Change Color in Matrix when window breached.

    Change

    I dont think the trigger is working

    I see a event link this

    Incoming trigger:{"id":296,"type":"device","value":1609858822,"old":1609858786,"property":"lastBreached"}

     

    But i dont see the rule is running.

     

    Please login or register to see this code.

     

    this run is a scene works

    fibaro.call(1002,"setColor",0,64,0,0);
    Edited by ChristianSogaard
    p
    Link to comment
    Share on other sites

    2 hours ago, ChristianSogaard said:

    a question about SetColor.

    I created this rule - Winsensors is sensative strips guard - and Ledlights are LEDs in the Logic Group Matrix.

    The native command for Matrix change color for is is

    Please login or register to see this code.

     

    In this example LEDLights - are the two lower LED in the Matrix.

    So Change Color in Matrix when window breached.

    Change

    I dont think the trigger is working

    I see a event link this

    Incoming trigger:{"id":296,"type":"device","value":1609858822,"old":1609858786,"property":"lastBreached"}

     

    But i dont see the rule is running.

     

    Please login or register to see this code.

     

    this run is a scene works

    fibaro.call(1002,"setColor",0,64,0,0);

    I got it - it was the list - that was formattet wrong

    This works

    Please login or register to see this code.

     

     

    Link to comment
    Share on other sites

    Jan,

    Is there a limmit on the number off rules in a QA?

    At this moment my max is 160 rules. If I want to create Groundfloor it will add another 80 rules.

    Other thing, is it workable so manny rules?

    I know just try and see the result but also curious about the limmit.

    Thanks for theadvice,

    //Sjakie

    Link to comment
    Share on other sites

    On 1/5/2021 at 11:23 AM, jgab said:

    Ok, I have verified that there is something strange with the zone/group and childrenOfHue.

    I will look into it...

    Hi Jan

    Thank you for your work with COH.

    Another Group thing - HUE has a Group for ALL light in the house. I dont see that being populated when syncing groups.

    I would like that group for ALARM purpose to be able to flash the light when Alarm is triggered.

    Br Chr

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