šŸ”¹ Browser_mod - turn your browser into a controllable device, and a media_player

When using the " deviceID: ā€œ{{ deviceID }}ā€ " approach for calling a popup within a script is there any way to determine what the actual deviceID value is thatā€™s being passed? I am unable to get this to work and was curious to see what is actually being passed in that variable.

This is the setup in my scripts.yaml file. The close_popup executes but the popup service never does.

set_alarm_time_popup:
  alias: Set Alarm Time Popup
  sequence:
    - service: browser_mod.close_popup
    - service: browser_mod.popup
      data_template:
        deviceID: "{{ deviceID }}"
        title: Alarm Set
        style:
          . . . . . . . 
        card:
          . . . . . . .

I suppose you could try

- service: system_log.write
  data_template:
  message: "{{ deviceID }}"

and then check your logs.

Hi,

Today I wanted to use your custom_browser_mod, so I installed it and enabled it in configuration.yaml.

Then I created two ā€œinput_numbersā€:

  temperature_threshold_open_ost:
    name: Solltemperatur Ɩffnen Ost
    min: 20
    max: 23
    step: 1
    icon: mdi:alarm
    mode: box
    icon: mdi:thermometer
    unit_of_measurement: 'Ā°C'
  temperature_threshold_close_ost:
    name: Solltemperatur SchlieƟen Ost
    min: 20
    max: 23
    step: 1
    icon: mdi:alarm
    mode: box
    icon: mdi:thermometer
    unit_of_measurement: 'Ā°C'

After that I prepared the script:

popup_ost:
  sequence:
    - service: browser_mod.popup
      data_template:
        deviceID: "{{ deviceID }}"
        title: Temperatur-Einstellungen
        card:
          type: entities
          entities:
            - input_number.temperature_threshold_close_ost
            - input_number.temperature_threshold_open_ost

Then I added an entity_button:

type: entity-button
tap_action:
  action: call-service
  service: script.popup_ost
  service_data:
    deviceID:
      - this
hold_action:
  action: more-info
show_icon: true
show_name: true
entity: sensor.arbeitszimmer_dach_motion_sensor_temperature

But nothing happens, when I click on the Symbolā€¦

Mhhh,

If I edit the Entity Button (via Lovelace ā€œConfigure UIā€) then I can see that the Service-Part is getting removedā€¦

type: entity-button
tap_action:
  action: call-service
  service: ''
hold_action:
  action: more-info
show_icon: true
show_name: true
entity: sensor.arbeitszimmer_dach_motion_sensor_temperature

I believe thatā€™s a known bug. What version of Home Assistant are you running?

0.99.3

Br,
Johannes

I am continuously getting this error when trying to use a popup. It worked 1 time. I tried to close it and since then, thisā€¦

2019-10-09 13:30:53 ERROR (MainThread) [frontend.js.latest.201909191] webpack:////card-tools/popup.js?:28:14 Uncaught TypeError: Cannot read property 'close' of undefined

I cleared cache and even tried a 2nd browser. Same thing.

Any ideas?

Do you by chance have an active cast to a google hub or so?

So I just went to the media_player entity and played a TTS from the states page and as soon as I played the TTS, went back to the services page and commanded a pop up, it worked. Butā€¦ thats odd because I wasnā€™t calling the media player in the first place. Odd.

Make the browser on your workstation switch to a specific tab when the kitchen light is on after midnight

Does anyone have a config example for this above?

I was pretty much just pulling words out of a sack and putting them together when writing that partā€¦ but maybe something likeā€¦

automation:
  - alias: No midnight snacks
    trigger:
      platform: state
      entitiy_id: light.kitchen
      state: "on"
    condition:
      condition: time
      before: "06:00:00"
    action:
      service: browser_mod.navigate
      data:
        deviceID:
          - kitchen_screen
        navigation_path: /lovelace/weight_tracking/

Hmmm, that will take my browsers current tab (non-HA) and automatically change the view over to the HA one? I just want to make sure I am reading this correctly.

EDIT: It changes the view/path of that tab, but the browser will not just switch to that tab. Just tested this. Would be pretty neat if you could. This way if you were working in another tab and an event you were interested in took place, the tab would switch to the HA one and youā€™d get instant view of what you wanted to see.

1 Like

I tried with this:

          - type: entity-button
            name: Turn Off Lights
            tap_action: 
              action: call-service
              service: system_log.write
              service_data:
                message: "{{ deviceID }}"
            entity: light.lampara_escritorio

But is not workingā€¦

image

No. That only works from the backend where data_template is supported. So youā€™d have to put that service call in a script and trigger that from the frontend, using deviceID: this.

Wow! I finally understand heheheā€¦ Now It is working. Thanks @thomasloven !!:smiley:

@thomasloven
Unfortunately I for some reason canā€™t get this to work for pulling up the calling deviceID. The script starts to run the close_popup and the window closes but the popup for the new window never runs. If I were to add the data_template and deviceID: ā€œ{{ deviceID }}ā€ to the close_popup it also doesnā€™t run. Any idea what I might be able to try to get this to work? Soon as that variable from ā€œ-thisā€ to deviceID ā€œ{{ deviceID }}ā€ is included it doesnā€™t seem to work.

scripts.yaml
set_alarm_time_popup:
  alias: Set Alarm Time Popup
  sequence:
    - service: browser_mod.close_popup
    - service: browser_mod.popup
      data_template:
        deviceID: "{{ deviceID }}"
        title: Alarm Set
        style:
          . . . . . . . 
        card:
          . . . . . . .

lovelace.yaml
- type: entity-button
  entity: script.set_alarm_time_popup
  name: Change Alarm Time
  icon: mdi:sleep
  tap_action:
    action: call-service
    service: script.set_alarm_time_popup
    service_data:
      deviceID: 
        - this

Maybe start with something simpler, like a call to browser_mod.debug just to get the deviceID part to work first.

Also make sure you are actually using the latest version of browser_mod and that youā€™ve cleared your browser cache after updating.

I believe thatā€™s a known bug. What version of Home Assistant are you running?

Hi @thomasloven, tested now also with 0.100, still the same behaviour.

Br,
Johannes

Is there a way to ignore or disable devices? For example, I have HA installed on my kidsā€™ iPhones for presence detection and so they they can get in the house when no one else is home. I donā€™t really need any of the browser_mod functions for their phones.