[V4] Dev service RFlink

I want to display the 2 fields only if the device feature is a switch

Hello everyone,

I was on an internship since January so I haven’t followed the development. Due to corona, I find myself at home.
I would like to know if rflink will be available soon to migrate and use my 433 relays?

Thanks in advance

The module is functional but I’m still reviewing the UI, I need testers to finish the module

I changed the device creation mode for switches, it looks like this:

The setup tab now displays the last received command:

@pierre-gilles I wanted to know if I have to put a lot of tests for my service or not because I find it long, can I do like for the other services and just test functions events and command?

I’m still looking for testers, if you have an Arduino Mega with Rflink, you can test the 433mhz, the 2.4 Ghz and the Milight in part

Yes, the PR must be fully tested.

I know, it requires a bit more work, but the goal of v4 is to offer users a quality product that is tested and stable. The bar is higher, but it’s to have a maintainable product whose stability is guaranteed in the long term.

Without tests, on an open-source product with multiple contributors, little by little, as developments progress, the quality of the software will degrade, regressions will appear, and no one will know where they come from or who introduced them.

Tests ensure that if a feature works at a given time, it will work in the future.

By the way, if you start writing tests last, maybe something is wrong with your development process :stuck_out_tongue: I advise you to write the tests at the same time/even before coding your service (in TDD mode), it will help you when you develop!

I hope you understand the need for tests in a product used by so many users :slight_smile:

Do not hesitate if you have questions about this part, and thank you again for this service :folded_hands:

On my recent commits, I have ESLint errors regarding the serialport module, even though I don’t have them on my PC.

  2:28  error  Unable to resolve path to module 'serialport'                   import/no-unresolved
  3:26  error  Unable to resolve path to module '@serialport/parser-readline'  import/no-unresolved

Should I put the node_modules folder on GitHub?

This is the issue I reported to you. If you downgrade to 8.0.6, it should work, I think.

I still don’t understand why, but it’s fixed, thank you

@pierre-gilles are these errors normal on the server tests:

    /home/circleci/gladys-test/server/services/usb/api/usb.controller.js
  13:17  warning  Unexpected unnamed function  func-names

/home/circleci/gladys-test/server/test/benchmark/triggers.js
  68:8  warning  Unexpected constant condition  no-constant-condition

/home/circleci/gladys-test/server/test/lib/gateway/GladysGatewayClientMock.test.js
  4:33  warning  Unexpected unnamed function  func-names

✖ 3 problems (0 errors, 3 warnings)

> gladys-server@ test /home/circleci/gladys-test/server
> cross-env SQLITE_FILE_PATH=/tmp/gladys-test.db NODE_ENV=test ./node_modules/mocha/bin/mocha --recursive ./test/bootstrap.test.js "./test/**/*.test.js" --exit

