Advertisement
Guest User

hasp_office_00_components.yaml

a guest
Dec 28th, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 8.64 KB | None | 0 0
  1. #hasp_office_00_components.yaml
  2.  
  3. ##############################################################################
  4. # The devices created below are essential to the page control automations
  5. # and you'll probably want to carry them over to your own configuration
  6. homeassistant:
  7. #  customize:
  8. #    input_number.hasp_office_alarmcode1:
  9. #      hidden: true
  10. #    input_number.hasp_office_alarmcode2:
  11. #      hidden: true
  12. #    input_number.hasp_office_code3:
  13. #      hidden: true
  14. #    input_number.hasp_office_alarmcode4:
  15. #      hidden: true
  16.  
  17. # Enable this iframe to integrate the HASP web admin panel in Hass.
  18. # This will not work if you have SSL enabled, see details here:
  19. # https://www.home-assistant.io/components/panel_iframe/
  20. #
  21. #panel_iframe:
  22. #  office:
  23. #    title: "office"
  24. #    url: "http://office"
  25. #    icon: "mdi:cellphone-text"
  26.  
  27. light:
  28.   - platform: mqtt
  29.     name: office Backlight
  30.     command_topic: "hasp/office/light/switch"
  31.     state_topic: "hasp/office/light/state"
  32.     brightness_state_topic: "hasp/office/brightness/state"
  33.     brightness_command_topic: "hasp/office/brightness/set"
  34.     availability_topic: "hasp/office/status"
  35.     payload_available: "ON"
  36.     payload_not_available: "OFF"
  37.     retrain: true
  38.  
  39. binary_sensor:
  40.   - platform: mqtt
  41.     name: office Connected
  42.     device_class: connectivity
  43.     state_topic: "hasp/office/status"
  44.     payload_on: "ON"
  45.     payload_off: "OFF"
  46.     availability_topic: "hasp/office/status"
  47.     payload_available: "ON"
  48.     payload_not_available: "OFF"
  49.  
  50. sensor:
  51.   - platform: mqtt
  52.     name: office Sensor
  53.     state_topic: "hasp/office/sensor"
  54.     value_template: '{{ value_json.status }}'
  55.     json_attributes:
  56.      - espVersion
  57.       - updateESPAvailable
  58.       - lcdVersion
  59.       - updateLcdAvailable
  60.       - espUptime
  61.       - signalStrength
  62.       - haspIP
  63.  
  64. input_text:
  65.   hasp_office_pagebutton1label:
  66.     name: office Page 1 Label
  67.     icon: mdi:book-open-page-variant
  68.   hasp_office_pagebutton2label:
  69.     name: office Page 2 Label
  70.     icon: mdi:book-open-page-variant
  71.   hasp_office_pagebutton3label:
  72.     name: office Page 3 Label
  73.     icon: mdi:book-open-page-variant
  74.  
  75. input_number:
  76.   hasp_office_pagebutton1page:
  77.     name: office Page 1 Page
  78.     icon: mdi:format-list-numbers
  79.     min: 0
  80.     max: 9
  81.     step: 1
  82.   hasp_office_pagebutton2page:
  83.     name: office Page 2 Page
  84.     icon: mdi:format-list-numbers
  85.     min: 0
  86.     max: 9
  87.     step: 1
  88.   hasp_office_pagebutton3page:
  89.     name: office Page 3 Page
  90.     icon: mdi:format-list-numbers
  91.     min: 0
  92.     max: 9
  93.     step: 1
  94.   hasp_office_activepage:
  95.     name: office Active Page
  96.     icon: mdi:format-list-numbers
  97.     min: 0
  98.     max: 9
  99.     step: 1
  100. #  hasp_office_alarmcode1:
  101. #    name: office AlarmCode1
  102. #    icon: mdi:format-list-numbers
  103. #    min: -1
  104. #    max: 9
  105. #    step: 1
  106. #    initial: -1
  107. #  hasp_office_alarmcode2:
  108. #    name: office AlarmCode2
  109. #    icon: mdi:format-list-numbers
  110. #    min: -1
  111. #    max: 9
  112. #    step: 1
  113. #    initial: -1
  114. #  hasp_office_alarmcode3:
  115. #    name: office AlarmCode3
  116. #    icon: mdi:format-list-numbers
  117. #    min: -1
  118. #    max: 9
  119. #    step: 1
  120. #    initial: -1
  121. #  hasp_office_alarmcode4:
  122. #    name: office AlarmCode4
  123. #    icon: mdi:format-list-numbers
  124. #    min: -1
  125. #    max: 9
  126. #    step: 1
  127. #    initial: -1
  128.  
  129. group:                                                                 #added view to "main" hasp_00_components.yaml
  130. #  office:
  131. #    name: office
  132. #    view: yes
  133. #    entities:
  134. #      - binary_sensor.office_connected
  135. #      - sensor.office_sensor
  136. #      - light.office_backlight
  137. #      - group.office_pageselect
  138. #      - group.office_colors
  139. #      - group.office_automations
  140.   office_pageselect:
  141.     name: office Page Selection
  142.     view: no
  143.     entities:
  144.      - input_number.hasp_office_activepage
  145.       - input_number.hasp_office_pagebutton1page
  146.       - input_text.hasp_office_pagebutton1label
  147.       - input_number.hasp_office_pagebutton2page
  148.       - input_text.hasp_office_pagebutton2label
  149.       - input_number.hasp_office_pagebutton3page
  150.       - input_text.hasp_office_pagebutton3label
  151.   office_automations:
  152.     name: office automations
  153.     view: no
  154.     entities:
  155.      - automation.hasp_office_00_firsttimesetup
  156.  
  157. automation:
  158. ##############################################################################
  159. # Run first time setup commands
  160.   - alias: hasp_office_00_FirstTimeSetup
  161.     trigger: []
  162.     action:
  163.       - service: automation.trigger
  164.         data:
  165.           entity_id: 'automation.hasp_office_00_automationgroupupdate'
  166.       - service: homeassistant.turn_on
  167.         data:
  168.           entity_id: 'group.office_automations'
  169.       - service: input_text.set_value
  170.         data:
  171.           entity_id: 'input_text.hasp_office_pagebutton1label'
  172.           value: 'scenes'
  173.       - service: input_text.set_value
  174.         data:
  175.           entity_id: 'input_text.hasp_office_pagebutton2label'
  176.           value: 'status'
  177.       - service: input_text.set_value
  178.         data:
  179.           entity_id: 'input_text.hasp_office_pagebutton3label'
  180.           value: 'lights'
  181.       - service: input_number.set_value
  182.         data:
  183.           entity_id: 'input_number.hasp_office_pagebutton1page'
  184.           value: 1
  185.       - service: input_number.set_value
  186.         data:
  187.           entity_id: 'input_number.hasp_office_pagebutton2page'
  188.           value: 2
  189.       - service: input_number.set_value
  190.         data:
  191.           entity_id: 'input_number.hasp_office_pagebutton3page'
  192.           value: 3
  193.       - service: input_number.set_value
  194.         data:
  195.           entity_id: 'input_number.hasp_office_activepage'
  196.           value: 1
  197.       - service: input_number.set_value
  198.         data:
  199.           entity_id: 'input_number.hasp_office_selectedforegroundcolor'
  200.           value: 0
  201.       - service: input_number.set_value
  202.         data:
  203.           entity_id: 'input_number.hasp_office_selectedbackgroundcolor'
  204.           value: 65535
  205.       - service: input_number.set_value
  206.         data:
  207.           entity_id: 'input_number.hasp_office_unselectedforegroundcolor'
  208.           value: 65535
  209.       - service: input_number.set_value
  210.         data:
  211.           entity_id: 'input_number.hasp_office_unselectedbackgroundcolor'
  212.           value: 25388
  213.  
  214. ##############################################################################
  215. # Set automation group members on start - Thanks @Nightcat!
  216.   - alias: hasp_office_00_AutomationGroupUpdate
  217.     trigger:
  218.     - platform: homeassistant
  219.       event: start
  220.     action:
  221.     - service: group.set
  222.       data_template:
  223.         object_id: "office_automations"
  224.         entities: >-
  225.           {%- for item in states.automation if ((item.entity_id | lower).startswith('automation.hasp_office_')) -%}
  226.           {{ item.entity_id }}
  227.           {% if not loop.last %}, {% endif %}
  228.           {%- endfor -%}
  229.     - delay:                                                               #small delay for automations to load
  230.         minutes: 1
  231.     - service: group.set_visibility                                       #hide entities from this HSAP
  232.       entity_id: group.office_pageselect
  233.       data:
  234.         visible: False
  235.     - service: group.set_visibility
  236.       entity_id: group.office_colors
  237.       data:
  238.         visible: False
  239.     - service: group.set_visibility
  240.       entity_id: group.office_backlight
  241.       data:
  242.         visible: False
  243.     - service: group.set_visibility
  244.       entity_id: group.office_automations
  245.       data:
  246.         visible: False
  247. ##############################################################################
  248. # Set automation for group visability
  249.   - alias: hasp_office_visible
  250.     hide_entity: true
  251.     trigger:
  252.       - platform: state
  253.         entity_id: input_select.hasp_select
  254.         to: office
  255.     action:
  256.       - service: group.set_visibility
  257.         entity_id: group.office_pageselect
  258.         data:
  259.           visible: True
  260.       - service: group.set_visibility
  261.         entity_id: group.office_colors
  262.         data:
  263.           visible: True
  264.       - service: group.set_visibility
  265.         entity_id: group.office_backlight
  266.         data:
  267.           visible: True
  268.       - service: group.set_visibility
  269.         entity_id: group.office_automations
  270.         data:
  271.           visible: True
  272.       - service: group.set_visibility
  273.         entity_id: group.desk_pageselect
  274.         data:
  275.           visible: False
  276.       - service: group.set_visibility
  277.         entity_id: group.desk_colors
  278.         data:
  279.           visible: False
  280.       - service: group.set_visibility
  281.         entity_id: group.desk_backlight
  282.         data:
  283.           visible: False
  284.       - service: group.set_visibility
  285.         entity_id: group.desk_automations
  286.         data:
  287.           visible: False
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement