Home-Assistant Custom Component

Discussion in 'Development' started by wizmo, Oct 13, 2021.

  1. LenniePaz

    LenniePaz Member

    Thank you! I'll give it a try and report back.
     
  2. LenniePaz

    LenniePaz Member

    Just checked out the lights and they are instant now with the button presses. Thanks again for your help!
     
  3. NoBiluS

    NoBiluS New Member

    Thanks for your Job !

    I'm stuck on an automation between the zidoo and my Hue lighting.
    Just as I created an automation to turn off the lighting when the film starts, and one to turn the lighting on to 50% when the film is paused, I would like to have an automation that resets the lighting to 100% when I stop playing a film and I return to the zidoo menus.
    I tried with the "Z1000 Pro becomes inactive" trigger (idle function?), it works, but... when I turn on the zidoo it automatically turns on the lighting, and I'm just trying to turn the lighting back on when I stop playing the film.
    Any suggestion ?
    if I manually modify the automation by putting "stop reading" or else, it refuses to validate...
     
  4. mrstinky

    mrstinky New Member

    try this for the lights turning off when the film starts (create new automation, click dots in top right, edit in yaml and then paste this in and modify entity names as needed);
    Code:
    description: "zidoo lights off when playback starts"
    mode: single
    trigger:
      - platform: state
        entity_id:
          - media_player.z9x
        to: playing
    condition: []
    action:
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.bedlightstrip_light
    
    and then try this for paused (i would use a scene but you can probably do it with toggle. you just gotta make the scene in the hue app and then it should detect in home assistant);
    Code:
    description: "zidoo lights on when paused"
    mode: single
    trigger:
      - platform: state
        entity_id:
          - media_player.z9x
        to: paused
    condition: []
    action:
      - service: hue.activate_scene
        data: {}
        target:
          entity_id: scene.bedroom_concentrate
    
    and then maybe try this for going from playback back to the menu screen to activate another scene;
    Code:
    description: "zidoo lights on when exiting playback"
    mode: single
    trigger:
      - platform: state
        entity_id:
          - media_player.z9x
        to: idle
        from: playing
    condition: []
    action:
      - service: hue.activate_scene
        data: {}
        target:
          entity_id: scene.bedroom_concentrate
    
     
  5. NoBiluS

    NoBiluS New Member

    Look, this is my actually automation :

    Code:
    platform: device
    device_id: 494522191a6495720e971bca5bd7b6e2
    domain: media_player
    entity_id: 91e7cfdd51b078dcd3dbc9d5dc155e49
    type: playing
    for:
      hours: 0
      minutes: 0
      seconds: 3
    type: turn_off
    device_id: 25e4c75d6ce2c02899acd028256a37db
    entity_id: eb3e41b9caab2fab7346616da4222094
    domain: light
    type: turn_off
    device_id: bc8bdfc3dab3dce69fdc27711571e10a
    entity_id: 97b4e344e81cb7a7fbb07183695a05de
    domain: light
    
    Code:
    platform: device
    device_id: 494522191a6495720e971bca5bd7b6e2
    domain: media_player
    entity_id: 91e7cfdd51b078dcd3dbc9d5dc155e49
    type: paused
    type: turn_on
    device_id: 25e4c75d6ce2c02899acd028256a37db
    entity_id: eb3e41b9caab2fab7346616da4222094
    domain: light
    brightness_pct: 50
    type: turn_on
    device_id: bc8bdfc3dab3dce69fdc27711571e10a
    entity_id: 97b4e344e81cb7a7fbb07183695a05de
    domain: light
    brightness_pct: 50
    
    Code:
    platform: device
    device_id: 494522191a6495720e971bca5bd7b6e2
    domain: media_player
    entity_id: 91e7cfdd51b078dcd3dbc9d5dc155e49
    type: idle
    type: turn_on
    device_id: 25e4c75d6ce2c02899acd028256a37db
    entity_id: eb3e41b9caab2fab7346616da4222094
    domain: light
    brightness_pct: 100
    type: turn_on
    device_id: bc8bdfc3dab3dce69fdc27711571e10a
    entity_id: 97b4e344e81cb7a7fbb07183695a05de
    domain: light
    brightness_pct: 100
    
    The pb is that in idle mode, lights up when i start the zidoo,
    and not only when I stop playing the film...

    I will try with your code :
    to: idle
    from: playing
     
  6. NoBiluS

    NoBiluS New Member

    Hello

    I tested this :
    Code:
    
    alias: Ciné Light On
    description: Zidoo allume éclairage lorsque lecture stoppée
    trigger:
      - platform: state
        entity_id:
          - media_player.z1000_pro
        to: idle
        from: playing
    condition: []
    action:
      - type: turn_on
        device_id: 25e4c75d6ce2c02899acd028256a37db
        entity_id: eb3e41b9caab2fab7346616da4222094
        domain: light
        brightness_pct: 100
      - type: turn_on
        device_id: bc8bdfc3dab3dce69fdc27711571e10a
        entity_id: 97b4e344e81cb7a7fbb07183695a05de
        domain: light
        brightness_pct: 100
    mode: single
    
    
    it doesn't work. Thks !
     
  7. wizmo

    wizmo Member

    Check to see what's happening in the HA Developer Tools/State menu. The standard states are "playing', "paused" and "idle" when playing Movies.

    NOTE: Try to avoid using Music Player. If it has been started, the HA media player state will fall back to the separate music player state. Zidoo allows this to run in the background, and will show "paused" unless you actually empty the music queue. You can empty the queue with the HA service `media-player:media_stop` service , but you'll have to get creative with that (and possible the media_content_type attribute)!
     

Share This Page