Skip to content

Use advanced logic through JavaScript in Homey

License

Notifications You must be signed in to change notification settings

Dijker/jslogic-homey

 
 

Repository files navigation

JavaScript Style Guide

JavaScript Logic

Give Homey the possibility to use JavaScript logic through flow cards

Actions

  • Get formatted date - Adds the formatted date to the global tag 'Formatted date'

Conditions:

  • Check if specified value is equal to one of the values in an array
  • Check if specified value contains one of the values in an array
  • Check if specified value is empty
  • Check if specified value length is less than specified number
  • Check if specified date is before date
  • Check if specified time is before time
  • Check if specified date/time is before date/time
  • Random (true|false)
  • Date number is (between|not between)
  • Month is (between|not between)
  • Date number and Month is (between|not between)
  • Check if weekday is equal to one of the given weekdays
  • Number(value1) is (between|not between) value2 and value3

Triggers

  • Date and month becomes - Triggers when the current date changes to the chosen date and month (00:00)

Case sensitivity

In the following conditions you can choose to use case sensitivity or not:

  • Value contains one of...

  • Is value exactly one of...

    Case sensitive

    Value and array will be treated as is

    Not case sensitive

    Value and array will both be lowercased

Changelog

  • 1.4.2
    • Dependency updates
  • 1.4.1
    • Fixed some typos
  • 1.4.0
    • New condition Number (is|is not) between
    • Removed sentry cause it weren't used
  • 1.3.3
    • Dependency updates
  • 1.3.2
    • Dependency updates
  • 1.3.1
    • Dependency updates
  • 1.3.0
    • Chore: No need to return value in Promise.resolve
    • Chore: Possible to not always pass timezone or date
    • New trigger: Date and month becomes
      • Added tests
  • 1.2.3
    • Dependency updates
  • 1.2.2
    • Dependency updates
  • 1.2.1
    • Better naming for condition 'Is value exactly (one of|not one of)...'
  • 1.2.0
    • New condition: 'Is "weekday" (one of|not one of)...'
  • 1.1.1
    • Pulled flow logic out into they're own files
    • Bugfixes
    • Added tests all around so new versions is stable with (hopefully) no bugs
  • 1.1.0
    • Dependency updates
    • New condition: 'Day and month is (between|not between)'
    • Using timezone to prevent any possible bugs since SDK3 runs on UTC..
    • Bugfix: Convert month numbers to Number to prevent any logic check bugs
  • 1.0.0
    • Dependency updates
    • Updated to SDKv3. App now requires Homey firmware >= 5.0.0. Those with Homey firmware < 5.0.0 will still have v0.2.0 (unless user uninstalls 0.2.0, then 1.0.0 is they're only option)
  • 0.2.0
  • 0.1.2
    • Enhancement: Sentry property update
  • 0.1.1
    • Added sentry
  • 0.1.0
    • Added condition 'Random (true|false)'
    • Added global tag 'Formatted date' to hold the date formatted from action 'Get formatted date'
    • Added action 'Get formatted date' where yoy can choose day by number and what format to get in. This will set the result in the global tag 'Formatted date'
  • 0.0.5
    • Cleanup
    • Bugfix: Norwegian title on trigger 'Is value length less than' fixed to correct wording
  • 0.0.4
  • 0.0.3
    • Added condition 'Is Date before Date' to check if a Date occurs before another Date
    • Added condition 'Is Time before Time' to check if one Time occurs before another Time
    • Added condition 'Is DateTime before DateTime' to check if a DateTime occurs before another DateTime
  • 0.0.2
    • Added 'Is value length less than' condition
  • 0.0.1
    • Initial version

Local development

  1. git clone [email protected]:runely/jslogic-homey.git
  2. npm i
  3. Create a env.json file with this content:
    {
        "SENTRY_DSN": "SENTRY_DNS_CLIENT_KEY",
        "SENTRY_TRACE_SAMPLE_RATE": "0",
        "SENTRY_ENV": "production"
    }
  4. npm run homey-run or npm run homey-install

Thanks

About

Use advanced logic through JavaScript in Homey

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%