Hello,
in one room, I have 2 temperature readings coming in: one from a standard sensor, the other from the radiator pilot-wire module which stays at -999°C all the time because it’s unused.
And I occasionally get a wildly incorrect average temperature:
Hello,
I’m back with one more check to do.
In my living room temperature, I have a Zigbee sensor, my Netatmo and my Dyson (via matterbridge).
For now my Dyson has no value (because I’ve disabled the appropriate matterbridge plugin) and I get this, with an obviously incorrect average temperature:
I worked on a PR with Claude Haiku and here is the result :
However, I can’t run the tests via VSCode, I get error messages like this and I don’t understand anything at all (not being a dev, I’m really having trouble) :
DualStef:server stef$ pwd
/Users/stef/CloudStation/github/Gladys/server
DualStef:server stef$ npm test
> test
> cross-env NODE_ENV=test ./node_modules/mocha/bin/mocha --recursive ./test/bootstrap.test.js "./test/**/*.test.js" --exit
node:events:497
throw er; // Unhandled 'error' event
^
Error: spawn ./node_modules/mocha/bin/mocha ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:285:19)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:291:12)
at onErrorNT (node:internal/child_process:483:16)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn ./node_modules/mocha/bin/mocha',
path: './node_modules/mocha/bin/mocha',
spawnargs: [
'--recursive',
'./test/bootstrap.test.js',
'./test/**/*.test.js',
'--exit'
]
}
Node.js v22.21.1
DualStef:server stef$ pwd
/Users/stef/CloudStation/github/Gladys/server
DualStef:server stef$ npm run eslint
> eslint
> eslint .
(node:82347) ESLintIgnoreWarning: The ".eslintignore" file is no longer supported. Switch to using the "ignores" property in "eslint.config.js": https://eslint.org/docs/latest/use/configure/migration-guide#ignore-files
(Use `node --trace-warnings ...` to show where the warning was created)
Oops! Something went wrong! :(
ESLint: 10.0.0
ESLint couldn't find an eslint.config.(js|mjs|cjs) file.
From ESLint v9.0.0, the default configuration file is now eslint.config.js.
If you are using a .eslintrc.* file, please follow the migration guide
to update your configuration file to the new format:
https://eslint.org/docs/latest/use/configure/migration-guide
If you still have problems after following the migration guide, please stop by
https://eslint.org/chat/help to chat with the team.
Haïku 4.5 — GitHub and VS Code offer it for free so I’m using it, I don’t have a paid account.
And you have to give it a bit of help but I think the result wasn’t bad.
I had already done that too and it hadn’t worked … and now it works but it modified 81 files, is that normal?
What should I do? Stage and commit?
It’s cancellable at any time, there’s a trial period, and otherwise at worst it’s just 12€ (15$) for a month of use, and honestly given the quality of the models the 12€ are more than worth it
No, only the files you modified should be changed.
Exactly!
Ask the AI to write the tests
But well, we might be reaching the limit of vibe-coding, in any case you need to review and know what you’re doing…
@mutmut I looked at the PR, and I think the AI is off the mark — what it came up with is totally over-engineered; the same implementation could be written in… just 1 single line (vs 56 in your PR!! 55 too many!)
Before I help you, I’d like to understand your need, because on rereading your original message, I think even this PR didn’t address your issue!
No idea if it’s overkill or not because I’m not a dev
I have 2 pilot-wire modules on Z-Wave that report a temperature.
This temperature is correct if a probe is connected (it’s not my case), otherwise the temperature is -999°C.
Since I placed these modules in rooms with Zigbee temperature sensors, I end up with crazy averages (-489.6°C in my example).
And with these crazy values, I can’t control my heaters properly based on this average temperature.
So I asked the AI to exclude temperatures that were out of bounds for the average, namely a minimum and a maximum temperature.
I made another PR then, the solution is just a few lines, you only had to modify the SQL query to exclude the bogus values, rather than adding a lot of JS code Claude Haiku’s solution was too complex and not very efficient.
The PR:
I’ll merge that, it’ll go into the next Gladys release!