Hey Insteon users!

That’s not the way we do things.

OK, I will post here. You can figure it out as this is just personal interfaces.

Feel free. Many chunks go in different files. Have at it

# Input Selects

insteon_devices:
    name: Target Insteon Device
    options:
      - None
    icon: mdi:home
    
insteon_groups:
    options:
      - None
    icon: mdi:home
    
insteon_modem_groups:
    options:
      - None
      
# sensors

# Get the ALDB record for the modem
- platform: command_line
  scan_interval: 30
  name: insteon_modem_aldb
  command: "jq '.[0]' insteon_devices.json"
  value_template: "{{ value_json[0].address }}"
  json_attributes:
    - aldb

# Get the entity name from the input select dropdown by parsing it out from ( )
- platform: template
  sensors:
     selected_insteon_device:
        value_template: "{{ states.input_select.insteon_devices.state.split('(')[1].split(')')[0] }}"
     targeted_insteon_group:
        value_template: "{{ states('input_number.target_insteon_group')|int }}"

# Template sensors

sensor:
# Given a group, get all the targets for that group
# This requires two pieces of information, the target address as well as the group number for multi-button, multi-outlet devices
  - name: "insteon_device_groups"
    state: "{{ 'OK' }}"
    attributes:
        in_groups: "
{% set aldb = state_attr('sensor.insteon_modem_aldb','aldb') %}
{% set gp = namespace(groups=[]) %}
{% for key, value in aldb.items() %}
{% if (value.group | int == states('input_select.insteon_modem_groups') | int) and (value.in_use) %}
{% set gp.groups = gp.groups + [(value.target[0:2]+'.'+value.target[2:-2]+'.'+value.target[-2:]+'_'+value.data1 | string) | upper] %}
{% endif %}
{% endfor %}
{{ gp.groups | unique | sort | list }}"

# Given the targets for a group, return a list of the entities 
  - name: insteon_group_entities
    state: "{{ 'OK' }}"
    attributes:
        scene_entities: "
{% set gp = namespace(groups=[]) %}
{% for ent in integration_entities('insteon') %} 
{% if state_attr(ent,'insteon_address') + '_' + state_attr(ent,'insteon_group') | string in state_attr('sensor.insteon_device_groups','in_groups') %} 
{% set gp.groups = gp.groups + [ent] %}
{% endif %} 
{% endfor %} 
{{ gp.groups | unique | sort }}"

# automations (these are here to update input_selects and input_numbers as needed

# Sets the options for all established groups in the modem ALDB
- id: '1652294634942'
  alias: Set Insteon Device Groups
  description: ''
  trigger:
  - platform: time_pattern
    minutes: '1'
  - platform: homeassistant
    event: start
  condition: []
  action:
  - service: input_select.set_options
    data_template:
      entity_id: input_select.insteon_modem_groups
      options: '{% set aldb = state_attr(''sensor.insteon_modem_aldb'',''aldb'') %}
        {% set gp = namespace(groups=[]) %} 
        {% for key, value in aldb.items() %} 
        {% if value.group > 19 and value.in_use %} 
        {% set gp.groups = gp.groups + [value.group] %} 
        {% endif %} 
        {% endfor %} 
        {{ gp.groups | unique | sort }}

        '
  mode: single
  
  # Creates the select input options with a list of Insteon entities
- id: '1651436131649'
  alias: Set Insteon Select Options
  description: ''
  trigger:
  - platform: time_pattern
    minutes: '1'
  condition: []
  action:
  - service: input_select.set_options
    data_template:
      entity_id: input_select.insteon_devices
      options: '{% set dv = namespace(devices=[]) %}  
      {% for ent in integration_entities(''insteon'') %}  
      {% set entry = state_attr(ent,''friendly_name'') + " (" + ent + ")" %}
      {% set dv.devices = dv.devices + [entry] %}   
      {% endfor %}  
      {{ dv.devices | sort }}

        '
  mode: single





# Change the Target Insteon Group if an existing scene is picked
- id: '1652559762923'
  alias: Change Target Insteon Group
  description: ''
  trigger:
  - platform: state
    entity_id:
    - input_select.insteon_modem_groups
  condition: []
  action:
  - service: input_number.set_value
    data_template:
      entity_id: input_number.target_insteon_group
      value: '{{ states(''input_select.insteon_modem_groups'') | int }}'
  mode: single

