Skip to content

Commit

Permalink
Use the new settings entities
Browse files Browse the repository at this point in the history
  • Loading branch information
AzonInc committed Oct 28, 2024
1 parent 8878a0c commit d308962
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 82 deletions.
8 changes: 4 additions & 4 deletions firmware/addons/interactive-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ tc_bus:
# If no second door station id is set, wait for one
- if:
condition:
- lambda: return id(second_door_station_id) == 99 && (x.type == COMMAND_TYPE_DOOR_CALL || x.type == COMMAND_TYPE_OPEN_DOOR) && x.address != 0;
- lambda: return id(second_door_station_id).state == 99 && (x.type == COMMAND_TYPE_DOOR_CALL || x.type == COMMAND_TYPE_OPEN_DOOR) && x.address != 0;
then:
- globals.set:
- number.set:
id: second_door_station_id
value: !lambda "return x.address;"

Expand All @@ -34,8 +34,8 @@ tc_bus:
- switch.is_on: doorman_setup_mode
- lambda: "return x.type == COMMAND_TYPE_FLOOR_CALL || x.type == COMMAND_TYPE_DOOR_CALL;"
then:
- globals.set:
id: intercom_serial_number
- number.set:
id: serial_number
value: !lambda "return x.serial_number;"

- switch.turn_off: doorman_setup_mode
Expand Down
102 changes: 53 additions & 49 deletions firmware/addons/intercom-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,59 +11,63 @@ tc_bus:
on_read_memory_timeout:
- logger.log: "Failed to read Memory"

model:
id: intercom_model
name: "Intercom Model"
icon: "mdi:doorbell-video"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings
select:
- platform: tc_bus
model:
id: intercom_model
name: "Intercom Model"
icon: "mdi:doorbell-video"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

ringtone_door_call:
id: intercom_ringtone_door_call
name: "Ringtone: Door Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

volume_ringtone:
id: intercom_volume_ringtone
name: "Volume: Ringtone"
icon: "mdi:volume-high"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings
ringtone_floor_call:
id: intercom_ringtone_floor_call
name: "Ringtone: Floor Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

volume_handset:
id: intercom_volume_handset
name: "Volume: Handset"
icon: "mdi:volume-high"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings
ringtone_internal_call:
id: intercom_ringtone_internal_call
name: "Ringtone: Internal Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

ringtone_door_call:
id: intercom_ringtone_door_call
name: "Ringtone: Door Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings
number:
- platform: tc_bus
volume_ringtone:
id: intercom_volume_ringtone
name: "Volume: Ringtone"
icon: "mdi:volume-high"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

ringtone_floor_call:
id: intercom_ringtone_floor_call
name: "Ringtone: Floor Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

ringtone_internal_call:
id: intercom_ringtone_internal_call
name: "Ringtone: Internal Call"
icon: "mdi:music"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings
volume_handset:
id: intercom_volume_handset
name: "Volume: Handset"
icon: "mdi:volume-high"
entity_category: CONFIG
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_intercom_settings

# Read Memory before reading and writing
button:
Expand Down
2 changes: 1 addition & 1 deletion firmware/addons/ring-to-open.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ binary_sensor:

- tc_bus.send:
type: open_door
address: !lambda "return id(second_door_station_id);"
address: !lambda "return id(second_door_station_id).state;"

- id: !extend function_button
on_press:
Expand Down
64 changes: 36 additions & 28 deletions firmware/base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@ substitutions:
relay_pin: "GPIO42"
external_button_pin: "GPIO41"

globals:
- id: intercom_serial_number
type: int
restore_value: true
initial_value: '0'

- id: second_door_station_id
type: int
restore_value: true
initial_value: '99'


# Board Setup
esp32:
board: esp32-s3-devkitc-1
Expand Down Expand Up @@ -175,28 +163,48 @@ external_components:
tc_bus:
id: tc_bus_intercom
event: "doorman"
hardware_version:
name: "Hardware"
icon: "mdi:router-wireless"
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_system
sorting_weight: -20
bus_command:
id: last_bus_command
name: "Last Bus Command"
web_server:
sorting_group_id: sorting_group_listeners
sorting_weight: -99
door_readiness:
id: door_readiness
name: "Door readiness"
icon: "mdi:home-clock"
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_listeners
serial_number_lambda: !lambda "return id(intercom_serial_number);"

number:
- platform: tc_bus
serial_number:
id: serial_number
name: Serial Number
icon: "mdi:number"
disabled_by_default: true
#web_server:
# sorting_group_id: sorting_group_system
# sorting_weight: -20

- platform: template
id: second_door_station_id
name: Second Door Station ID
mode : box
restore_value: true
initial_value: '99'

text_sensor:
- platform: tc_bus
hardware_version:
id: doorman_hardware_version
name: "Hardware"
icon: "mdi:router-wireless"
disabled_by_default: true
web_server:
sorting_group_id: sorting_group_system
sorting_weight: -20
bus_command:
id: last_bus_command
name: "Last Bus Command"
web_server:
sorting_group_id: sorting_group_listeners
sorting_weight: -99

switch:
# Preconfigured Relay Switch
Expand Down Expand Up @@ -261,7 +269,7 @@ button:
on_press:
- tc_bus.send:
type: open_door
address: !lambda "return id(second_door_station_id);"
address: !lambda "return id(second_door_station_id).state;"
web_server:
sorting_group_id: sorting_group_controls
sorting_weight: -9
Expand Down Expand Up @@ -377,7 +385,7 @@ binary_sensor:
id: second_entrance_doorbell
name: "Second Entrance Doorbell"
type: door_call
address_lambda: !lambda "return id(second_door_station_id);"
address_lambda: !lambda "return id(second_door_station_id).state;"
auto_off: 0.2s
web_server:
sorting_group_id: sorting_group_listeners
Expand Down

0 comments on commit d308962

Please sign in to comment.