Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homeworks support #52

Open
wants to merge 39 commits into
base: master
Choose a base branch
from
Open

Conversation

rzulian
Copy link

@rzulian rzulian commented Apr 22, 2020

This PR is adding:

  • support for Homeworks QS.
  • support for recursive areas in naming
  • areas with IntegrationID are OccupancyGroup
  • revised standard naming for components and keypad components
  • OUTPUT to support movement raise, lower, stop, jogs(eg for motors)
  • buttons: support for actions
  • corrected led states
  • support for QS_IO_INTERFACE
  • support for phantom keypads
  • support for seetouch international keypads
  • support for CCI

Copy link
Owner

@thecynic thecynic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long lack of response, finally went through it all.

In the future I recommend you clean up your patchstack so that the changes collect related code. Seems like you just kept typing "git commit -m 'foo'" periodically, without organizing your improvements into logical changes :)

pylutron/__init__.py Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
@jthop
Copy link

jthop commented May 13, 2020

Guys with more advanced Homeworks systems desperately need this branch merged. The default one can't handle phantoms, any VCRX stuff, international keypads, etc... the CSD001 detection was a great idea. Please, we need this... or can anyone tell me how to force Hassio to use this instead of the default????

@txwindsurfer
Copy link

@jthop I can share my version of the lutron component which is using this branch of pylutron.
I was waiting for this PR to be merged, to open a PR on the Hassio.

I would be happy to test both the lutron component in Hassio and this branch of pylutron on my Homeworks QS system if you would like to share the lutron component.

@jthop
Copy link

jthop commented Jun 10, 2020

Oh yes, I would love to test as well....

@jthop
Copy link

jthop commented Jun 11, 2020

@txwindsurfer would love to see it... scratching my head why these major upgrades for homeworks take so long to be approved???

@thecynic
Copy link
Owner

thecynic commented Jun 13, 2020 via email

@jthop
Copy link

jthop commented Jun 14, 2020

@rzulian fwiw would be nice to have access to homework variables as well... They use command SYSVAR and have integration IDs just like everything else. they aren't reported by default, you have to do a "#MONITORING,10,1" to see them... just an idea, you guys are doing great.

led_logic = button_xml.get('LedLogic')
name = button_xml.get('Name')
led_logic = 0 if button_xml.get('LedLogic') is None else int(button_xml.get('LedLogic'))
name = f"keypad {keypad.id}: Btn {component_number}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still strongly dislike sticking all the other cruft into the name. It should be up to the client to decide how to combine the various names. cdheiser's recent change should allow everything to have a true unique identifier so none of this should be necessary for uniqueness.

Please remove this here and everywhere else, keeping the name as is (and removing engraving).

@@ -446,7 +446,8 @@ def __init__(self, host, user, password):
@property
def areas(self):
"""Return the areas that were discovered for this Lutron controller."""
return self._areas
# return self._areas
return tuple(area for area in self._areas)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh. Only reason I can see is if someone was taking the returned list and modifying it and you wanted to isolate us from that? Is that a problem somehow in HASS?

Since we don't do this everywhere else, I suggest you removed this and keep as is. If that's a worry somehow, it should be a separate PR to generate a copy for all these APIs to keep us safe, and we can discuss the merits then.

_ACTION_START_RAISING = 2
_ACTION_START_LOWERING = 3
_ACTION_STOP = 4
_ACTION_JOG_RAISE = 18
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are internal constants inside this component. You shouldn't be using them from an external library. We should figure out the right API for that and not create an inadvertent dependency on these names from our clients.


def is_light(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my point is that you still don't know what's on the other end of the load, so we shouldn't pretend. Get rid of is_light() and just improve 'is_dimmable' logic by itself.

HOLD_RELEASED = 5


def __init__(self, lutron, keypad, name, num, button_type, direction):
def __init__(self, lutron, keypad, name, engraving, num, button_type, direction, led_logic):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, LED state, ok. Yeah I only have radio ra2 and their feature-set is quite minimal (I get on/off 😞 ), sadly. I'm jelly of Homeworks. I'd do anything for that double-tap :)

I really don't want to expose things like led_logic as bare ints without proper enum constants is that it ends up spreading weird droppings like this with no concept of what they mean, and suddenly HASS has a random 5 somewhere. You need to add a better API for the client to figure these things out. At least provide a named enum for 0-3 that we can keep stable, and also add a CUSTOM or INTEGRATION for your 5.

Thought, actually this is all a property of an LED, and not of the button, isn't it? Why can't you instead delegate the LED control to the Led class?

Also, Does LED state change gets its own event? I don't remember.

pylutron/__init__.py Outdated Show resolved Hide resolved
button_type=button_type,
direction=direction)
direction=direction,
led_logic=led_logic)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the problem is that you have like 20+ changes with stuff scatted all over them with no logical breakdown between the individual changes. So I'm sure this gets used, but in some other git commit. Github almost incentivizes bad habits :( I'm used to, and prefer, seeing one git commit per logical change, and a stack of commits that logicall follow each other adding incremental functionality.

pylutron/__init__.py Outdated Show resolved Hide resolved
pylutron/__init__.py Show resolved Hide resolved
pylutron/__init__.py Outdated Show resolved Hide resolved
@robby-d
Copy link

robby-d commented Aug 24, 2020

Hi, I wanted to note that as of Homeworks v16, and with the new Homeworks QSX processor (released earlier this year) it appears that telnet support is being discontinued in favor of Lutron's LEAP API. I can't find published specs to that yet.

More info: https://forums.lutron.com/showthread.php/15404-Is-QSX-replacing-QS-processors-or-will-they-serve-different-purposes

Basically, it looks like Lutron just removed telnet support entirely in Homeworks v16. No depreciation warning/time period.

@jthop
Copy link

jthop commented Aug 24, 2020 via email

@thecynic
Copy link
Owner

thecynic commented Aug 26, 2020 via email

@rzulian
Copy link
Author

rzulian commented Sep 23, 2020

@thecynic : could you please have a final review and approve this PR?

@txwindsurfer @jthop : If you want to try the current branch I've a repo with the Lutron custom component here https://github.com/rzulian/lutron_custom_component

@txwindsurfer
Copy link