/home/circleci/gladys-test/server/lib/scene/scene.actions.js:1
var cov_1nc0kv0to6=function(){var path="/home/circleci/gladys-test/server/lib/scene/scene.actions.js";var hash="de307e1c7bbeaca9c7449b14f4b6ca64b54a4a14";var global=new Function("return this")();var gcv="__coverage__";var coverageData={path:"/home/circleci/gladys-test/server/lib/scene/scene.actions.js",statementMap:{"0":{start:{line:1,column:20},end:{line:1,column:52}},"1":{start:{line:2,column:29},end:{line:2,column:58}},"2":{start:{line:3,column:15},end:{line:3,column:44}},"3":{start:{line:5,column:20},end:{line:42,column:1}},"4":{start:{line:9,column:4},end:{line:15,column:5}},"5":{start:{line:10,column:6},end:{line:10,column:84}},"6":{start:{line:11,column:6},end:{line:11,column:76}},"7":{start:{line:13,column:6},end:{line:13,column:62}},"8":{start:{line:14,column:6},end:{line:14,column:93}},"9":{start:{line:16,column:4},end:{line:16,column:69}},"10":{start:{line:19,column:18},end:{line:19,column:64}},"11":{start:{line:20,column:4},end:{line

I also have a real error (not a warning):

TypeError: Cannot read property 'SEND' of undefined
    at Object.<anonymous> (/home/circleci/gladys-test/server/lib/scene/scene.actions.js:1:7066)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)

I need feedback on the service, but most of the v4 users do not use a development environment, so they cannot test.
my service, so I would like to be able to release it quickly to know which devices work or not and fix it.

Hello,

If there is a document explaining how to set up the development environment with what you have developed, I am interested.

I only have motion detectors, so it won’t cover all the tests you want to perform.

Yes it’s in the documentation

These are warnings, so it’s fine :slight_smile:

Some service developers build a special Docker image with the service under development, which makes it easier for users to test. That being said, I agree, we haven’t yet set up the processes to make it easy to implement. If you’re not very comfortable with Docker/CircleCI, it’s not simple for now.

Two options:

  • Either you ask those who are interested in testing to install Gladys in dev
  • Or you manage to build a Docker image and distribute it to those interested

Already, based on @PhilippeMA’s message, you already have an interested tester who will install Gladys in dev :slight_smile:

On my side, I will review your PR when the PR is ready :slight_smile:

I thought I was done with the service but the tests give this:

gladys-server@ test /home/circleci/gladys-test/server
> cross-env SQLITE_FILE_PATH=/tmp/gladys-test.db NODE_ENV=test ./node_modules/mocha/bin/mocha --recursive ./test/bootstrap.test.js "./test/**/*.test.js" --exit

Initialising OpenZWave 1.5.0 binary addon for Node.JS.
    OpenZWave Security API is ENABLED
    ZWave device db    : /etc/openzwave
    User settings path : /home/circleci/gladys-test/server/services/zwave/node_modules/openzwave-shared/build/Release/../../
    Option Overrides : --Logging false --ConsoleOutput false --SaveConfiguration true

2020-03-21T11:57:57+0000 <trace> bootstrap.test.js:30 (Context.before) DatabaseError [SequelizeDatabaseError]: SQLITE_ERROR: no such table: t_trigger_scene
at Query.formatError (/home/circleci/gladys-test/server/node_modules/sequelize/lib/dialects/sqlite/query.js:423:16)
at afterExecute (/home/circleci/gladys-test/server/node_modules/sequelize/lib/dialects/sqlite/query.js:119:32)
at Statement.errBack (/home/circleci/gladys-test/server/node_modules/sqlite3/lib/sqlite3.js:16:21) {
  name: 'SequelizeDatabaseError',
  parent: [Error: SQLITE_ERROR: no such table: t_trigger_scene] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'DELETE FROM `t_trigger_scene`'
  },
  original: [Error: SQLITE_ERROR: no such table: t_trigger_scene] {
errno: 1,
code: 'SQLITE_ERROR',
sql: 'DELETE FROM `t_trigger_scene`'
  },
  sql: 'DELETE FROM `t_trigger_scene`'
}
  1) "before all" hook: before

  0 passing (130ms)
  1 failing

  1) "before all" hook: before:
 SequelizeDatabaseError: SQLITE_ERROR: no such table: t_trigger_scene
  at Query.formatError (node_modules/sequelize/lib/dialects/sqlite/query.js:423:16)
  at afterExecute (node_modules/sequelize/lib/dialects/sqlite/query.js:119:32)
  at Statement.errBack (node_modules/sqlite3/lib/sqlite3.js:16:21)

I don’t think the error is coming from the service

@joeypic Are your tests local or on Circle? Here, there seems to be a DB/test mismatch, so in my opinion, either a small rebase of the code relative to master is missing, or your test DB has been migrated to a different branch than the one you are currently running, and therefore the two no longer match

If this is a problem you have locally:

In the server folder, run:

npm run clean:test

(This deletes the test DB, it will be re-created during the next tests)

In any case, I encourage you to rebase master because your PR is outdated relative to master

@pierre-gilles These are Circle’s tests, I admit I don’t know how to rebase, I tried

git rebase Gladys/master

But it tells me I have changes to commit even though I don’t, even if I commit these changes, as soon as I run the rebase command again, it asks me to commit the same files (those from my service)

Hello

I have an Arduino with 433 MHz transmission and reception
If I can help, it’s with pleasure!

It’s kind of you to want to help, but to use Rflink, you need an Arduino Mega because it’s a large program. If you have one, you can already install the service and continue talking to me in private messages.

@pierre-gilles could you help me fix this error:

gladys-server@ postinstall /home/circleci/gladys-test
node ./cli/install_service_dependencies.js

internal/modules/cjs/loader.js:985
  throw err;
  ^

Error: Cannot find module '/home/circleci/gladys-test/cli/install_service_dependencies.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.Module._load (internal/modules/cjs/loader.js:864:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
    at internal/main/run_main_module.js:18:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gladys-server@ postinstall: `node ./cli/install_service_dependencies.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gladys-server@ postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/circleci/.npm/_logs/2020-03-23T09_43_26_526Z-debug.log

I have this error in the test push coverage on GitHub

Hello everyone,

I have published images :spouting_whale: on DockerHub for those who want to test the rflink integration.
I will update them once or twice a day :wink:

That’s really huge, thanks @peb !!! :bowing_man: :bowing_man: :bowing_man: :bowing_man: