Free Mobile integration

Feature description

Following my contribution to this thread Envoyer des SMS avec Gladys Plus I propose being able to integrate Free Mobile directly (in the Gladys way, i.e., with simplicity).

I know that currently it is possible to do this via Node-RED or via HTTP calls.

Looking forward to your feedback and votes

Great idea! :+1:

1 Like

To practice coding, I implemented the SMS integration with Free Mobile


And the addition of a new action Send an SMS in the scenes

It works for me. Here is an image for those who use Free Mobile and want to test:

willde71/gladys-test:free-mobile-sms

@pierre-gilles, here is the PR, awaiting your feedback.

6 Likes

Great @_Will_71 :slight_smile: I took the liberty of moving your post here since it was more related to this request!

I’m not a Free Mobile customer so I won’t be able to test it — I’m looking for testers first, and then I’ll give you a technical review!

2 Likes

Hello to you,

@_Will_71 I just tested your development, it’s great!!
I had no issues using it, with scenes, whether passing variables or not.

Nice work :blush:

The only thing I would mention is to make the « Service identification key » field a password type, I think.

1 Like

Thanks for the feedback.

For the key, I based it on the other integrations and they are not of the password type either.

But I can change it.

2 Likes

The only issue with switching to a « password » field is that the autocompletes then replace the data in it automatically with your Gladys password

Firefox is actually the worst about this — it doesn’t respect « autocomplete=off », so you have to use some pretty dirty hacks to stop it from putting the password everywhere ^^

So yeah, it’s good to set it as a password, but if it’s done poorly it creates more problems than it solves ^^

@_Will_71 I don’t know if you’ve seen, but the tests aren’t passing on GitHub :slight_smile:

Yes, I saw it; I still haven’t understood why, because the tests pass locally on my PC.

1 Like

Locally are you running all the tests or just the tests on freemobile with .only?

Edit: I tested on my machine in both cases, and it passes fine on your PR:

Except that on CI everything is slower, so it’s possible that on CI the send() function resolves while the API call hasn’t actually finished — worth checking whether the code is correct on that.

When I’m writing the tests I use .only

Otherwise I rerun without the .only when I’m done.

I’ll look through the code as soon as I can.

1 Like

Ok keep me posted, and don’t hesitate if you need help

@pierre-gilles, I need your help because I don’t understand.
I made corrections and I still have errors and the server tests are not passing.

But this time here’s what I get directly on GitHub:
The integration tests OK

Coverage is OK
Screenshot of 2024-11-11 22-47-46

But there are 10 errors related to NetAtmo

There is surely something but I don’t see it. If you could point me in the right direction. Thanks in advance.

@Terdious already had these issues with the Netatmo integration?

I don’t think this is coming from the Netatmo integration because I noticed that in each error there is a line related to my test file.

Greetings to both of you!
So no but yes ^^ as I recall I had big headaches with resets and timeouts in the tests. But I don’t remember if it was on this part.
Maybe @_Will_71 uses it the same way and that impacts the other… or I was the one who did it wrong… I admit that I can’t say for sure like this.

Don’t hesitate to tell me if needed, I’ll take the time to boot up my dev PC if there’s a kwak on my side (haven’t finished the renovations yet, but it’s progressing ^^)

Hi @_Will_71, I can take a look on Friday if you want :slight_smile:

Have you been able to resolve this issue since?

I’d like you to take a look and give me a bit of guidance.
I’ve tried doing things but I haven’t been able to solve the problem.
I’m not yet comfortable with tests, so I probably have a reset issue somewhere.

@_Will_71 I rebased your branch, and I tested locally, I didn’t have the issue, we’ll see what it looks like on the CI :slight_smile:

Edit: Ok the error is still there

Ok I think I know what it is, the two integrations set up the same stub and so it conflicts. You need to create a sandbox to prevent it from polluting other tests:

Example:

const sinon = require('sinon');

let sandbox;

beforeEach(() => {
    sandbox = sinon.createSandbox();
});

afterEach(() => {
    sandbox.restore();
});

it('should test something', () => {
    const stub = sandbox.stub(SomeObject, 'someMethod');
    // Test code...
});
2 Likes

@_Will_71 all good, I

2 Likes