Legrand/Bticino MyHome

Both :smiley:

The event session is negotiated once when the integration starts, and normally never needs to be renegotiated (but as we saw, it sometimes fails anyway)
The command sessions are very short-lived, and they typically timeout after 90 to 120 seconds, so for those I negotiate a new one for each command sent, and close it properly each time as well.

Hi,
this is above my knowledge, can you give me an example how to handle this.
many thanks.

I used a always open connection, and in a normal situation I barely had to reconnect, and when I did it has fast and lasted a long time!

In home assistant I’m solving restarting the integration… But I always get a error in every restarting

It restarts ok, but I have the error… Just ignore it

Errors in log

2021-07-19 15:53:29 WARNING (MainThread) [custom_components.myhome] Connection interrupted, reconnecting...
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for light
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/light/__init__.py", line 461, in async_setup_entry
    return await component.async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/switch/__init__.py", line 74, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for cover
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/cover/__init__.py", line 159, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for climate
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/climate/__init__.py", line 162, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for binary_sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/binary_sensor/__init__.py", line 141, in async_setup_entry
    return await hass.data[DOMAIN].async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2021-07-19 15:53:29 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry MyHomeServer1 Gateway for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 293, in async_setup
    result = await component.async_setup_entry(hass, self)  # type: ignore
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 87, in async_setup_entry
    return await component.async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 164, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!

That’s strange, is your gateway appearing multiple times in the integrations panel in HA ?

My Fault , restarted the gateway

Hi Julien,
HA and the Gateway are on the same switch and VLAN .
can you show the automation example to send the Acknowledge
thanks,
dirk

Sure!

Thinking about it more, sending an ACK will probably not be enough since it will ‘stay’ in the command session.
You can send a status query for one of your lights for example, this will force the light to reply on the bus and the traffic will be picked-up by the event session.

Here’s an automation example:

alias: MyHome KeepAlive
description: ''
mode: single
trigger:
  - platform: time_pattern
    hours: '0'
    minutes: '1'
    seconds: '0'
condition: []
action:
  - service: myhome.send_message
    data:
      message: '*#1*00##'

Here you can replace 00 in the message with the <WHERE> for one of your lights.

1 Like

Thanks,

but the automation would not run every minute, it runs only only when i start it manualy

- id: '1627326707146'
  alias: MyHome KeepAlive
  description: ''
  trigger:
  - platform: time_pattern
    hours: '0'
    minutes: '1'
    seconds: '0'
  condition: []
  action:
  - service: myhome.send_message
    data:
      message: '*#1*18##'
  mode: single

Ok works The trigger time_pattern should be like this

- id: '1627326707146'
  alias: MyHome KeepAlive
  description: ''
  trigger:
  - platform: time_pattern
    minutes: '/1'
  condition: []
  action:
  - service: myhome.send_message
    data:
      message: '*#1*18##'
  mode: single

i hope this will solve my problem :slight_smile:

1 Like

Yes, I was about to reply that I got the time pattern wrong :confounded:
Hopefully this will help you, indeed!

Hi, I have a F454 gateway wich is not found when trying to install MyHome. My rasp and the gateway are on the same network
Ran the the discovery script manually but no output. Connecting with python -m OWNd -v 2 -a 192.168.1.82 -p 20000 -P xxxxx works well.
Is there a way to manually configure the gateway during installation ?

Thanks.

can someone please help guiding me how to install this integration?
I can’t find it in the official integration list nor do I see it in the HomeAssistant UI.
Thanks

@Crypt0-M3lon Yes! You can now manually configure the gateway if necessary.
During setup, you will get a dropdown menu to select (one of) the discovered gateway, and you will get a “custom” option as well.
From there you can manually enter your gateway’s details.

@rotman253 This integration is not an official integration, you need to install it with HACS (you’ll need add the “MyHome” repository that’s in the first post of this thread in HACS before it is visible)

@dirk291 Did your issue reoccur since adding the “keep-alive”?

@anotherjulien No till now no problems anymore thanks…

Hello guys and @anotherjulien ,
I’ have updated the F454 firmeware yesterday + changed the gateway IP and… :boom:
Is it possible to define the gateway manually in the configuration.yml ?
When i do python -m OWNd -a 192.168.1.3 -p 20000 -P xxxxxx, i get a beautiful error:

> 2021-08-03 20:06:52,569 - OWNd - ERROR - Received data could not be parsed into a message:
Traceback (most recent call last):
File “/usr/local/lib/python3.9/site-packages/OWNd/connection.py”, line 441, in get_next
data = await self._stream_reader.readuntil(OWNSession.SEPARATOR)
AttributeError: ‘OWNEventSession’ object has no attribute ‘_stream_reader’

Forgot i was using the wrong IP. Now i can connect to the gateway with OWNd but the gateway is not discovered by HA.

Does this ring a bell ? thx

@dominik978 same issue here, I was able to bypass the check by commenting MyHOME/config_flow.py at 0774210e694fb9a979e0ce14a8b0b100a7a93b41 · anotherjulien/MyHOME · GitHub and MyHOME/config_flow.py at 0774210e694fb9a979e0ce14a8b0b100a7a93b41 · anotherjulien/MyHOME · GitHub. It will say that no gateway was discovered but you will be able to setup a custom one :smiley:

@anotherjulien The code is preventing to define a custom gateway if no one is discovered, works well once bypassed! thanks for the good work!

@dominik978 your gateway is not discovered because the ‘key’ used to identify it is the MAC address, so as far as HA is concerned it’s still the same.
There should be a mechanism in place that would update its IP address (among other information) if it’s re-discovered with the same MAC but a different IP. I did not have the opportunity to test it in practice, so I guess it does not work :smiley:

I think you should be able to delete your gateway from the “Integrations” tab, and re-add it.
Otherwise, you could manually edit /config/.storage/core.config_entries and change its IP address there. You’ll need to restart HA after that.

@Crypt0-M3lon good catch! I’ll remove this clause from the next release :slight_smile:

Thanks @Crypt0-M3lon and @anotherjulien . I’ll try your solutions and keep you posted :+1: