Struggling with a variety of topics

You’de first have to say what you want to achieve…

I had a feeling there be a catch in it :slight_smile: Is there anywhere I can try to read about it? though I still find it better like this, if Images please.

I don’t see anywhere to do that and I do not see anything at where the condition is made from only here! I do not see it where you make the conditions, to Achieve it.

Do I also not need a Acton inside the Condiction of the Sun I added too?

Should I just not copy the condition and past it into where the time condition is?

I have found a use for it just off the timer not as it should be but does the job nicely if I stick my hand under it it turns on as the sensor above keeps it more or less in the right place such a shame the lamps collapsing :frowning: Be great just for testing purposes too :slight_smile:

The time condition will only turn the light ON between 09:00:00 and 23:59:59

The added sun condition, will apply to both turning ON and OFF

So if the light was triggered ON 1 minute bedore sunset it will not switch OFF anymore, as it will after sunset by that time,

So again, what is it you are trying to do?

This could be what you mean, but I am just quessing :thinking:

1 Like

I want to use sunset and sun raise set like I used too, but thought it was best to ask on time first to make things easier but on the way HA is set, it is not even easy to change a task as Im see here :slight_smile:
I understand what it will do what I don’t understand is a manner that is easy to understand to out it into place in the code. I also understand it can get even more complicated to do things!

I do also have Presence Sensors too, but for the moment Im happy with it sun set sun raise to use the lights to come on and yes I could use the time to do it but then as sunset and sun rise move forward or backwards on the time it won’t on these setups, so maybe its best to go off the light and how dark it is but again until I buy all my sensors to be able to do that Id still need sunset and sun raise to manage.

Maybe get an edit to the word document and add to it so we can both argue in it :thinking: :rofl: :rofl: :ok_hand: :blue_heart: might be easier but who knows with me.

Because I don’t fully know what I’m doing right or wrong it tends to go wrong for me :slight_smile: but I still try to keep at it slowly. the colours your using with mine save me from having to do them now :slight_smile: to add to the doc if you don’t mind?

I would say forget Time altogether now I know how to at least get code into it. Now Im learning how to change that code! thanks! As that time did not go into edit in visual editor / conditions which I thought it was going to do. so this has confused me why it’s not done this?

When I say missing time I mean the code you gave me with time is not showing up here! Not that I need it if doing Sunset! But confused as to why it did not go here from the YAML file.

I’m happy to get that done as we seem to have no sun here!

Something like this!

on

off

Condition

So this then?

alias: >-
  Turn on/off Desk Lamp on motion between 09:00 and 18:00 and off after 3min
  without motion
description: ""
mode: restart
trigger:
  - platform: state
    id: "on"
    entity_id:
      - binary_sensor.lumi_lumi_motion_ac02_motion
    to: "on"
  - platform: state
    id: "off"
    entity_id:
      - binary_sensor.lumi_lumi_motion_ac02_motion
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
condition: []
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "on"
          - condition: sun
            before: sunrise
            after: sunset
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 60
            target:
              entity_id: light.kithcen_led_2
    default:
      - service: light.turn_off
        data: {}
        target:
          entity_id: light.kithcen_led_2

You have to realize that this automation is basically two automations in one.
It combines both ON and OFF triggers.
But only the ON trigger needs to act on Sun. The OFF trigger should always work.
That is why the Sun condition is located at the ON choice and the 2 minutes is located at the OFF trigger.

This is how it would look like in a flowchart:

1 Like

I’ve not tried this yet I noticed last night also that the MMMMM not sure how to word this was not bringing the light back on quick enough from me going into a bathroom and then back onto a stairs sensor that only comes on 1 min which Is fine but if goes off and if I come back onto the sensor it’s not had time to reset to make it come on again so it leaves me blank in the dark. I noticed some I am not sure not where I saw it but think it said 30 seconds before it triggers again I was wondering to change it if I find it again to 15 seconds so the light will come back on after a period of 15 seconds each time or is it suppose to do it all of the time? Will have another attempt after the weekend as it could mess everything up. I understand its doing both in one Automation but I find it difficult to understand how its doing it. I know sun will turn the light on but its the code that confuses me where to put it within the code from removing the time bit. I know I could prob leave the time there as well as long as its between the sun set and sun raise times but as it is now its all over the place :slight_smile: My brain needs rest from it :slight_smile:

The other way I also need to try to do is have light come on with sunset and just stay on all of the time until 12pm or midnight. so will it be a mixture of the sunset and then add some of the time some how to turn it off. I have lots o different configurations to do but not sure how to change the code!

I have the stairs where I use two sensor so as I go down the stairs the upstairs light turns off and the downstairs turns on and them the opposite where downstairs light will turn off while upstairs light comes on I do this with a 3 delay, hard to explain this one :slight_smile:

I am certain you will figure it out, as you have all the info you need :grin:

I was just lookign on of I set time to 0 that would keep the light on all o the time would it not? Yes You give me a great helping hand it just trying to get my head around doing it that’s hard :slight_smile: I m using Notepad++ but would prefer one that does colour text but not sure whats a good one to use. Also The chart you have done what program have you used as I might but one to do them I have many times used other software bti found them hard work to use and I even at one point tried Microsoft Word which is not at all good. I would not be using it for programmes like this but ones where I try to help in xdrip+ or watch setups I try to do to help people set their medical watch up like this one I do think you will like the epic as I kept the green band on and was going to right ton it but that’s hard to do with left hand

Any clues on how I get an iPad screen come on when the sensor detects you? :rofl: Just tried that code and getting an error so unsure why?

I saw there was missing data at the bottom so Ive added that but not getting this error! I will look it up see if I can figure why the error!

Message malformed: required key not provided @ data['action']

Not sure what was up but copied this section into it again and added the bottom line that was missed and the error is gone now so I could save it!.

fixed error

And this was missing of your code!

mode restart mode

Not bad me learning a pro :rofl: :rofl:

Why do i keep getting errors each to me I add new code into it seems really buggy like every space in it matters?

Think Im getting the hang of it a little now just wondering best way to change

mode: single

mode: restart

when i select actions?

Has my code is not the Light just come on and back off very fast and not much use!

alias: Turn Bathroom Light on please
description: ""
trigger:
  - platform: state
    id: "on"
    entity_id:
      - binary_sensor.bathroom_tuyatec_b5g40alm_rh3040_motion
    to: "on"
  - platform: state
    id: "off"
    entity_id:
      - binary_sensor.bathroom_tuyatec_b5g40alm_rh3040_motion
    to: "off"
    for:
      hours: 0
      minutes: 2
      seconds: 0
action:
  - choose:
      - conditions:
          - condition: sun
            before: sunrise
            after: sunset
        sequence:
          - service: light.turn_on
            data: {}
            target:
              entity_id: light.bathroom_light
          - service: light.turn_off
            data: {}
            target:
              entity_id: light.bathroom_light
mode: restart

Use the 3 dots, and hit ‘change mode’

looks a bit weird to me;
It is either ‘detected / cleared’ or ‘open / close’, not a mix of both.

Normally, when a sensor has the motion class, it uses ‘detected / cleared’ in the GUI, but when you look in the YAML, it uses ‘open / close’ :wink:

This is what I want it like but to work!

alias: >-
  Turn on/off Kitchen Led 1 Led 2 on motion between 20:00 and 00:10 and off after 3min
  without motion
description: ""
trigger:
  - platform: state
    id: "on"
    entity_id:
      binary_sensor.tuyatec_b5g40alm_rh3040_motion_3
    to: "on"
  - platform: state
    id: "off"
    entity_id:
      binary_sensor.tuyatec_b5g40alm_rh3040_motion_3
    to: "off"
    for:
      hours: 0
      minutes: 3
      seconds: 0
condition:
  - condition: sun
    before: sunrise
    after: sunset
action:
  - choose:
      - conditions:
          - condition: trigger
            id:
              - "on"
          - condition: time
            after: "20:00:00"
            before: "00:10:00"
        sequence:
          - service: light.turn_on
            data:
              brightness_pct: 60
            target:
              - light.kitchen_led_1
              - light.kitchen_led_2
    default:
      - service: light.turn_off
        data: {}
        target:
          - light.kitchen_led_1
          - light.kitchen_led_2
mode: restart

But like now I keep getting errors and really the time should not be needed as it is suppose to go off the sunset! So unless I know what to do from top to bottom to add what I want I have no clue what to do, only think I know what to do is use smartlife and it works!

Getting errors now can we start from what we add from top to bottom to do these tasks, please?