Hey Insteon users!

Funny, got an email that you can now subscribe to Insteon Cloud. So I wanted to ask a question … simply … I do not want Insteon Cloud subscription BUT I want to change some basic things like IP address and userID/password.

So I thought … well if you are selling now Cloud subscriptions you must have re-instated the support forum.

This site can’t be reached

forum.insteon.com took too long to respond.

Who in their right mind starts to sell things without having a support forum for issues?

A question for those that may have done anything with my Insteon Explorer code … I think next I want to add an automation that will call group.set with the entities that are in an insteon group. This would give HA control to the group … naming them like “insteon_group_21”. Then they could be used to see the state of the whole group (on/off) for like custom buttons.

Sound like something you would all like? I already can get all the entities in a group, would be easy to rebuild that into groups.

OK, I added it as it was very easy. Now you can create/update a Home Assistant Group that mirrors the Insteon Scene. This allows you to use a state of the Insteon Group (really Home Assistant Group) . For example, I can update a custom button card with the state if every member is “on”.

Clicking on Create Home Assistant Group:

Yields this now:

The new owners of Insteon appear to be making progress, the Apps are back, Alexa is back and Google should start working again soon. I expect they will also get either the original or another Forum running soon too. All of this is good and will hopefully lead to new product available and on going support.

To be honest, I could care less about Insteon “services”. For what would I want them?

  1. I have to have their Cloud to change my ID or Password
  2. I have to have their Cloud to change my Hubs local IP address (mind boggling)
  3. I have to have their Cloud to understand that “Scene 32” is called “Kitchen” in their app (big woop, easily analyzed and extracted one time)

Everything else can be wiped out from the Hub … groups, schedules … and recreated in an open product. Use Nabu Casa and you can control scenes and such with Alexa.

They should concentrate on building devices, open up those few things to be controlled and forget it.

I for one will never purchase their Cloud service. There is no real need.

When used with some other things I have posted above, this is an automation that will build a Home Assistant group which contains every device in your Insteon scenes.

alias: Build Insteon Scenes
description: ''
trigger:
  - platform: time_pattern
    minutes: '1'
condition: []
action:
  - repeat:
      while:
        - condition: template
          value_template: >-
            {{ repeat.index <=
            (state_attr('input_select.insteon_modem_groups','options') | count)
            }}
      sequence:
        - service: group.set
          data_template:
            object_id: >-
              {{ 'insteon_group_' +
              (state_attr('input_select.insteon_modem_groups','options')[repeat.index
              - 1]) }}
            name: >-
              {{ 'Insteon Scene ' +
              (state_attr('input_select.insteon_modem_groups','options')[repeat.index
              - 1]) }}
            icon: mdi:lightbulb-group
            entities: >-
              {% set glist = state_attr('sensor.insteon_groups','groups') %}  {%
              set devices = namespace(switch=[]) %}  {% for value in glist %} 
              {% if ((value.group | int) ==
              (state_attr('input_select.insteon_modem_groups','options')[repeat.index
              - 1]) | int)  %} {% set devices.switch = devices.switch +
              [(value.device_address[0:2] + '.' + value.device_address[2:-2] +
              '.' + value.device_address[-2:] + '_' + value.button | string) |
              upper] %}  {% endif %}  {% endfor %}  {% set gp =
              namespace(groups=[]) %}  {% for ent in
              integration_entities('insteon') %}   {% if
              state_attr(ent,'insteon_address') + '_' +
              state_attr(ent,'insteon_group') | string in devices.switch %}   {%
              set gp.groups = gp.groups + [ent] %}  {% endif %}   {% endfor %}  
              {{ gp.groups | unique | sort }}
            all: true
mode: single

In a Lovelace card, one could see this:

How do you populate your input_select.insteon_devices list?
Also, how/where is this initialized?
{{ states.sensor.selected_insteon_device.state }}

I set it in an automation like this:

- id: '1651436131649'
  alias: Set Insteon Select Options
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.insteon_groups
  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

This creates a list like:

    friendly_name (entity)

so I can understand what device I am looking at. Yields this:

I would suppose attaching this automation to something other than a change in the group might be better if you are constantly adding new devices, but I believe that the insteon_group sensor is enough because it is set to refresh at 30 second intervals.

I should note I have made other changes to the code posted in previous messages to make things work a bit better (like insteon_groups state is set with a timestamp so that when it is rebuilt the state changes).

Another user reported an issue in the code above. It is really in the way the formatting is done. I copied that code from automations.yaml but reformatted and pasted into this web GUI. Just use the GUI-based YAML editor and create a new automation and play with it until you get it formatted correctly. This below is exactly what is in my automations.yaml with me reformatting it:

- id: '1651436131649'
  alias: Set Insteon Select Options
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.insteon_groups
  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

Thanks. I am now just missing these two components…

Interesting. I added what you posted and after editing via UI and deleting the last space in the template, my automations.yaml now has:

