Legrand/Bticino MyHome

Hi there,
I am trying to install OWNd but get an error message during the python installation. It seems to be related to the version of python the 3.11. Any clue? Thanks.
I may have more silly questions soon, but better looking like an ignorant than staying an ingorant.

**********************
* Accellerated build *
**********************
/usr/local/lib/python3.11/dist-packages/setuptools/config/setupcfg.py:520: SetuptoolsDeprecationWarning: The license_file parameter is deprecated, use license_files instead.
  warnings.warn(msg, warning_class)
warning: no files found matching 'aiohttp' anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.lib' found anywhere in distribution
warning: no previously-included files matching '*.dll' found anywhere in distribution
warning: no previously-included files matching '*.a' found anywhere in distribution
warning: no previously-included files matching '*.obj' found anywhere in distribution
warning: no previously-included files found matching 'aiohttp/*.html'
no previously-included directories found matching 'docs/_build'
/usr/local/lib/python3.11/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
aiohttp/_websocket.c:196:12: fatal error: longintrepr.h: No such file or directory
  196 |   #include "longintrepr.h"
      |            ^~~~~~~~~~~~~~~
compilation terminated.
error: Setup script exited with error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1

Fixed, I manually installed aiohttp

pip install aiohttp

Hi,
I am just starting to use HA and to integrate my Bticino with HA, starting with the simplest the lights, and got an issue. My yaml looks like

# Bticino Integration
light:
  - platform: myhome
    devices:
      light_office:
        where: '03'
        name: Light Office 1er
        dimmable: False
        manufacturer: BTicino
        model: F411/4
      light_ac_room:
        where: '109'
        name: Light Alex & Charlotte room
        dimmable: False
        manufacturer: BTicino
        model: F411/4
      light_master_bed_room:
        where: '102'
        name: Light Master bed room
        dimmable: False
        manufacturer: BTicino
        model: F411/4
      plug_master_bed_room:
        where: '111'
        name: Power plug Master bed room
        dimmable: False
        manufacturer: BTicino
        model: F411/4

The default dashboard shows
bti_conf
Light with the slide switch is working, light with the flash show a message in the log like:

Unknown device: WHO=4 WHERE=4
8:20:43 PM – (WARNING) MyHome (custom integration) - message first occurred at 8:15:59 PM and shows up 5 times
Could not send message *1*1*111##.
8:09:25 PM – (ERROR) MyHome (custom integration)

WHO=4 WHERE=4 is not configured in the yaml, what means “could not send message”, why Office 1er appears twice (I manually erased it in the Overview) and why the icons for the switches looks different? I configured more lights and the result seems pretty random 2 working and 10 not working with the little flash icon
I have the feeling that the yaml file is not correctly interpreted. Below there is not light labelled 12, there is one label 012 with a A=0 and a PL=14. There is a APL 014 in the yaml but if does not show in the Light dashboard.


Definitively something wrong. I did an include of light inside configuration.yaml and created a lights.yaml.

bonjour, l intégration demande a être rechargée régulièrement.
Quelle solution avez vous mise en place ?

hello, the integration needs to be reloaded regularly.
What solution have you implemented?

Merci pour le réponse/question. Pas sur de comprendre votre question. Une solution pour recharger l’intégration myhome à interval régulier? Je ne vois pas trop ce que ça pourrait changer à mes problèmes.
J’ai pas mal creusé depuis mon dernier message et j’ai, pour l’instant, trois problèmes: 1) très souvent après une modification un hot restart, les interrupteurs sont inactifs et les status des entities indiquent “this entry is no longer being provided by the home assistant…”. C’est aléatoire après chaque restart que j’ai modifié ou pas la configuration Light. Il y a aussi des entités fantômes, apparentes dans l’Overview mais inexistantes dans le fichier yaml. Elles sont aussi inexistantes dans le fichier core.entity_registry.
2) climate ne fonctionne pas le log montre

2023-02-08 20:07:04.305 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2
2023-02-08 20:14:12.716 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3
2023-02-08 20:19:54.498 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2
2023-02-08 20:20:43.197 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=4
2023-02-08 20:22:39.212 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1

Ce qui correspond au 4 zones configurées. J’ai du loupé quelque chose, mais ou?

Thanks for the answer/question. Not sure I understand your question. A solution to reload the myhome integration at regular intervals? I don’t see how that could change my problems.
I’ve dug a lot since my last message and I have, for now, three problems: 1) very often after a modification a hot restart, the switches are inactive and the statuses of the entities indicate “this entry is no longer being provided by the home assistant…”. It’s random after each restart that I modified or not the Light configuration. There are also phantom entities, apparent in the Overview but non-existent in the yaml file. They are also non-existent in the core.entity_registry file.
2) climate does not work, the log shows

2023-02-08 20:07:04.305 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2
2023-02-08 20:14:12.716 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=3
2023-02-08 20:19:54.498 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=2
2023-02-08 20:20:43.197 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=4
2023-02-08 20:22:39.212 WARNING (MainThread) [custom_components.myhome] Unknown device: WHO=4 WHERE=1

This corresponds to the 4 configured zones. I must have missed something, but where?

Yes you right. I set an automation to restart the myhome integration as suggested above by Gabriel Daltoe and now I have my Climate working.
Learning…

Hello,
how did you do your automation?
Have you an screen shot?
Thanks

As mentioned I use the automation script proposed by Gabriel Daltoe
automation

Hello fellow home-assisted!
I’ve just published a very minor version (0.8.7) that includes the last two bug fixes from the master branch.

I am currently working on a 0.9 branch that will be substantially different and not backwards compatible with the 0.8 branch.
It will require a dedicated configuration file (still yaml, with a very similar structure, so creating it should not be too much of a problem).
Migrating to 0.9 will not allow you to keep the history for your devices, since they will have a new unique_id; at this point I’m unsure what this will mean for the energy portal, but my first tests seem to indicate it relies on the entity name, so this should still be kept.
I will try to publish the documentation for the new config file structure soon so people can prepare for it.

A sneak preview of what you can expect from 0.9:

  • No reliance on platforms (so the recent problem of entities missing at startup and having to restart the integration is gone)
  • Possibility to edit the configuration and just reload the integration, no need to restart HA as a whole
  • Support for multiple bus interfaces (experimental as I have no way to test myself)
  • Support for multiple gateways (also experimental as I have no way to test myself)

At this point all commits to the master branch will be for 0.9, so please do not update to the master branch if you don’t have all your configuration ready, and do not try this on your main install in case everything blows up…

My goal is to have 0.9.0 packaged and released within a couple of weeks.

6 Likes

Thanks Julien looking forward to it.

Alright, the documentation is mostly up to date on the github wiki for the project.
The current code in the master branch can be considered a “release candidate” at this point.

If there are adventurous folks wishing to test this, knock yourselves out. But I’d still suggest trying this on a different instance for now :wink:

Please let me know if anything’s broken at this point.
Also feel free to let me know if something in the doc is missing or confusing or poorly worded.

:astonished: :scream:
I’m trying the new version (0.9 from Master 731d9a5) on the raspberry.
I’ll update you as soon as I set everything right. :+1:

Good morning. I tried the 0.9 version, in my case after configuring /config/myhome.yaml it detects the gateway on the network, but when I try to enter it it gives me the wrong password error without having typed anything, later when I enter the password it seems that everything went well, but that is not true, the gateway is disconnected and the entities are not present.
The same thing happens to me with another gateway in my house.
With version 0.8.7 the password is entered normally.
Immagine 2023-02-19 111740

> Logger: homeassistant.config_entries
> Source: custom_components/myhome/validate.py:115
> Integration: MyHome (documentation, issues)
> First occurred: 04:24:55 (2 occurrences)
> Last logged: 04:25:48

> Error setting up entry MH202 Gateway for myhome
> Traceback (most recent call last):
>   File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
>     result = await component.async_setup_entry(hass, self)
>   File "/config/custom_components/myhome/__init__.py", line 47, in async_setup_entry
>     _validated_config = config_schema(yaml.safe_load(await yaml_file.read()))
>   File "/config/custom_components/myhome/validate.py", line 115, in __call__
>     data = super().__call__(data)
>   File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 272, in __call__
>     return self._compiled([], data)
>   File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
>     return base_validate(path, iteritems(data), out)
>   File "/usr/local/lib/python3.10/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
>     raise er.MultipleInvalid(errors)
> voluptuous.error.MultipleInvalid: Invalid WHERE 311 length, it must be a string of 2 or 4 digits. for dictionary value @ data['mh202']['binary_sensor']['contatto_porta_ingresso']['where']

@caiosweet created an issue for this ([Beta 0.9] Sensor Probe - Invalid WHERE length · Issue #74 · anotherjulien/MyHOME · GitHub)
Presumably it’s fixed now.

1 Like

with 97d91bf fixed all my problems for now.

Binary OK
Climate OK
Cover OK
Light OK
Sensor OK (energy OK)
Switch OK

“Lock” yet I have to try, but it’s not inherent to the myhome configuration :slight_smile:

1 Like

Fantastic!!!
Now everything works on my installation. I haven’t found anything wrong. I will test everything thoroughly in these days. Thanks thanks thanks.

Guys, I’m new to HA and want to Integrate my Bticino MH200 gateway to do some testing. When using OpenHab this was pretty forward.
Now while trying out HA I’ve tried to read here but still a bit confused.

Is the code to ‘discover’ the gateway still in a private repo?

Can somebody please just sum up the steps I should follow in order to connect to my gateway and be able to interact with the actuators?

My setup is: HA runs in docker on a server in the same subnet as the Gateway (MH200)

Many thanks!

EDIT:

I was able to add the MyHome Integration:

My steps were:

  1. Install HACS in HA
  2. In HACS add integration > 3 dots upper corner > add custom git repo (my home from Julien)
  3. Restart HA
  4. Go to integrations > search for MyHome > Add > Use your IP, port default 20000 > psd needs to be overwritten even if default 12345 > Finnish
  5. Now I’m looking as where to go from here. How to add actuators and so on. Also still figuring out if I need to install the OWNd library

EDIT 2: I was able to create a light device in the yaml configuration file and toggle the actuator. Still not sure what OWNd serves for as I did not use it.

Julien,

Should this be still working?

Edit: solved (press the 3 dots right upper corner and add custom repository

@anotherjulien . Hello, unfortunately I’m having continuous crashes. This is what happens most frequently.

Questo errore ha avuto origine da un'integrazione personalizzata.

Logger: custom_components.myhome
Source: /usr/local/lib/python3.10/site-packages/OWNd/connection.py:594
Integration: MyHome (documentation, issues)
First occurred: 05:37:27 (29 occurrences)
Last logged: 05:37:31

Event session crashed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/OWNd/connection.py", line 582, in get_next
    return OWNMessage.parse(data.decode())
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 166, in parse
    return OWNEvent.parse(data)
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 315, in parse
    return OWNAlarmEvent(data)
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 952, in __init__
    self._sensor = int(self._where[1:])
ValueError: invalid literal for int() with base 10: '' 

I have the same error message, but different.
The system seems to work fine.

If it helps, this is the message with the MH200N “gateway”.

Logger: custom_components.myhome
Source: /usr/local/lib/python3.10/site-packages/OWNd/connection.py:594
Integration: MyHome (documentation, issues)
First occurred: 02:47:06 (6 occurrences)
Last logged: 07:36:11

Event session crashed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/OWNd/connection.py", line 582, in get_next
    return OWNMessage.parse(data.decode())
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 166, in parse
    return OWNEvent.parse(data)
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 323, in parse
    return OWNSceneEvent(data)
  File "/usr/local/lib/python3.10/site-packages/OWNd/message.py", line 1289, in __init__
    self._human_readable_log = f"Scene {self._scene} is {_status}."
UnboundLocalError: local variable '_status' referenced before assignment

I have to try with MH201 and try them together with different configurations.