How do I automate scenes and program this logic for buttons?

I'm still trying to learn how to go about programming this stuff. I've had my C7 hub for less than a month. I'm not averse to it but I have no experience with coding. I haven't tried using RM yet, but I know there are some other apps out there that are similar. I'm also not sure whether I should use RM or one of those apps. I'm also not sure how to program all of this logic in.

Here everything I'm trying to set up:

Switch lights on with a button, but the colours depend on time
I have three scenes set up which all use a combination of Lifx and Hue bulbs. The scenes are defined in Hubitat with the Groups and Scenes app. Each scene (Daylight, Early Evening & Late Evening) has a different lighting colour and intensity.

IF Button 1 is pressed,
AND the lights are off

	AND
	IF it's after sunrise
		AND 
		IF it's before sunset
		THEN fade in "Daylight" over 5 sec

	ELSE
	IF it's sunset + 30 mins
		AND
		IF it's not past sunset + 60 mins
	THEN fade in "Early Evening" over 5 sec

	ELSE 
		IF it's Sunset + 60 mins
		AND
			IF it's before sunrise
		THEN fade in "Late Evening" over 5 sec

ELSE 
IF the lights are on
THEN switch lights off over 2 sec

Change light colour automatically, but only if someone is home:
I currently have something like this running in the Lifx app, but it can't cope with presence, so I want to port it to the Hubitat.

IF I am at home 
AND the lights are on,
THEN at sunset + 30 mins fade in "Early Evening" over 15 mins

IF I am at home 
AND the lights are on,
THEN at sunset + 60 mins fade in "Late Evening" over 15 mins 	

Light Switch Toggles
I need a button to toggle lights depending on whether a light is on or not.

This is the logic I want.

IF Button 1 is pressed
	AND "Light A" is off
	AND "Light B" is off
	THEN switch on "Light A"
	AND switch on "Light B"

ELSE IF EITHER "Light A" OR "Light B" is on
THEN switch "Light A" off
AND switch "Light B" off

I want the same button to turn a specific light on:

IF Button 1 is held
AND "Light A" is off
THEN switch "Light A" on

Update: I installed rule machine and programmed this with two rules. If anyone has any optimisation or streamlining suggestions, let me know!
image
image

Turn off everything when no one is home
I want to ensure that nothing comes on and no automations play when we're not home

IF I am not home
THEN switch everything off
AND disable all automations

PS: Why are some IFs and ANDs blue and others not?

You can do this much more easily with button controller. It's essentially built into rule machine, but much simpler to setup for buttons. In your scenes, use the Restrictions fields to set the color and brightness for that scene based on the time of day.

Screen Shot 2020-12-11 at 12.41.45 PM