Are Virtual Switches Possible?

I’m trying to work around some of the limitations of my alarm panel (a 2gig managed by alarm.com). Since I cannot see sensor information from Home Assistant currently (the alarm.com add-on does not work for me), but since my alarm panel can see Z-Wave devices (as a secondary controller), my thought was that I can enable communication at least one way by using a switch.

So say when I alarm my panel, it knows to turn a switch on - when I disarm it, it turns said switch off. I can then have HA make decisions based on the switch state. I could do this with a real switch, but that seems a little counter-productive when I really just need a sort of virtual or logical switch to track state. Is there any way to do this? I’m using an Aeon Stick as my Z-Wave primary controller - I didn’t find any settings for that but thought I would check and see what folks might be doing here.

Or if anyone has any other ideas on how to pull info off the 2gig panel - or perhaps even send info to it, I’m all ears! It’d be glorious if I could alarm/disarm from HA but so far that does not look to be in the cards (until the alarm.com integration is fixed, but I think that may prove to be a precarious solution given how it has to be implemented currently).

Can this work for you: https://home-assistant.io/components/switch.template/ ?

1 Like

Is the 2gig panel paired to the Aeon stick? If so, you should look through the open zwave log file to see how it presents itself and what command classes are available. From there you may be able to identify/configure the panel to toggle a command class that could be captured in HASS.

Oof sorry folks. Posted this then went out of town (thought I would be closer to a computer than I was). Switch template might work, although it’s not a true virtual switch with how I’m seeing it (and its above the Z-Wave level so the alarm panel could not see it).

The 2gig panel is indeed paired to the Aeon stick as a secondary controller, but I don’t see anything when looking at the HAAS device list (from the GUI) that relate to the panel, although I haven’t checked the zwave logs, that’s a good idea to check out. The panel I believe does appear as a ZWave device (I’m at work right now so hard to verify at this moment) but didn’t have much info associated with it in OZCP.

I was pondering this again this morning with another potential use case. My kitchen lights turn on at 6am on weekdays as that’s when we have to get up to get the kiddo ready for school. But since it’s the Holidays, we can sleep in later such that we don’t need to have the lights turn on. I can edit HA and disable the schedule but a virtual switch here could be useful that I could toggle that can manually disable the kitchen light schedule.

The above doesn’t require Z-Wave; I just need a way for HA to track the above state somehow and add that in as an if-check for the schedule tasks. Any thoughts on how I might go about doing that/if it’s possible?

EDIT: Realized my kitchen lights thoughts above can be solved via input_boolean

I’m curious how did you solve this? I would like to have a slider in HA so i can turn my Alarm on and off.

I used input_boolean and made a “Sleep In” switch:

configuration.yaml:
input_boolean:
  sleep_in:
    name: Sleep In
    initial: off
    icon: mdi:hotel
automation: !include_dir_merge_list automation


automation/scheduled.yaml:
- alias: "Morning Light"
  trigger:
    platform: time
    after: '06:00:00'
  condition:
    - condition: time
      weekday:
        - mon
        - tue
        - wed
        - thu
        - fri
    - condition: state
      entity_id: input_boolean.sleep_in
      state: 'off'
  action:
    service: scene.turn_on
    entity_id: scene.kitchen_open

- alias: "Sun Is Up"
  trigger:
    platform: time
    after: '07:30:00'
  condition:
    - condition: time
      weekday:
        - mon
        - tue
        - wed
        - thu
        - fri
    - condition: state
      entity_id: input_boolean.sleep_in
      state: 'off'
  action:
    service: scene.turn_on
    entity_id: scene.kitchen_closed

So basically if the Sleep-In switch is on, don’t run the scheduled events, otherwise, do. This works great! The problem is the switch state isn’t stored in a persistent fashion. What I’d like to do is extend that feature such that the state ends up stored in the database (which is only currently used for historical statistics) so the setting persists on restarts of Home Assistant.

1 Like

Thx I wasn’t aware of input_boolean.

True to bad the status isn’t safed.

Use this for armed_home, armed_away, and disarmed states. Works great.

https://home-assistant.io/components/alarm_control_panel.alarmdotcom/