Freebox Delta integration

@gaelbillon, I did a test with the security pack remote but no information is being reported to the API.

Yet I can detect it correctly but no value changes in the data

![image|360x464](upload://7sEoopHee0SnhZnmL0im737Fr

Hello @_Will_71 ,

Same for me it’s much cheaper than Somfy boxes.
My shutters use IO.

I’ve done several tests and for now I’ll limit myself to the shutters, door sensors and motion sensors. I haven’t had time to look at the camera yet, but it can be added manually in Gladys’s Camera integration.

Regarding the alarm, the remote never reports its state to the API. Neither the battery nor the buttons’ state.

As for activating the alarm, it’s possible but there is no suitable component in Gladys.
I tried just as a test with a toggle button — it works, I can activate the alarm but I don’t find it really suitable. We would need either push buttons or a selector button (OFF / FULL / NIGHT)
![

[quote=« _Will_71, post:23, topic:7820 »]
It would require either push

Yes, I found it yesterday, but for now I don’t think I’ll add much. I’m just getting started, so I don’t want to do too much at once and end up writing a lot of nonsense in the code.

I was already thinking of opening a PR (pull request) with what I manage to get working (shutters, open and motion sensors) and with the current Gladys components, and then look into adding a 3-state component adapter for the alarms. Besides, that could also be useful for your development on the alarms.

Hi @_Will_71,

Already a great job, and since I’m not taking part in the coding I won’t allow myself to be too demanding!
Having the shutters plus open and motion sensors is already a good

Yes you’re right, it’s better to make small PRs that get merged quickly rather than huge PRs that are impossible to review :slight_smile:

To be honest I only use it for controlling the shutters, which for now is reported to Gladys thanks to Node-RED and MQTT.

Hi @_Will_71,

If you

Hi,

I’ll try to do that for you tonight

@gaelbillon Here are some explanations for the Freebox module in Node-RED

First, you need to create an MQTT device with the features Shutter Position and Shutter State

In Node-RED, you need to install the node-red-contrib-freebox module and of course create the connection with the Gladys MQTT broker.

During the first request, you will need to validate the use of Node-RED with the Freebox.
To do this, you will need to validate on the front of your Freebox.

Then you will need to grant Node-RED permission to read the security pack information in the Freebox settings.
To do this, go to Freebox-OS, settings / access management

image

In Access Management, in the Application tab, you should find a line corresponding to Node-RED


Click on the pencil for editing on the right
image

Check the box for Alarm and Smart Home Management
image

Below is a first Flow to test the connection and get the return of all your security pack devices.

[
    {
        "id": "1d67dee27a16208d",
        "type": "group",
        "z": "d7c3929073ea7b03",
        "name": "Call API Freebox",
        "style": {
            "fill": "#dbcbe7",
            "label": true,
            "color": "#000000"
        },
        "nodes": [
            "4f8f16965ae54f50",
            "72e75292b4cb21f9",
            "7dd73ca182891c1b"
        ],
        "x": 1254,
        "y": 699,
        "w": 552,
        "h": 82
    },
    {
        "id": "4f8f16965ae54f50",
        "type": "api",
        "z": "d7c3929073ea7b03",
        "g": "1d67dee27a16208d",
        "name": "",
        "url": "",
        "server": "35b9faf136b9302a",
        "x": 1530,
        "y": 740,
        "wires": [
            [
                "72e75292b4cb21f9"
            ]
        ]
    },
    {
        "id": "72e75292b4cb21f9",
        "type": "debug",
        "z": "d7c3929073ea7b03",
        "g": "1d67dee27a16208d",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1690,
        "y": 740,
        "wires": []
    },
    {
        "id": "7dd73ca182891c1b",
        "type": "inject",
        "z": "d7c3929073ea7b03",
        "g": "1d67dee27a16208d",
        "name": "/home/tileset",
        "props": [
            {
                "p": "url",
                "v": "/home/tileset/all",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "x": 1370,
        "y": 740,
        "wires": [
            [
                "4f8f16965ae54f50"
            ]
        ]
    },
    {
        "id": "35b9faf136b9302a",
        "type": "freebox-server",
        "host": "https://mafreebox.freebox.fr",
        "port": "443"
    }
]
```Below is the flow of a shutter

![image|690x168](upload://h6zwYBrrHs4HDZF3PJcjJ1QcX4F.png)

[
{
« id »: « 18e154108b13c26c »,
« type »: « group »,
« z »: « d7c3929073ea7b03 »,
« name »: « Office shutter »,
« style »: {
« stroke »: « #7fb7df »,
« label »: true,
« fill »: « #92d04f »,
« color »: « #000000 »
},
« nodes »: [
« 3e15afd9376757c9 »,
« a49eaa136556eee7 »,
« a748fcd15020c73e »,
« 10b39b8328881bdb »,
« 1ecb5525b3ad37c6 »,
« a7c2664d98109c89 »,
« fd923244d0fb66d2 »,
« 2a32a9e720ae58f3 »,
« 31a13ffcc844be3f »,
« 26f4754086a73f61 »,
« 768a96d8a1add8e5 »,
« 3bdfec7e2be1d3cb »,
« 3dab952dd0a739a3 »,
« 83331d58417a9467 »,
« 30d53f3a1ed9df4c »,
« 277875ed0aa28e4b »
],
« x »: 54,
« y »: 1179,
« w »: 1512,
« h »: 342
},
{
« id »: « 3e15afd9376757c9 »,
« type »: « mqtt in »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Gladys value »,
« topic »: « gladys/device/mqtt:office_shutter/feature/mqtt:position_office_shutter/state »,
« qos »: « 2 »,
« datatype »: « auto-detect »,
« broker »: « 05eac840560ca08c »,
« nl »: false,
« rap »: true,
« rh »: 0,
« inputs »: 0,
« x »: 150,
« y »: 1220,
« wires »: [
[
« 83331d58417a9467 »
]
]
},
{
« id »: « a49eaa136556eee7 »,
« type »: « mqtt out »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Update Gladys value »,
« topic »: « gladys/master/device/mqtt:office_shutter/feature/mqtt:position_office_shutter/state »,
« qos »: « 2 »,
« retain »: «  »,
« respTopic »: «  »,
« contentType »: «  »,
« userProps »: «  »,
« correl »: «  »,
« expiry »: «  »,
« broker »: « 05eac840560ca08c »,
« x »: 1080,
« y »: 1480,
« wires »:
},
{
« id »: « a748fcd15020c73e »,
« type »: « mqtt in »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Gladys value »,
« topic »: « gladys/device/mqtt:office_shutter/feature/mqtt:cmd_office_shutter/state »,
« qos »: « 2 »,
« datatype »: « auto-detect »,
« broker »: « 05eac840560ca08c »,
« nl »: false,
« rap »: true,
« rh »: 0,
« inputs »: 0,
« x »: 150,
« y »: 1320,
« wires »: [
[
« 10b39b8328881bdb »
]
]
},
{
« id »: « 10b39b8328881bdb »,
« type »: « json »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: «  »,
« property »: « payload »,
« action »: «  »,
« pretty »: false,
« x »: 290,
« y »: 1320,
« wires »: [
[
« 1ecb5525b3ad37c6 »
]
]
},
{
« id »: « 1ecb5525b3ad37c6 »,
« type »: « switch »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: «  »,
« property »: « payload »,
« propertyType »: « msg »,
« rules »: [
{
« t »: « eq »,
« v »: « 1 »,
« vt »: « num »
},
{
« t »: « eq »,
« v »: « 0 »,
« vt »: « num »
},
{
« t »: « eq »,
« v »: « -1 »,
« vt »: « num »
}
],
« checkall »: « true »,
« repair »: false,
« outputs »: 3,
« x »: 410,
« y »: 1320,
« wires »: [
[
« fd923244d0fb66d2 »,
« 31a13ffcc844be3f »
],
[
« a7c2664d98109c89 »
],
[
« 2a32a9e720ae58f3 »,
« 31a13ffcc844be3f »
]
],
« outputLabels »: [
« Open »,
« Stop »,
« Close »
]
},
{
« id »: « a7c2664d98109c89 »,
« type »: « function »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « STOP »,
« func »: « msg.url = "/home/endpoints/30/1"\nmsg.method = "PUT"\nmsg.payload = {\n "value": null\n}\nreturn msg; »,
« outputs »: 1,
« noerr »: 0,
« initialize »: «  »,
« finalize »: «  »,
« libs »: ,
« x »: 710,
« y »: 1320,
« wires »: [
[
« 30d53f3a1ed9df4c »
]
]
},
{
« id »: « fd923244d0fb66d2 »,
« type »: « function »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « OPEN »,
« func »: « msg.url = "/home/endpoints/30/3"\nmsg.method = "PUT"\nmsg.payload = {\n "value": 0\n}\nreturn msg; »,
« outputs »: 1,
« noerr »: 0,
« initialize »: «  »,
« finalize »: «  »,
« libs »: ,
« x »: 710,
« y »: 1280,
« wires »: [
[
« 30d53f3a1ed9df4c »
]
]
},
{
« id »: « 2a32a9e720ae58f3 »,
« type »: « function »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « CLOSE »,
« func »: « msg.url = "/home/endpoints/30/3"\nmsg.method = "PUT"\nmsg.payload = {\n "value": 100\n}\nreturn msg; »,
« outputs »: 1,
« noerr »: 0,
« initialize »: «  »,
« finalize »: «  »,
« libs »: ,
« x »: 720,
« y »: 1360,
« wires »: [
[
« 30d53f3a1ed9df4c »
]
]
},
{
« id »: « 31a13ffcc844be3f »,
« type »: « trigger »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Wait for stable value »,
« op1 »: «  »,
« op2 »: «  »,
« op1type »: « nul »,
« op2type »: « payl »,
« duration »: « 15 »,
« extend »: true,
« overrideDelay »: false,
« units »: « s »,
« reset »: «  »,
« bytopic »: « all »,
« topic »: « topic »,
« outputs »: 1,
« x »: 500,
« y »: 1400,
« wires »: [
[
« 3dab952dd0a739a3 »
]
]
},
{
« id »: « 26f4754086a73f61 »,
« type »: « poll »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Office Shutter »,
« url »: « /home/tileset/30 »,
« interval »: « 3000 »,
« server »: « 35b9faf136b9302a »,
« x »: 150,
« y »: 1480,
« wires »: [
[
« 768a96d8a1add8e5 »
]
]
},
{
« id »: « 768a96d8a1add8e5 »,
« type »: « function »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Get only the value »,
« func »: « msg.payload = 100 - msg.payload[0].data[0].value;\nreturn msg; »,
« outputs »: 1,
« noerr »: 0,
« initialize »: «  »,
« finalize »: «  »,
« libs »: ,
« x »: 750,
« y »: 1480,
« wires »: [
[
« a49eaa136556eee7 »
]
]
},
{
« id »: « 3bdfec7e2be1d3cb »,
« type »: « mqtt out »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Update Gladys value »,
« topic »: « gladys/master/device/mqtt:office_shutter/feature/mqtt:cmd_office_shutter/state »,
« qos »: « 2 »,
« retain »: «  »,
« respTopic »: «  »,
« contentType »: «  »,
« userProps »: «  »,
« correl »: «  »,
« expiry »: «  »,
« broker »: « 05eac840560ca08c »,
« x »: 1080,
« y »: 1400,
« wires »:
},
{
« id »: « 3dab952dd0a739a3 »,
« type »: « function »,
« z »: « d7c3929073ea7b03 »,
« g »: « 18e154108b13c26c »,
« name »: « Set value to 0 »,
« func »: « msg.payload = 0;\nreturn msg; »,
« outputs »: 1,
« noerr »: 0,
« initialize »: «  »,
« finalize »: «  »,
« libs »: ,
« x »: 740,
« y »: 1400,
« wires »: [
[
« 3bdfec7e2be1d3cb »
]
]
},
{
« id »: « 83331d58417a9467"type »: « function »

Hi @_Will_71 ,
Thank you very much, I will start looking at that tomorrow and yes I think there will be questions.
Have a good evening

@_Will_71 Thanks for sharing! Great job!
Wouldn’t you put that in a specific tutorial so it doesn’t get lost?

That can be done. I’ll try to do it tomorrow

Hi @_Will_71,

I’ve started looking and already have questions; for info I’m not a developer.
On the 1st Flow, could you please show me what you put?
Thanks

Hi @gaelbillon,
What exactly do you want to see? Because if you import the flow I added, you’ll have everything in it.

So it’s okay — I didn’t realize that the code you posted was the feed I had to import!! I’m really just starting out :smile:
I managed to get the connection:

Just one thing: where does the value msg.url = « /home/endpoints/30/3 » come from?
I must be stupid but I can’t find it.

Yes I see why because actually I forgot to mention it and you need to adapt this line according to your shutters.
For that the first flow I gave you will let you find these values.

If you run the flow here’s what you’ll get

If you expand it you’ll find all your devices

My example shutter is at value 7 in the table

Here’s how to form the msg.url

/home/endpoints/node_id/ep_id

With node_id the identifier of your shutter — here my shutter is 30 => value to retrieve from the payload obtained above. So you must modify it according to the value you have for your shutter.

And ep_id the identifier of your function — here I use the position feature which has the identifier 3 => this value normally doesn’t need to be changed; on my 6 shutters this identifier is the same.

I don’t know if I’ll have time tonight but at the same time I’m rewriting the tutorial as requested.
Thanks for asking me — I’ll add it.