My first use of scene.create not working for me, too many entities?

I have edited the scene.create template automation (the window one) in the documentation and found it doesn’t work.
when I execute the automation in developer tools nothing happens.
is there any further documentation for scene.create or can any of you spot what i’ve done wrong?
These 2 automations should -

  • create a scene with the status of a heap of loads and the automations that trigger them
    switch off those loads and disable the automations.
  • restore the status of those loads and automations post price peak.

With thanks :slight_smile:


#Power price spike - high power device dump & restore
- alias: high power dump at price
  trigger:
  - platform: numeric_state
    entity_id: sensor.amber_general_usage_price
    above: 40
  condition: []
  action:
  - service: scene.create
    data:
      scene_id: before
      snapshot_entities:
      - automation.ac_cool_on_export
      - automation.ac_heat_on_export
      - automation.ac_off_on_falling_export
      - automation.ac_on_cold_morning_pre_warm
      - automation.hella_tower_heater_on
      - automation.jma_ensuite_fan_humidity_trigger_on
      - automation.pool_pump_morning_on_to_check_temp
      - automation.pool_pump_on_export
      - automation.transfer_fan_on
      - climate.living_room
      - fan.ifan03_dining_room_area_fan
      - light.garden_lights
      - switch.dining_room_area_fan
      - switch.dr_dnjr_transferfan062
      - switch.hellertowerheater
      - switch.jma_ens_fan
      - switch.poolpump
      - switch.spa_blower
      - switch.spa_bubbles
      - switch.spa_jets
      - switch.spa_pump
      - switch.spaspare4
      - switch.squareportablefan
  - service: homeassistant.turn_off
    data:
      entity_id: 
      - fan.ifan03_dining_room_area_fan
      - light.garden_lights
      - switch.dining_room_area_fan
      - switch.dr_dnjr_transferfan062
      - switch.hellertowerheater
      - switch.jma_ens_fan
      - switch.poolpump
      - switch.spa_blower
      - switch.spa_bubbles
      - switch.spa_jets
      - switch.spa_pump
      - switch.spaspare4
      - switch.squareportablefan
  - service: climate.set_hvac_mode
    data:
      entity_id: climate.living_room
      hvac_mode: 'off'
  - service: automation.turn_off
    entity_id:
      - automation.ac_cool_on_export
      - automation.ac_heat_on_export
      - automation.ac_off_on_falling_export
      - automation.ac_on_cold_morning_pre_warm
      - automation.hella_tower_heater_on
      - automation.jma_ensuite_fan_humidity_trigger_on
      - automation.pool_pump_morning_on_to_check_temp
      - automation.pool_pump_on_export
      - automation.transfer_fan_on
  - service: media_player.volume_set
    data_template:
      entity_id: 
        - media_player.dining_room_mini
        - media_player.bedroom_speaker
      volume_level: 0.8
  - service: tts.google_translate_say
    entity_id: media_player.all_devices_26
    data:
      message: price spike.
  - service: media_player.volume_set
    data_template:
      entity_id: 
        - media_player.dining_room_mini
        - media_player.bedroom_speaker
      volume_level: 0.5

#restore operation after price spike
- alias: high power restore at price
  trigger:
  - platform: numeric_state
    entity_id: sensor.amber_general_usage_price
    below: 35
  condition: []
  action:
  - service: scene.turn_on
    data:
      entity_id: scene.before
  - service: media_player.volume_set
    data_template:
      entity_id: 
        - media_player.dining_room_mini
        - media_player.bedroom_speaker
      volume_level: 0.8
  - service: tts.google_translate_say
    entity_id: media_player.all_devices_26
    data:
      message: price spike over.
  - service: media_player.volume_set
    data_template:
      entity_id: 
        - media_player.dining_room_mini
        - media_player.bedroom_speaker
      volume_level: 0.5

Have you made any progress?

What you have looks ok. What do you mean by “nothing happens”? The first automation does a lot besides attempting to dynamically create a scene. Do any of the other actions work? Do you see any warnings or errors in the log?

I don’t use scenes, but I just tried to call scene.create via the SERVICES tab of the Developer Tools page. First, the service wasn’t listed. Even so, I tried to call it anyway (by entering it manually.) When I did an error popped up that said the service wasn’t found.

My guess is the service isn’t registered because I don’t have the following anywhere in my configuration:

scene:

If you’re still having trouble, maybe try adding that line to configuration.yaml, restart HA, and try again.

1 Like

Thanks Phil,
I added scene: to config.yaml and it works… well the tts works which is a strong step in the right direction.
I learnt something too, you need to register services :slight_smile:

Thanks :slight_smile: