New Vantage InFusion integration using AsyncIO

Ok, last night I decided on a whim to give this a go, converting my setup from the awesome integration @gjbadros created. (Thanks Greg!) I was a bit nervous, given the size and complexity of my setup, but I think I now have it all working. What I learned along the way:

  • The install and setup of this integration is really slick using HACS. I like the pushbutton install, and no editing of YAML files. One hitch I ran into: I also had Greg’s Vantage integration installed, and it has the same name (“vantage”), which means I had to uninstall it to get yours to install.

  • It created new entities for every Vantage object in my house. For me this meant 378 new devices in Vantage to deal with.

  • My devices all got new names assigned to them. So I had 22 loads called “light.cans_1”, “light.cans_2”, etc. Figuring out what was what so I could assign logical names to them was a pain. The only saving grace was that the loads got assigned areas based on the room they are in (but not the room hierarchy. So if I had two rooms names “Bath” on different floors of my house in Vantage, they both got called “Bath” by this integration).

  • I now have 36 devices named “Back Box 1” or “Back Box 2”, and have no idea what they are or what they are for. Every keypad has a device, and I’m also unsure what one uses those devices for.

  • The representation of Gmem variables as Home Assistant variables is really nice, allowing me to treat them more consistently than I did under Greg’s integration.

  • I now have 174 sensors all named “Dry Contact 1”. No idea what they represent.

  • My motion sensors got imported as binary_sensors, when previously they were sensors. Not a big problem, except my automations were set up to differentiate between “Violated” and “Normal” states, while binary_sensors are ‘on’ or ‘off’.

  • Button press events didn’t have useful names associated with the buttons, so I had trouble reworking my automations to tell what button was pressed. It was only after I finished that I realized it was using the button name from the Vantage config (and my Vantage installer never gave the buttons names, since Vantage doesn’t use that info for anything useful…).

Given how many automations I have created in both the UI and with hand-crafted YAML, it took me about 7 hours of work to do this transition. But hopefully it all works now. :slight_smile:

Chris

I found my first bug! :slight_smile:

I was trying to figure out why my automation to dim my porch lights was actually turning them off. And I figured it out.

If you set the brightness of a light in Home Assistant to a value between 36% and 100%, then this integration sets the value correctly in Vantage. But if you set it to a value between 35% and 1%, then this integration sets it to a value one lower in Vantage. I’m going to guess there is a rounding error somewhere?

In particular, if you set the brightness to 1% (which I believe is supposed to be the dimmest a load can be yet still be turned on), then this instructs Vantage to set the load to 0% (which is off).

This gets frustrating when you open a slider in the UI to set brightness, and try to slam it down to the bottom since “I want minimal brightness” and it turns the lights completely off. (If I wanted that, I’d hit the off button directly beneath the slider…)

@loopj Is this the correct forum for bug reports? Or would you prefer them to be filed on Github? (Or for me to dig through the code and send a pull request once I find the bug?)

Hey Chris, thanks for all the feedback!

I use GitHub Issues to track bugs and feedback, but I also occasionally check here.

I’ve created a few issues to track your feedback and bug report:

Brightness off by one:

Configurable entity naming (would love your feedback on this one):

Hide BackBox “devices”:

I’m curious where the “Dry Contact 1” sensors are coming from.

Do you have DryContact objects set up as Auxiliary objects under any of your Keypads?:

Did these “Dry Contact 1” objects not show up in your previous integration?

Thanks again!

P.s. button press events should contain plenty of information to identify the button:

Can you not use button_text1 or station_name and button_position to identify your buttons?

Let me know if those don’t work.

Ok, by grepping through the entities database and Vantage XML config file I’ve identified the Dry Contact sensors.

I previously had an Elk security system connected to my Vantage via RS-232. (It is now connected to Home Assistant.) When it was connected to Vantage, the Vantage software created a stub Dry Contact for every theoretical port that could exist on the Elk, even though I don’t have my Elk system maxed out with expansion modules.

So these Dry Contacts probably showed up under the old integration, and I just long forgot that I deleted or disabled them years ago.

Which leads to another feature request: if the VID was attached in a user-visible way to entities, then it would be easier to track down odd things like this.

I’m using the VID to identify buttons, which works fine. My Vantage installer didn’t set the button_text1 and station_name fields to unique useful strings, so I wasn’t able to use that (and I’m apparently too lazy to go back and add useful strings). Just took me a bit to figure out.

Quick question – I’m currently running Vantage Design Center 3.9. I’ve gotten an update to 4.9.0. Has anyone tried the 4.9.0 version of Vantage with this integration? (I assume the answer is “yes, of course”, but paranoid me wants a proof-of-it-working before I commit to an upgrade.)

I know of at least one user of this integration that is using 4.9 without issue!