- id: '1651436131649'
  alias: Set Insteon Select Options
  description: ''
  trigger:
  - platform: state
    entity_id:
    - sensor.insteon_groups
  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

No biggie, just interesting…

I will post the missing things in a bit. I actually use oxygen editor through my network with mounted .homeassistant folder. I find a dedicated editor that supports many YAML features and can also sense JSON and XML with conversions between all of them much better than any browser GUI tool.

Those three areas (I assume you mean Set Device Properties and Select Insteon Scene you are missing) in Lovelace are:

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 Scene
      show_header_toggle: false
    filter:
      include:
        - entity_id: input_number.target_insteon_group
          options:
            icon: mdi:home

The selected insteon device template is (in sensor.yaml):

- platform: template
  sensors:
     selected_insteon_device:
        value_template: "{{ states.input_select.insteon_devices.state.split('(')[1].split(')')[0] }}"

So it just is the deveive selected in the first popdown. I just use it to set on/off and possible brightness level for linking the device if you choose to do so via the buttons. I have been using the Insteon Control Panel to add/edit things now.nThe Target Insteon Scene is merely a helper, you can set how you like as I see you have a scene number 254. I set mine to allow scenes from 10 - 100:

I would note that I added more code that helps me considerably to see how things are working. On Home Assistant start and on updates, I dynamically build Home Assistant Groups that map to Insteon Scenes. You can see this in the screen below. I can then use the toggle to turn on the Home Assistant Group (of course, you get the 1 by 1 popcorn effect of each light coming on). Or I can use the Test Insteon Scene" button and you see all the lights come on at once.

I just like the ability to look at how things are working. I have noted a few lights that are problematic, where the lights does go on but HA still shows it off and visa/versa. I slowly narrowed these down by then looking what was in the Insteon Control Panel. I still have a few that do not function correctly but it is intermittent so not sure what is happening, possibly a timing issue in getting the status message back.

Looking here, you can see I turned on the “Backyard” Insteon Scene. What I really like is seeing the Home Assistant Group for “Backyard” is also on, but so is “Pergola” and “Deck Lights” because these two groups are subsets of the whole “Backyard”. The Home Assistant Groups are created such that all must be on in order for the state to be “on”.

I guess I should add that I created a hard coded map to store Scene Names like this:

# Sensor for group names
  - name: insteon_group_names
    state: "
    {% for gpname in states.sensor.insteon_group_names.attributes %}
    {% if state_attr('sensor.insteon_group_names',gpname) == states('input_select.insteon_modem_groups') %} 
    {{ gpname | replace('_', ' ') }}
    {% endif %}
    {% endfor %}"
    attributes:
        Front: 21
        Work_Kitchen: 26
        Pergola: 28
        Backyard: 30
        Deck_Lights: 31
        Kitchen: 33
        Panic: 39
        Laundry_Main: 46
        Laundry_Counter: 47
        Laundry_Appliance: 48
        Laundry_All: 49
        Laundry_Right: 50
        Dogs: 51
        Christmas: 53
        Couch: 54
        Dining: 55
  - name: Selected Insteon Device
    state: "{{ states.input_select.insteon_devices.state.split('(')[1].split(')')[0] }}"

Awesome. As I said, I used this at the beginning to add/change things in scenes but I tend now to just test things and use the Insteon Control Panel to do edit scenes. I am still trying to get things in shape and consolidated so that all these different parts load up correctly. I had many of them in automations that had a homeassistant.start trigger which is too soon and would throw errors in the log.

I cannot figure out how to delete my group “254”…

In the Insteon Control Panel, I would go to all the devices and the Hub and mark anything in that group unused. In this code which I use to populate that dropdown, it filters out any group marked as “unused”

- platform: command_line
  scan_interval: 30
  name: insteon_groups
  command: "jq '{ groups: [ .[0].\"address\" as $modemaddress | .[] | .\"address\" as $device_address | select(.\"address\" != $modemaddress) | .aldb | .[] | .target=$modemaddress |  { group: .\"group\", in_use: .\"in_use\", device_address: $device_address, target: .\"target\", controller: .\"controller\", brightness: .\"data1\", ramp_rate: .\"data2\", button: .\"data3\"} ]  | sort_by(.group) | map(select(.\"group\" > 20)) | map(select(.in_use))}' insteon_devices.json"
  value_template: "{{ now() }}"
  json_attributes:
    - groups

And by “all the devices” I mean only those listed which is your Fireplace and Living Room lights.

@kbrown01 hi from the reddit thread you linked to this!

i’m a little lost. would you be willing to set up a github repo that just shows your modified files. or consolidate your improvements here in a single how-to post? i realize it’s a lot to ask.

is this a template sensor?

as mentioned above – it would be great to just see some sample config files with this all together if you’re willing to share. configuration.yaml, sensor.yaml, the entire lovelace page, etc. – everything that one needs to construct the amazing @kbrown01 recipe. it’s clear this improves the experience drastically and should be considered building in to the official release.