and of course the page:

  - theme: Backend-selected
    title: INSTEON
    path: dev
    icon: ''
    badges: []
    cards:
      - type: vertical-stack
        cards:
          - type: custom:auto-entities
            card:
              type: entities
              title: Insteon Group Explorer
              show_header_toggle: false
              state_color: true
            filter:
              include:
                - entity_id: input_select.insteon_modem_groups
                  options:
                    state_color: true
                    icon: mdi:devices
              exclude: []
          - type: custom:auto-entities
            card:
              title: Group Devices
              show_header_toggle: false
              type: entities
            filter:
              template: >-
                {{ state_attr('sensor.insteon_group_entities','scene_entities')
                }}
      - type: vertical-stack
        cards:
          - type: custom:auto-entities
            card:
              type: entities
              title: Select Device
              show_header_toggle: false
              state_color: false
            filter:
              include:
                - entity_id: input_select.insteon_devices
                  options:
                    state_color: true
                    icon: mdi:devices
              exclude: []
          - type: custom:auto-entities
            card:
              title: Set Device Properties
              show_header_toggle: false
              type: entities
            filter:
              template: '{{ states.sensor.selected_insteon_device.state }}'
            options:
              type: custom:slider-entity-row
              state_color: true
          - type: custom:auto-entities
            card:
              type: entities
              title: Select Insteon Group
              show_header_toggle: false
            filter:
              include:
                - entity_id: input_number.target_insteon_group
                  options:
                    icon: mdi:home
      - type: vertical-stack
        cards:
          - type: horizontal-stack
            title: Add/Delete from Insteon Group
            cards:
              - type: custom:button-card
                icon: mdi:home-group-plus
                name: Add
                styles:
                  card:
                    - height: 100px
                hold_action:
                  action: call-service
                  service: insteon.add_all_link
                  service_data:
                    mode: controller
                    group: >-
                      [[[ return
                      parseInt(states["input_number.target_insteon_group"].state)
                      ]]]
                  confirmation:
                    text: >-
                      [[[ return "About to add:\n\n" +
                      states["input_select.insteon_devices"].state + " to group
                      " +
                      parseInt(states["input_number.target_insteon_group"].state)
                      + "\n\nSelect 'OK' and go to the " +
                      states["input_select.insteon_devices"].state + " and press
                      the set button." ]]]
              - type: custom:button-card
                icon: mdi:home-group-minus
                name: Remove
                styles:
                  card:
                    - height: 100px
                hold_action:
                  action: call-service
                  service: insteon.delete_all_link
                  service_data:
                    group: >-
                      [[[ return
                      parseInt(states["input_number.target_insteon_group"].state)
                      ]]]
          - type: horizontal-stack
            title: Test Insteon Group
            cards:
              - type: custom:button-card
                icon: mdi:lightbulb-multiple-off
                triggers_update: all
                name: 'Off'
                styles:
                  card:
                    - height: 100px
                tap_action:
                  action: none
                hold_action:
                  action: call-service
                  service: insteon.scene_off
                  service_data:
                    group: >-
                      [[[ return
                      parseInt(states["input_number.target_insteon_group"].state)
                      ]]]
              - type: custom:button-card
                icon: mdi:lightbulb-multiple
                triggers_update: all
                name: 'On'
                styles:
                  card:
                    - height: 100px
                tap_action:
                  action: none
                hold_action:
                  action: call-service
                  service: insteon.scene_on
                  service_data:
                    group: >-
                      [[[ return
                      parseInt(states["input_number.target_insteon_group"].state)
                      ]]]

That should be everything, good luck! Unfortunately I guess that is the way we do things.

1 Like

So I have another issue where HA cannot load the All-Link Database from some of my devices (I get the message “The All-Link Database has not been loaded. Please load from the device” after a couple seconds when I try to load it manually from the device). And for these same devices it also fails to write to the devices (I get the error “The device did not respond as expected to the write request.”). I can still control most of these devices from HA just fine but in some cases the switch in HA doesn’t work either. I have many Insteon devices (many are dual band) in my house along with a couple of range extenders so signal is not an issue. Any ideas anyone?

If you’re using the PLM it might be worth troubleshooting with Linknet ( https://www.insteonsoftware.com/ ). You’ll need to stop HA or connect your PLM to another machine to use it.

Using Hub v2 unfortunately. But I will look into this, thanks.

Can one expect more reliability, better performance, etc. by using an Insteon PLM vs a hub? Is there an easy way to change the integration from a hub to a PLM in HA without having to delete the integration and re-add all of the devices from scratch? This would be a huge task for me as I have 40 devices and 70 entities.

Question: Why would you change from the Hub? It is afterall a PLM. So the statement someone made about you needing a PLM maybe applies because the code written does not support the Hub. I do not know.

But a Hub is a PLM.

The original hub had a proper network accessible PLM. I stuck with the 2413U to keep things out of the cloud when I started with SmartenIt then OpenHAB back in 2014, The v2 was built to be cheap. Insteon practically gave them away. The advancements HA has made in working with the v2 hub is probably farther along than any other open source project that I’m aware of. The software I mentioned is designed to work with all the PC attached PLM models and is a great alternative for troubleshooting versus old legacy software like Houselinc.

Exactly, so my answer stands. The person asked about a Hub v2. It is a PLM. so I would expect nothing in terms of their question (performance) which is funny any way.

Hub 2254-222 is perfect. I own four, rev 2.3 to rev 3.4 I think. My oldest/main which is still fine is the 2.3 which I put in over 6 years ago. And note, I only own four now to make sure before I die everything will still work. Given 6 years/hub * 4 hubs … I will be gone by them :slight_smile:

Appreciate the insight. When I asked about performance, I thought I read somewhere that HA communicated with the hub through polling of a web interface vs a different approach with a PLM. But I see there is no need to make any change there. The real root of this question was around the fact that since the last couple versions of HA or so have been released, I now have about 8 out of my 40 Insteon devices no longer responding in the Lovelace dashboard. I click the switch, nothing happens, and a couple seconds later the switch moves back to it’s original position. Resetting the devices, restarting HA, unplugging the hub, all have no effect. These were working fine in Lovelace before. It’s also not a signal strength issue, I have many dual band devices, a couple of range extenders just for good measure and I literally have situation where out of three dimmers in the same wall box, one of them doesn’t respond in Lovelace. This makes no sense and I’m really starting to think that something changed recently in the HA code. Anyone else having this issue?

Are these actually load switches or like extra buttons in a 6-button controller?

All load switches. Mostly dimmers.

I have this issue as well. Following to figure out how to fix!

Me too, problem started a few days ago. If I manually turn on a switch the light constantly flash.

I’m new to Home Assistant. Looking for how to generate alerts or actions based on inputs. Could you explain what the above code does? makes no sense to me yet. Nor does any examples I can find in the Docs.

But a Hub may be constantly trying to call home while a PLM should not. (A USB or Serial PLM isn’t connected to the network). (A Network connected PLM might still be trying to call home).

Really I think you are better off starting here Understanding Automations - Home Assistant but in brief the automation I quoted:

  • has the name Turn Scene 25 on - that’s the alias line
  • doesn’t run again if triggered again while it is running (that’s the mode line)
  • Runs when someone or something changes the state of the input boolean called ‘test’ to ‘on’
  • Has no conditions, a condition might be “if it is dark”
  • and then turns on scene 25

The fact that a Modem “tries to call home” is not relevant. “Calling home” was merely a remote status update that allowed for interaction with remote services like Alexa. It’s not like this:

  1. Push switch
  2. Send to Cloud
  3. Get back result
  4. Take action only on result

Insteon is:

  1. Push switch
  2. Take action
  3. Send to Cloud
  4. Update cloud GUIs with status of lights

If the first example was true no one would be able to turn on a light. You can. Using Home Assistant, using ISY, using 100 other ways. It did (semi) block ALexa turing on lights but that is a 30sec fix if you subscribe to Nabu Casa and a little more complicated if you wish to build your own cloud service.

I find that node red much easier to use for automatons