Hi @loopj ,
Does this integration allow use of Vantage keypads to control other devices within Home Assistant? For example, can I through Home Assistant program a Vantage keypad button press to control Philips Hue lighting?

My house is currently being rebuilt (hurricane Helene) and I’ve been interested in Vantage adorne keypads, but my house previously used all Philips Hue lamps.

I have a similar but more basic question. I have added this integration and discovered 130 devices, including some but not all of my Vantage keypads. Those keypad devices have no entities, though, and when I select one of the keypads as the trigger for an automation, the UI tells me the device has no triggers. What am I missing here? How do I use a button press to trigger an automation?

EDIT: I figured it out. Sorry, new to HA and didn’t understand how to create an automation using an event. The answer (or at least one answer) is as follows:

1, For the new automation trigger type, select “Manual Event”
2. For event type, enter “vantage_button_pressed” (without the quotes)
3. For event data, copy and paste the event payload sample code in the integration’s documentation:

      {
          "button_id": 250,
          "button_name": "Lights",
          "button_position": 1,
          "button_text1": "lights",
          "button_text2": "",
          "station_id": 249,
          "station_name": "Office Keypad"
        }
  1. Replace the values for each key to match those for the particular button on the particular Vantage keypad (see below for how to find these).
  2. Add any conditions for the automation as usual.
  3. Add the action for the automation as usual.

Note that you need not include all the lines of data above; you need only enough to uniquely identify the button that is pressed. For me, that’s just the button_position and the station_id (for button_position on a 6- or 8-button keypad, Vantage numbers buttons down, 1 through four, then the second column down 5 through 8, and for a 6-button keypad, there is no button 4 or button 8, so button 5 is always top right).

So where do you find the relevant Vantage parameters? If you happen to have a well-documented Vantage system, you may have all the station IDs already, and the button positions are as noted above, but to see all the parameters for a given button press, do this:

A. Go to Events under Developer Tools
B. Scroll down to Listen to Events
C. For event to subscribe to, enter “vantage_button_pressed” (without the quotes)
D. Click “Start Listening”
E. Press a keypad button
F. Observe the data values in the window

FURTHER EDIT:

You also can call a Vantage task as a service from an automation. To test this, try the following:

(1) Go to Actions under Developer Tools
(2) If in YAML mode, click “Go to UI Mode”
(3) For the action, select “Vantage InFusion: Start task”
(4) Enter a Vantage task ID (see below for how to find this)
(5) Click “Perform Action”

To see what Vantage tasks fire upon a given button press (and thus to find the task_id and task_state), do this:

(a) Go to Actions under Developer Tools
(b) Scroll down to Listen to Events
(c) For event to subscribe to, enter “vantage_task_state_changed” (without the quotes)
(d) Click “Start Listening”
(e) Press a keypad button
(f) Observe the data values in the window

If the button-press initiates one or more Vantage tasks, you’ll see each one in the window. For me, some of the tasks turn on or off a light load, toggling to ramp it up to whatever level is set in Infusion (that data is not exposed, best I can tell) or to ramp it down to off, using the ramp time set in Infusion (also not exposed). When a light is toggled on, I can see that its task_state is set to 1 and for off it is set to 0. In my setup, it appears that some Vantage variables are getting set as well (one set to 1 if the load is on at all, one set to 1 if any load in a group is on, etc.). I imagine this all depends on how your Vantage system is programmed; I intend to ask my dealer for documentation on this, but if he’s reluctant to provide it or it doesn’t exist in a usable form outside the Design Center software, I plan to use trial and error to figure out what these are, then hopefully I can use their states as conditions in automations.

To test a task in Actions, at least to test the tasks that ramp a light load up/down, I just enter the task_id and it works. Once you establish the same for your system, click the “Go to YAML Mode” button to see how the action is expressed in code. Then you can transfer that to the action of an automation by calling it using vantage.start_task.

I am guessing that I’ll discover (or learn, if I can get my hands on documentation of my programming) that other sorts of Vantage tasks exist that I may need to call using parameters, if this integration and the Vantage API even support that.

Hope this is helpful, but bear in mind that I’m very new to this and may have something wrong or may describe something that applies only to my particular Vantage setup. All corrections and clarifications very much appreciated.

1 Like

loopj or colohan, I’m trying to find a way to download from Infusion a list of my Vantage tasks (and other useful such info) without having access to the Designer software. I can connect via Telnet, and a “help” command shows, among other things, a “dump” command with optional parameters that include “task,” “device,” info," and “full.” Just guessing these might give me some of what I seek, but they require a parameter for “controller.” The command runs (i.e., doesn’t give a parameter error) when I use one of the letter-number combos displayed on the screen of the controller, but nothing comes back aside from “[A [A” followed by the command I issued.

Am I at all on the right track here? Is this doable? Or would it be achievable via the API such that I should submit an enhancement request for that? Otherwise, absent a cooperative dealer, I’m relegated to capturing the info from logs by running every scene and pressing every button in my house, which is in the hundreds.

If you are comfortable with running python scripts you can do this very easily by using aiovantage:
https://aiovantage.readthedocs.io

from aiovantage import Vantage

async with Vantage("ipaddress", "username", "password") as vantage:
    async for load in vantage.tasks:
        print(f"{task.id} {task.name}")
1 Like

Hey @brantm I’m doing that with the following technique. this is a total hack, and I think it can be replaced w.out the loop out to MQTT by just waiting for a keypress event. this is described by @synergy1281 above. I just sort of brute forced it through having done a lot of message buss programming in the past. ( the old ‘everything is a nail’ problem, right? )

so I define a task in Design Center (DC) for the button which switches on a variable.
I have an automation in HA which listens to all events from vantage and publishes them to MQTT.
I have an automation in HA with listens to MQTT for the event and then ‘does the thing’ with the 3rd party equipment. in my case it’s ThirdReality smart plugs with LED strips for shop and kitchen worklights.

now this is certainly the long way around! I do this for 1) debugging visibility via MQTT explorer 2) using a Vantage task allows me to control the LED state of the button. which is a big WAF deal in my situation, as the family is used to navigating the lighting world by having buttons lighting up to show that they have triggered a load… and there isn’t a way to do that from the 3rd party controls.

I believe aside from the @synergy1281 technique, @loopj has mentioned that I can watch Vantage variabes as HA variables. I’m going to give those a shot :slight_smile:

1 Like

Thanks, loopj. I have no experience with Python, but back in the day I did some programming in C and C++, so I figured this would be a good excuse to learn the basics. I did some reading on Python and I’ve got Python and PyCharm loaded. I have added the aoivantage library, but when I run the script you suggested, I get this error:

async with Vantage("192.168.XX.XX", "XXXXX", "XXXXX") as vantage:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

SyntaxError: ‘async with’ outside async function

Any notion what’s happening there? Am I missing an “include” or maybe I need to add the port to my host IP address?

Here’s a full example that does exactly what you want:

python dump_tasks.py 192.168.x.x --username xxx --password xxx

Hopefully that helps!

Thanks, @loopj. Can you shed any light on how to program a button-hold event on a Vantage keypad? I’m able to use the vantage_button_pressed and vantage_button_released events, but I’m hoping to duplicate Vantage’s ramping functions that increase and decrease brightness for a light load when the button is held.

For example, in Vantage, I have Task 724 that shows this for the Task Sequence:

 1 Dim 'Main Floor.Living Room : Fireplace Lamps, Window Lamp'

In the Controlled Objects report from Vantage, I find this:

 B631-470-1 MEDIUM LAMPSA : Main Floor.Living Room : Living RM (471)

In the Task Triggers report, I have this:

 MEDIUM LAMPSA (471) B631-470-1 (button)

The button-pressed and button-released events for that trigger are shows as follows (they are identical):

 Button Pressed Living Room (724)
 Controls Object(s):
     C1-3A-1-5 804 : Fireplace Lamps : Main Floor.Living Room (476)
     C1-3A-1-6 805 : Window Lamp : Main Floor.Living Room (477)

Somewhere in Vantage, that’s designated as a toggle (using the LED status, I’m guessing), so a single press either turns on or turns off the loads at VIDs 476 and 477. Also somewhere in Vantage, there is programming setting the default brightness level for this on the button-pressed event.

Vantage also shows a button-held event that simply says this:

 Living Room (724)

Somewhere in Vantage (by configuration or by native functionality, I don’t know which) is logic that ramps both loads for event 724 either up or down when the button is held. It increases if the last press decreased the brightness and vice versa (i.e., it’s a toggle).

Is there an event in your integration that mimics this or do I have to write a do-while loop that continuously increments the load brightness between the vantage_button_pressed and vantage_button_released events?

Here’s a home assistant blueprint for triggering an action when a button is pressed or held for more than N seconds:

Awesome, thanks. Looks like you have the port number hardcoded somewhere as 2010. I need port 3001. Can you please point me to that?

I’m guessing you are running an older Vantage controller firmware which doesn’t have the SSL ports open.

I’ve just updated all the examples to support a --no-ssl flag:

You can now try:

python dump_tasks.py 192.168.x.x --username xxx --password xxx --no-ssl

Hello and thank you, I know the Vantage Infusion system well, I would like to integrate the virtual thermostats (which are for example those thermostats that you create having installed only the temperature probes), how can I do it? can I insert them by adding a configuration in the yaml file ?