HassBridge plugin updated for Python3

Posted on
Tue Jul 18, 2023 10:09 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Joe...
Thanks again for all your help. I did some testing with the new plugin and it seems to be sending commands to HomeAssistant fine but it is NOT making changes in Indigo when it receives input from MQTT. I have included debug mode testing information that I tested for both a switch and a light.

To be more specific...
1. all commands from MQTT have a "b" in from of them.. b'OFF' instead of just OFF
2. ON and OFF commands are NOT working but changing the percent to x% IS working
3. I never see any "Refreshing mappings of Indigo devices to HA devices." in the debug log for the new plug-in. In the old plugin it occurred evert 6o seconds

Four Scenarios from debug log below
Scenario 1. OLD Plug-in Switch device class. Turned a switch on and off from HA. I see Command message OFF received on homeassistant...., then a Sent Insteon Back Landscape Light" off. The Indigo device and the HA device and in sync and communicate with each other

Scenario 2: NEW Plug-in Switch device class. Turned the switch on and off from HA. I see the command message b'ON" received on homeasssistant..... but no Sent Insteon Back Landscape Light on or off. Also not sure why it say b'ON' and b'OFF' instead of just ON or OFF as previously

Scenario 3: OLD plug-in light device class. turned the light from HA to a set percentage and that works without issue. I see the command Brightness command message 53 received...... " Sent INSTEON "Front Porch Light" on to 53 and the on and off commands work as before

Scenario 4: NEW plug-in light device class. When I change the light percentage from HA this seems to work. I do see a b'56' and not a 56. However when I send an on of off command from homeassistant the light does not get a Sent INSTEON "Front Porch Light" ON or OFF command.

I have not done much testing on the variable yet.

Let me know if you need any additional information from MQTT Explorer to help identify the bug

***Lastly, Let me know how I can send you something as a thank you for helping update this plug-in.

Info from Debug.

Scenario 1: Response with previous plug-in

Switch: ( I turned the switch off and on from home assistant)

Code: Select all
   HassBridge Debug                Command message OFF recieved on homeassistant/switch/back_landscape_light/set
   Sent INSTEON                    "Back Landscape Light" off
   HassBridge Debug                Refreshing mappings of Indigo devices to HA devices.
   HassBridge Debug                Command message ON recieved on homeassistant/switch/back_landscape_light/set
   Sent INSTEON                    "Back Landscape Light" on
   HassBridge Debug                Refreshing mappings of Indigo devices to HA devices.

Scenario 2 - New Plug-in:

I do not see and Sent Insteon Commands and there is a b’ON’ instead of just ON…same for all commands with new plugin?

Switch: (I turned on and then off from Home Assistant) NO RESPONSE IN INDIGO

Code: Select all
HassBridge Debug                Command message b'ON' recieved on homeassistant/switch/back_landscape_light/set
   HassBridge Debug                Command message b'OFF' recieved on homeassistant/switch/back_landscape_light/set

Scenario 3: Old Plugin Light device type
Light: (I turned the light on then set to 53%, then turn off from Home Asistant)

Code: Select all
   HassBridge Debug                Command message ON recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" on to 100
   HassBridge Debug                Sending brightness state of 100 to homeassistant/light/front_porch_light/brightness/status


   HassBridge Debug                Brightness Command message 53 recieved on homeassistant/light/front_porch_light/brightness/set
   HassBridge Debug                Command message ON recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" on to 53
   HassBridge Debug                Sending brightness state of 53 to homeassistant/light/front_porch_light/brightness/status
   HassBridge Debug                Refreshing mappings of Indigo devices to HA devices.

   HassBridge Debug                Command message OFF recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" off
   HassBridge Debug                Sending brightness state of 0 to homeassistant/light/front_porch_light/brightness/status
   HassBridge Debug                Refreshing mappings of Indigo devices to HA devices.



Scenario 4: NEW Plug-in
Light: (I turned the light set to 56%, then 86%, then 100% turn off from Home Assistant) – Light does response in Indigo. Still has b’56’ instead of just 56?. When I set he light to OFF or ON from Home Assistant, I get no response in Indigo

Code: Select all
   HassBridge Debug                Brightness Command message b'56' recieved on homeassistant/light/front_porch_light/brightness/set
   HassBridge Debug                Command message b'ON' recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" on to 56
   HassBridge Debug                Sending brightness state of 56 to homeassistant/light/front_porch_light/brightness/status

Jul 18, 2023 at 10:17:24 AM
   HassBridge Debug                Brightness Command message b'86' recieved on homeassistant/light/front_porch_light/brightness/set
   HassBridge Debug                Command message b'ON' recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" on to 86
   HassBridge Debug                Sending brightness state of 86 to homeassistant/light/front_porch_light/brightness/status

Jul 18, 2023 at 10:17:47 AM
   HassBridge Debug                Brightness Command message b'100' recieved on homeassistant/light/front_porch_light/brightness/set
   HassBridge Debug                Command message b'ON' recieved on homeassistant/light/front_porch_light/light/switch
   Sent INSTEON                    "Front Porch Light" on to 100
   HassBridge Debug                Sending brightness state of 100 to homeassistant/light/front_porch_light/brightness/status


Light: Turned on and off from Home Assistant

Code: Select all
   HassBridge Debug                Command message b'ON' recieved on homeassistant/light/front_porch_light/light/switch
   HassBridge Debug                Command message b'OFF' recieved on homeassistant/light/front_porch_light/light/switch


Variables:

Seem to be sending to HA just fine. Will need to test in the other direction.

hassbridge.yaml configuration file contents...

Code: Select all
 
devices:
 Back Landscape Light:           # Indigo device name
    config_vars:
      device_class: switch   # Home Assisntant discovery config entry
  Side Landscape Light:
    config_vars:
      device_class: switch
  Front Landscape Light:
    config_vars:
      device_class: switch
  Front Porch Light:
    config_vars:
      device_class: light

variables:
  Caddx_panelStatus:
    name: Caddx Panel Status
    bridge_type: VariableBinarySensor
    on_value: Open
    config_vars:
      device_class: door

  Front_door_locked_minutes:
    name: Front Door Locked Minutes
    bridge_type: VariableSensor
    config_vars:
      device_class: sensor

Posted on
Tue Jul 18, 2023 10:19 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

You're conflating two plugins in one posting. Please don't do that.

This thread is for HassBridge, which only does Indigo->Home Assistant.

The other thread is for HomeAssistant, which does Home Assistant -> Indigo.

Please revise your posting to split up your testing and results appropriately.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jul 18, 2023 10:34 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Joe..

I do not think that I conflated two plugins. Hassbridge has a two way integration. Changes made in the homeassistant program are sent via MQTT to Indigo and visa-versa.

If you look at the debug log they all start with HassBridge Debug in the events line.

Here is some info from the github original plugin (https://github.com/wonderslug/hassbridge)....

This is an plugin for Indigo Domotics to bridge to Home Assistant using its inbuild MQTT discovery and events system.

It provides a bi-directional bridge for the devices directly controlled by Indigo and allows Home Assitant to be able to be able to control and use those devices. It is able to send actions like button presses to Home Assistant to be able to be handled as events. It also allows for Indigo Variables to be displayed as Sensors in Home Assistant.


Yes you are correct that the other HomeAssistant plug-in allows devices in HomeAssistant to appear in Indigo....

Let me know if I have mis-stated things. I currently have my HomeAssistnant Plugin turned off during testing so I am pretty sure the information I provided previously is referencing the HassBridge plugin only.

Posted on
Tue Jul 18, 2023 11:40 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

My mistake on the plugins. Sorry about that.

I think the problem was that the HA MQTT service is sending payloads as bytestrings, not normal strings. In Python2, those were the same. Not in Python3. I think I fixed that in this release.

https://github.com/FlyingDiver/hassbrid ... g/2022.0.3

In the future, please don't use font size changes for log files, etc. Use the CODE tags instead. The smaller font is hard to read for my old eyes.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jul 18, 2023 12:15 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Awesome...

Sorry about the font will use code next time. I thought I was trying to be helpful...obviously not.

Plugin seems to be working correctly now. I only see two differences which I think are insignificant?

1. During debugg in there is still a "b" in front of the command message

Code: Select all
  HassBridge Debug                Command message b'OFF' received on homeassistant/light/front_porch_light/light/switch


2. There is not a message stating that Refreshing is occurring.... but my guess is that it is? (It occurs every 60 seconds with the old plugin.)

Code: Select all
HassBridge Debug                Refreshing mappings of Indigo devices to HA devices.

Posted on
Tue Jul 18, 2023 12:17 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

Yes, that log message is generated BEFORE I convert the payload to a string. So working as expected.

The refreshing message was annoying me, so I moved it to "Detailed Debugging" status. If you still want to see it, change the debug level.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jul 18, 2023 12:26 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

OK Thanks... but where is the debuggin level status option cuz the plug-in only has one check-box to turn on debuggin without any levels?
Attachments
Screenshot 2023-07-18 at 2.23.49 PM.png
Screenshot 2023-07-18 at 2.23.49 PM.png (37.89 KiB) Viewed 1213 times

Posted on
Tue Jul 18, 2023 12:31 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

Oh, I guess I didn't update that section of the code. I'll try to remember next time I'm in there.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Tue Jul 18, 2023 1:01 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Ok thx

Posted on
Mon Jul 24, 2023 8:18 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3


joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Aug 02, 2023 8:07 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

New Issue with HomeAssistant 2023.8.0 (Not present before and will stop working in 2024.2.0

I looked at the plug-in but I have no idea how to modify it to handle this new warning and adjust the plug-in coding

Thanks in advance for looking into this.

Warning from HomeAssistant:
Some MQTT entities have an entity name equal to the device name. This is not expected. The entity name is set to null as a work-a-round to avoid a duplicate name. Please inform the maintainer of the software application that supplies the affected entities to fix this issue. The devices below are devices shared from HassBridge.

List of affected entities:

switch.outside_lights
switch.back_landscape_light
switch.front_landscape_light
switch.security_lights
light.master_bedroom_light
switch.side_landscape_light
sensor.front_door_locked_minutes
light.front_porch_light
light.garage_security_light
light.front_porch_security_light


Link to HomeAssistant MQTT Coding
URL Link: https://developers.home-assistant.io/bl ... -entities/

The naming of MQTT entities changes to correspond with HA guidelines
July 21, 2023 · One min read
Jan Bouwhuis
The way MQTT entities are named and how device configuration can be shared between discovered entities has changed

Sharing of device configuration
Discovered MQTT entities can share device configuration, meaning one entity can include the full device configuration and other entities can link to that device by only setting mandatory fields. The mandatory fields were previously limited to at least one of connection and identifiers, but has now been extended to at least one of connection and identifiers as well as the name.

Naming of MQTT entities
Naming of MQTT entities has been changed to be aligned with the entity naming guidelines:

The has_entity_name entity will be set to True on all MQTT entities
Unnamed binary_sensor, button, number and sensor entities will now be named by their device class instead of being named `MQTT binary sensor" etc.
It's now allowed to set an MQTT entity's name to None to mark it as the main feature of a device

Posted on
Wed Aug 02, 2023 9:14 pm
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

How many Indigo devices are you pushing to HA?

Can you turn on debug loggin in HassBridge, restart the plugin, wait for it to finishing initializing all the devices, then post that log? I think I know what they want fixed, but I'm having a hard time finding it in the code.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Wed Aug 02, 2023 9:38 pm
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Just those 10 listed. Will send debug info tomorrow as requested

Posted on
Thu Aug 03, 2023 10:56 am
FlyingDiver offline
User avatar
Posts: 7222
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: HassBridge plugin updated for Python3

Did you see that warning somewhere in the HA UI? I'm trying to replicate the exact conditions, and I'm not seeing that.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Thu Aug 03, 2023 11:02 am
farberm offline
Posts: 393
Joined: Feb 24, 2008

Re: HassBridge plugin updated for Python3

Yes in the HA Errors when I upgraded to 2023.8.0

Who is online

Users browsing this forum: No registered users and 7 guests