Bticino Smarther X8000

Hello to all,
has anyone managed to integrate the Bticino Smarther thermostat into Home Assistant using only the APIs that Legrand provides?
https://portal.developer.legrand.com/docs/services/smartherV2/operations/Chronothermostat-Measures
I saw that in Open Hab they did it, maybe the link can help.


Thank you!

Did you manage to make this work?

No, unfortunately I am not able alone …

Hi there if you are interest i’ve already integrated X8000 with hassio

Wonderful, I try it now!
Thanks a lot!

Hello,
I have this error: KeyError: ‘api_user’
where am i wrong?
This is the log:

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[21:20:54] INFO: Setup config file...
Traceback (most recent call last):
  File "bticino.py", line 36, in <module>
    api_user=(cfg["api_config"]["api_user"])
KeyError: 'api_user'
[cmd] /hassio_bticino_smarter/run.sh exited 1
[cont-finish.d] executing container finish scripts...
[cont-finish.d] done.
[s6-finish] waiting for services.
[s6-finish] sending all processes the TERM signal.

My hardware is raspberry pi 4 with hassio

Sorry if I write badly in English

I solved it: KeyError: ‘api_user’
It was the wrong subscription_key
I have more questions to ask:

  1. redirect_url what should I write? I wrote the valid public URL in “First Reply Url”
  2. Nat API port:5588 on your router/firewall Do you need to open the port 5588 on the router addressed to the raspberry?
  3. Why i not see my Plant Info after Get your code, after Logging with my developer account and after has allow your app permissions?
  4. i go to http://my_hassio_ip:5588/rest: I have no value, only the word null

this is my config

client_id: 676bb1cf-.....
client_secret: '1uzf6DI?:.......'
subscription_key: db8679d34.....
redirect_url: 'https://myhacasa.duckdns.org/rest'
api_user: my_user_scelto
api_pass: my_pass_scelta
subscribe_c2c: true
mqtt_broker: 192.168.0.9
mqtt_port: '1883'
mqtt_user: My_user_mqtt
mqtt_pass: 'My_pass_mqtt'
mqtt_interval: '5'

Thanks for any information

Hi you must have a proxy with a true ssl certificate!
you can use nginx proxy add-on and add a custom location.

Hello,
as redirect_url you have to put:
https://myhacasa.duckdns.org/callback
The app on the portal dev. Legrand must be configured as follows:

You also need to configure your proxy with custom locations /callbacks and /rest and forwarding port 5588.
I use the Nginx Proxy Manager add-on.

Solved
I followed your directions and it was successful
I also had to open port 5588 on the router addressed to my rasp
now, I have to configure the 6 thermostats.

Thank you very much

another question
I have this from http://192.168.0.9:5588/rest

[{"name": "Sala", "mode": "AUTOMATIC", "function": "HEATING", "state": "INACTIVE", "setpoint": "19.00000", "temperature": "20.3", "temp_unit": "C", "humidity": "71.7", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/b1c90d8d-0348-552c-e053-20182d0adf29/status", "mqtt_cmd_topic": "/bticino/b1c90d8d-0348-552c-e053-20182d0adf29/cmd"}, {"name": "Bagno Grande", "mode": "AUTOMATIC", "function": "HEATING", "state": "INACTIVE", "setpoint": "19.00000", "temperature": "19.5", "temp_unit": "C", "humidity": "81.0", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/b1c90d8d-0948-552c-e053-20182d0adf29/status", "mqtt_cmd_topic": "/bticino/b1c90d8d-0948-552c-e053-20182d0adf29/cmd"}, {"name": "Studio", "mode": "PROTECTION", "function": "HEATING", "state": "INACTIVE", "setpoint": "7.00000", "temperature": "20.9", "temp_unit": "C", "humidity": "67.7", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/c1878aa1-a0f0-dd52-e053-1e182d0a2757/status", "mqtt_cmd_topic": "/bticino/c1878aa1-a0f0-dd52-e053-1e182d0a2757/cmd"}, {"name": "Camera Matrimoniale", "mode": "AUTOMATIC", "function": "HEATING", "state": "INACTIVE", "setpoint": "19.00000", "temperature": "19.6", "temp_unit": "C", "humidity": "75.1", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/2f50819b-b07b-be4e-e053-20182d0a067a/status", "mqtt_cmd_topic": "/bticino/2f50819b-b07b-be4e-e053-20182d0a067a/cmd"}, {"name": "Bagno Piccolo", "mode": "AUTOMATIC", "function": "HEATING", "state": "INACTIVE", "setpoint": "19.00000", "temperature": "19.5", "temp_unit": "C", "humidity": "86.0", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/4faa8aa1-fe56-c136-e053-20182d0aa928/status", "mqtt_cmd_topic": "/bticino/4faa8aa1-fe56-c136-e053-20182d0aa928/cmd"}, {"name": "Cameretta", "mode": "PROTECTION", "function": "HEATING", "state": "INACTIVE", "setpoint": "7.00000", "temperature": "18.9", "temp_unit": "C", "humidity": "75.0", "c2c-subscription": "Enable", "mqtt_status_topic": "/bticino/7cfa8aa1-b3eb-d20c-e053-20182d0aeef7/status", "mqtt_cmd_topic": "/bticino/7cfa8aa1-b3eb-d20c-e053-20182d0aeef7/cmd"}]

how do I separate the various sensors?

Hi, use mqtt sensor it’s more simple:

- platform: mqtt
  name: termostato_sala_temperature
  state_topic: "/bticino/f9160185-7a27-4f70-e053-27182d0a51c5/status"
  unit_of_measurement: '°C'
  value_template: "{{ value_json['temperature'] }}"
- platform: mqtt
  name: termostato_sala_humidity
  state_topic: "/bticino/f9160185-7a27-4f70-e053-27182d0a51c5/status"
  unit_of_measurement: '%'
  value_template: "{{ value_json.humidity }}"
- platform: mqtt
  name: termostato_sala_function
  state_topic: "/bticino/f9160185-7a27-4f70-e053-27182d0a51c5/status"
  value_template: "{{ value_json.function }}"
- platform: mqtt
  name: termostato_sala_state
  state_topic: "/bticino/f9160185-7a27-4f70-e053-27182d0a51c5/status"
  value_template: "{{ value_json.state }}"
- platform: mqtt
  name: termostato_sala_mode
  state_topic: "/bticino/f9160185-7a27-4f70-e053-27182d0a51c5/status"
  value_template: "{{ value_json.mode }}"

change the state_topic for each thermostat! :smiley:

Please update to the latest version (0.3) i fixed some bugs and updated the documentation.

Hello,
I have update to the latest versio.
This is my log

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[19:20:51] INFO: Setup config file...
 * Serving Flask app "bticino" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: on
 * Running on http://0.0.0.0:5588/ (Press CTRL+C to quit)
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 542-095-070
192.168.0.99 - - [23/Apr/2020 19:21:06] "GET /get_code HTTP/1.1" 404 -
192.168.0.99 - - [23/Apr/2020 19:21:48] "GET /get_code HTTP/1.1" 404 -

In the http://192.168.0.9/get_code result not found

Hi I’ve update with new web interface, read the support you found get your code in
HTTP://your-io:5588/

I’m sorry
I configured the sensors according to your instructions, but the result is unknown.
If I listen to topic / bticino / b1c90d8d-0348-552c-e053-20182d0adf29 / status I never have any value
What am I doing wrong?
This is my conf for Bticino Smarter

client_id: 676bb1cf-16c9-43ae-.......
client_secret: '1uzf6DI?:PfTfKPoh.........'
subscription_key: db8679d3498840.........
redirect_url: 'https://myhacasa.duckdns.org/callback'
api_user: MyUser_Api
api_pass: MyPass_Api
subscribe_c2c: true
mqtt_broker: 192.168.0.9
mqtt_port: 1883
mqtt_user: UserMQTT
mqtt_pass: 'PassMQTT'
mqtt_interval: 5

It appears that the Bticino Smarter add-on has not correctly connected to MQTT
Thanks

post the log of mosquitto server please

My log MQTT… My ip raspberry is 192.168.0.9

[15:10:27] INFO: Setup mosquitto configuration
[15:10:27] INFO: No local user available
[15:10:27] INFO: Initialize Hass.io Add-on services
[15:10:27] INFO: Initialize Home Assistant discovery
[15:10:27] INFO: Start Mosquitto daemon
1587733827: mosquitto version 1.6.3 starting
1587733827: Config loaded from /etc/mosquitto.conf.
1587733827: Loading plugin: /usr/share/mosquitto/auth-plug.so
1587733827: |-- *** auth-plug: startup
1587733827:  ├── Username/password checking enabled.
1587733827:  ├── TLS-PSK checking enabled.
1587733827:  └── Extended authentication not enabled.
1587733827: Opening ipv4 listen socket on port 1883.
1587733827: Opening ipv6 listen socket on port 1883.
1587733827: Opening websockets listen socket on port 1884.
1587733827: Opening ipv4 listen socket on port 8883.
1587733827: Opening ipv6 listen socket on port 8883.
1587733827: Opening websockets listen socket on port 8884.
1587733828: Warning: Mosquitto should not be run as root/administrator.
1587733828: New connection from 192.168.0.43 on port 1883.
[INFO] found Ezio on Home Assistant
1587733829: New client connected from 192.168.0.43 as shellyswitch25-98F4ABF3ED6D (p2, c1, k60, u'Ezio').
1587733829: New connection from 192.168.0.65 on port 1883.
1587733829: New connection from 192.168.0.31 on port 1883.
1587733829: New connection from 192.168.0.48 on port 1883.
1587733829: New connection from 192.168.0.59 on port 1883.
1587733829: New connection from 192.168.0.44 on port 1883.
1587733829: New client connected from 192.168.0.65 as shelly1pm-BA1595 (p2, c1, k60, u'Ezio').
1587733829: New client connected from 192.168.0.31 as shellyrgbw2-BC0835 (p2, c1, k60, u'Ezio').
1587733829: New client connected from 192.168.0.48 as shellyswitch25-109D31 (p2, c1, k60, u'Ezio').
1587733829: New client connected from 192.168.0.59 as shellyem-B9E769 (p2, c1, k60, u'Ezio').
1587733829: New client connected from 192.168.0.44 as shellyswitch25-109D4F (p2, c1, k60, u'Ezio').
1587733830: New connection from 192.168.0.9 on port 1883.
1587733830: Socket error on client <unknown>, disconnecting.
1587733831: New connection from 192.168.0.9 on port 1883.
1587733831: New client connected from 192.168.0.9 as homeassistant (p2, c1, k60, u'Ezio').
1587733833: New connection from 192.168.0.45 on port 1883.
1587733833: New client connected from 192.168.0.45 as tapp-gr-camera (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.22 on port 1883.
1587733834: New connection from 192.168.0.25 on port 1883.
1587733834: New client connected from 192.168.0.22 as Bagno_Piccolo (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.25 as Studio (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.42 on port 1883.
1587733834: New connection from 192.168.0.46 on port 1883.
1587733834: New client connected from 192.168.0.42 as tapp-pi-sala (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.46 as Tapp_Studio (p2, c1, k10, u'Ezio').
1587733834: New connection from 192.168.0.23 on port 1883.
1587733834: New connection from 192.168.0.41 on port 1883.
1587733834: New client connected from 192.168.0.23 as Cameretta (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.41 as tapp-gr-sala (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.29 on port 1883.
1587733834: New connection from 192.168.0.21 on port 1883.
1587733834: New connection from 192.168.0.64 on port 1883.
1587733834: New client connected from 192.168.0.29 as Bagno_Grande (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.21 as Intensita_Luci (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.64 as PR_POW_5 (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.63 on port 1883.
1587733834: New connection from 192.168.0.24 on port 1883.
1587733834: New client connected from 192.168.0.63 as PR_POW_4 (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.24 as Camera_Matrim (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.27 on port 1883.
1587733834: New client connected from 192.168.0.27 as Luce_Esterna_Bagno (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.28 on port 1883.
1587733834: New connection from 192.168.0.60 on port 1883.
1587733834: New connection from 192.168.0.35 on port 1883.
1587733834: New connection from 192.168.0.61 on port 1883.
1587733834: New client connected from 192.168.0.28 as Veranda (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.60 as PR_POW_1 (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.35 as Pulsante (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.61 as PR_POW_2 (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.62 on port 1883.
1587733834: New connection from 192.168.0.26 on port 1883.
1587733834: New client connected from 192.168.0.62 as PR_POW_3 (p2, c1, k30, u'Ezio').
1587733834: New client connected from 192.168.0.26 as Terrazzo (p2, c1, k30, u'Ezio').
1587733834: New connection from 192.168.0.58 on port 1883.
1587733835: New client connected from 192.168.0.58 as LUCI (p2, c1, k30, u'Ezio').

Hi all, very happy to see that BTicino Smarther has been integrated in HASSIO.
Is there the possibility to integrate in Home Assistant with a docker installation?
Thank You

1 Like

Hi filippo, yes it’s a docker integration.
Please remove the old add-on and reinstall the new.
i’ve released today the new code!