Great work @rzulian! I added your files into custom_components/lutron and upgraded to the latest version of HA (0.116.0.dev20200923) on my test system and now I have the buttons on my keypads mapped as scenes (albeit no unique id so can't manage in UI). I also now have occupancy binary_sensors mapped for each room but since I don't have occupancy sensors I am guessing they are default entries in the Lutron schema. From a naming convention, I wasn't using the 1st floor or 2nd floor designation in the names of my objects so if I adopt your integration I will need to change lots of names. Adding unique ids to the objects would greatly help in managing the names from the UI. Thanks for sharing and your continued work!!

@rzulian
Copy link
Author

rzulian commented Sep 24, 2020

@txwindsurfer :

  1. scene UI. my bad :( I've uploaded a new version that fix this, including in the scene name the keypad_name
  2. occupancy sensors. I'm assuming that if your area has an integration ID there is a occupancy sensor. This is how it's working on my installation. Is it your setup different?
  3. naming. I'm using the full path for the area name because I've duplicated area names in different locations. I could add an option on the HA config to use the full path or only the area name.

@txwindsurfer
Copy link

@rzulian:

I appreciate again your work and realize that designing for may different systems is difficult if not impossible. So with that premise, I kindly offer the following comments:

1a) First ignore my previous comment on unique ids for the scenes as it really doesn't make sense to edit scenes in the UI as an edited scene cannot be passed back to Lutron. Editing scenes for Lutron keypads is best done in Lutron Designer.

1b) Second, the addition of the keypad_name didn't add information for my installation since the DeviceGroup Name already identified the keypad.
My keypad buttons now looks like:
1st Floor Entry keypad: 25: Btn 1
Rather than the keypad number or the button number, I would love to have Engraving which identifies the button in english. DeviceGroup Name + Engraving would look like:
1st Floor Entry Sconces
And, finally if I had the choice to drop the full name for the scene I would get:
Entry Sconces
which would be just perfect for my installation.

  1. Lutron Designer tells me I do not have any occupancy sensors (and I don't), however each area in the XML has this entry which might be causing the creation of occupancy sensors.
    -<Area UUID="859" Name="Front Porch" SortOrder="0" OccupancyGroupAssignedToID="861" IntegrationID="20">
    Since I do not have an occupancy sensor, I cannot give you an example of what a real XML occupancy sensor entry would look like, but having an integration ID doesn't mean there is an occupancy sensor in my installation.

Just FYI, the XML file also has an OccupancyGroups section even though I don't have any sensors so that should be ignored.

Thanks again for your great work. It is really appreciated

@rzulian
Copy link
Author

rzulian commented Oct 13, 2020

@txwindsurfer
Regarding 1b. I've evaluated to use engraving in names, but I've multiple buttons in different keypads in the same area with the same Engraving, so the names are not unique. I don't know if I can use a friendly name instead. Any suggestion?
Regarding 2. I'm using Lutron designer 9.4. I've had to add to the integration ID the areas with an occupancy sensor to make sure I'm getting the occupancy sensors.
Screenshot 2020-10-13 at 14 34 55

@txwindsurfer
Copy link

@rzulian
1.b. I didn't think about the same engraving being on the same keypad--that would be a problem. Having engraving as the Friendly Name would be great. You might consider concatenating the engraving to the end of the device+button string but then the string might be too long.
2. I am using Designer 10.7 and the versions do change quite a bit I have heard. In fact, the biggest problem I suppose with doing QS in HA is there are to many different devices and firmware/software versions. No idea how to account for them all. It is easy enough to tailor what you have done to my setup so thanks again for the great work.

@rzulian
Copy link
Author

rzulian commented Oct 15, 2020

@txwindsurfer
1.b I meant the same engraving being on different keypad in the same room. Think about large rooms, you might need to have the ability to recall the same scenario from different keypads
2. I don't have access to 10.7, as I'm not a certified Lutron developer :(

ronluna added a commit to ronluna/pylutron that referenced this pull request Mar 25, 2024
ronluna added a commit to ronluna/pylutron that referenced this pull request Mar 25, 2024
Initial merge for Homeworks QS support from
thecynic#52
* added UUID and legacy UUID
* OccupancyGroups from xml
* added flash for Output
* Button events renamed and aligned to the Lutron documentation
* Led state as value
* XLM loadfrom cache or store to cache
@txwindsurfer
Copy link

@rzulian @thecynic Thank you so much for all the attention to the Lutron Integration. Could you please add 'HWI_SLIM' to the list of keypads around lines 302. With this addition, my keypad buttons show up as intended on the event bus and as event entities.

From my DbXmlInfo for one of the keypads:
Device Name="CSD 001" UUID="2104" SerialNumber="4026536452" IntegrationID="71" DeviceType="HWI_SLIM" GangPosition="0" SortOrder="0">

@rzulian
Copy link
Author

rzulian commented May 3, 2024

@txwindsurfer
I'm going to add the support for "HWI_SLIM". I'm also working on a new version of the custom component, which I have aligned to the official "lutron" component, thanks to @ronluna.
I'm adding the ability to:

  1. flag if you want to refresh data from Lutron each time you instantiate the integration
  2. flag if you want to use the full path as area name, which is useful if your layout has areas included in other areas
  3. flag if you want to prepend the area name to the device name (e.g you have multiple lights named "Applique", in multiple rooms. Using this flag you will have room1 Applique, room2 Applique, etc)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants