Skip to content

Commit

Permalink
Add a fallback for password entry
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Dec 25, 2024
1 parent 41387cb commit 6c5ea06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion addon_meterstoha/config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---

Check failure on line 1 in addon_meterstoha/config.yaml

View workflow job for this annotation

GitHub Actions / workflows / Lint Add-on

Add-on version identifier must be 'dev'
name: MetersToHA
version: 2024.12.7
version: 2024.12.8
slug: meterstoha
description: MetersToHA add-on for Home Assistant
url: https://github.com/mdeweerd/MetersToHA
Expand Down
5 changes: 5 additions & 0 deletions apps/meters_to_ha/meters_to_ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,7 @@ def set_clipboard_and_paste(self, element, text):
# To avoid special key interpretations (^,~,`), copy to clipboard
# and then paste it to the browser

delay = 0.1
# Set the desired text in the clipboard
pyperclip.copy(text)
# Simulate a paste operation
Expand All @@ -1091,6 +1092,10 @@ def set_clipboard_and_paste(self, element, text):
actions.key_down(Keys.CONTROL).send_keys("v").key_up(
Keys.CONTROL
).perform()
time.sleep(delay)
if element.get_attribute("value") == "":
# Paste did not work, send keys as backup method
element.send_keys(text)

def set_input_value(self, element, value: str):
# Use JavaScript to set the value of the input field (untested)
Expand Down

0 comments on commit 6c5ea06

Please sign in to comment.