#What’s the automation? I’m too lazy to

1 messages · Page 1 of 1 (latest)

lilac pike
#

oh what the hell

#

hang on

smoky quartz
#

lol what? I didn’t do nothing.

lilac pike
#

f'in POS

smoky quartz
#

Are you using a code paste site?

lilac pike
#

i was trytin to put it here as a file

stray rootBOT
#

Please use a code share site to share code or logs, for example:

Please don't use Pastebin, since it can randomly add spaces to the main view. Please also don't share text as images since it makes it harder for people to help you. Remember that others may have colour blindness, impaired vision, etc.

smoky quartz
#

Do that.

#

I’m mobile and file attachments open in notes and it sucks. 😊

lilac pike
smoky quartz
#

Wow… you’re taking the long way round, huh? Ok, so what’s breaking?

lilac pike
#

so the issue atm is that the lights are turning on to the initial setting

#

but they arent getting set to the running value

#

line 47

#

works

#

52-59 is where (I think) the issue is

smoky quartz
#

Ok. Give me a sec.

lilac pike
#

sure!, i appreciate you looking

smoky quartz
#

Line 59: states['binary_sensor should be states('binary_sensor

#

Also occupancy'] should be occupancy')

lilac pike
#

ok lemme see where that is

smoky quartz
#

Line 59 😊

lilac pike
#

i meant in HA

#

lol

smoky quartz
#

ohhhhh yeah. Lol gotcha.

#

Just switch to YAML editing in the UI and edit those two and it should work.

lilac pike
#

its not a visual automation ... did all this by hand lol

smoky quartz
#

Ahhhh. So, line 90, same problem. And there are others further down too.

lilac pike
#

so i had 4 of those

smoky quartz
#

Yup

lilac pike
#

changed them, let's give it a whirl

#

Actions: Unexpected value for condition: 'None'. Expected and, device, not, numeric_state, or, state, sun, template, time, trigger, zone @ data[0]['if'][1]

#

wtf

#

forgot "then:"

#

smh

smoky quartz
#

lol

lilac pike
#

ok

#

same prollem

#

comes on at 1% (configured) but doesnt get brighter

#

hard to do a trace on it too, since frigate floods the crap outta mqtt

smoky quartz
#

True. Is there any reason you’re not using the frigate integration and using the binary_sensors?

lilac pike
#

multiple cameras and lights

#

specifically:

var:
  frigate_lighting_monitor6_lights:
    initial_value:
      - light.craftroom_lamp
    attributes:
      friendly_name: "[Frigate Lighting] Controlled Lights"
    restore: false
smoky quartz
#

Ok, so correct me if I’m wrong, you’re trying to use the cameras like presence sensors?

lilac pike
#

different cameras control different lights when a person is in the room

#

yep

#

exactly

smoky quartz
#

Got it. Ok. Let me get on a bigger screen.

lilac pike
#

I'm open to screenshare / audio too if it helps

smoky quartz
#

Nah. I’ll get it. Just need to see it on something bigger than my phone.

lilac pike
#

that way you can see more than what I can paste and/or I can tell you verbally how its supposed to work in my head

#

lol

#

you'll need the 'camera' config too, lemme send that to dpaste too

smoky quartz
#

Oh, I get what you’re trying to do (buy a damn motion sensor!!!).

lilac pike
#

lmfao

#

money's tight

#

like ... moreso than a virgin's ass

smoky quartz
#

Ok, so, try this… in the template editor, try this:

lilac pike
#

(I also have 4 cats, so 'motion' is going to set it off all the time)

smoky quartz
#
{% set topic = ‘[your topic]’ %}
{{  (now() - timedelta(seconds=states('input_number.frigate_'~topic.split('/')[0]~'_timeon_duration')|int)) > states('binary_sensor.'~topic.split('/')[0]~'_person_occupancy').last_changed }}
#

Oh wait… hmmmmm

#

Check out my edit.

lilac pike
#

UndefinedError: 'str object' has no attribute 'last_changed'

#

i think thats why i had the square brackets

#

yep

smoky quartz
#

Try this: state_attr(‘binary_sensor.'~topic.split('/')[0]~'_person_occupancy' ,’last_changed’)

lilac pike
#

{{ state_attr('binary_sensor.'~topic.split('/')[0]~'_person_occupancy' ,'last_changed') }} returns null

#

hangon

smoky quartz
#

And you set it to a topic, right?

lilac pike
#

yes

#

needs to be [1]

#

because Im dumb sometimes

#

lemme check some things

smoky quartz
#

What topic did you use?

lilac pike
#

frigate/monitor6

smoky quartz
#

lol that too (not dumb, needs to be 1)

#

That binary_sensor is a frigate sensor?

lilac pike
#

like I said - I've been whackin at this thing all damn day

#

yes its from frigate

smoky quartz
#

Oh I get it. Been there, done that.

lilac pike
#

ok so problem is still the same,

#

but the light still comes on

#

so not going backwards

smoky quartz
#

Yeah, it’s something with this template… just need to figure out what.

lilac pike
#

omg

smoky quartz
#

What does that binary sensor show in States?

lilac pike
#

wait

#

i changed one, but not both of the [0]'s

smoky quartz
#

LMAO

lilac pike
#

:🤦:

#

in fact, I think all of them need to be [1] not [0]

#

good grief

smoky quartz
#

Only you would know… I don’t know how those sensors are named.

lilac pike
#

well

#

im listening to frigate/#

#

thats[0]

smoky quartz
#

Ah crap. You’re right.

lilac pike
#

then there's frigate/monitor(n)/#

#

which is [1]

#

and the light goes bright

smoky quartz
#

So, it would be binary_sensor.monitor6_xxx

lilac pike
#

yep

#

ok

#

SO!

smoky quartz
#

Ok so wait… it was literally a 0, 1 problem?!

lilac pike
#

let me turn it down to 50 and make sure that im not losing my fin mind

#

honestly, i think maybe

#

but Im not sure I want to admit that

smoky quartz
#

And here I thought this was a quick 5 minute fix. lmao

lilac pike
#

lol

#

ok

#

so,

#

it's going directly to running value

#

vs init value

smoky quartz
#

Isn’t that the desired result?

lilac pike
#

yes and no

#

light on @ initval, wait n seconds, check if person is still there, if yes, raise to runningval

#

well,

#

not 'wait'

smoky quartz
#

Line 56. Change 0 to 1?

lilac pike
#

i missed on

#

one

#

would be 87 for dpaste

smoky quartz
#

All of them. Should be 1, I think

lilac pike
#

youre right

#

but it still goes to runningval, not init

#

right off the bat

#

so

#

hmm

#

alright lemme paste the whole damn thing real quick

#

maybe you'll catch something I didnt

smoky quartz
#

Ok. So, I don’t see where the input_number is being set or any increase to the brightness_pct. Let me look again.

lilac pike
#

input numbers are being set via gui

#

values are init: 10, duration: 10, running: 100

smoky quartz
#

Right. But, what I mean is, there’s no service call to raise or lower the brightness_pct. So, they trigger on the topics and all that, but there’s nothing that increases or decreases brightness. Am I missing that?

lilac pike
#

lemme check

#

it's the if: under the until:

smoky quartz
#

Which line?

lilac pike
#

well, sun.sun is below_horizon now, so line 137

#

136**

smoky quartz
#

So, you have the repeat, but the input_number never changes, so it’s just setting the same value over and over.

#

Right… but, the initial value is 50%, but there’s nothing in the automation that changes that.

lilac pike
#

no, init is 10%

#

i think

#

yeah

#

10%

smoky quartz
#

Ahhhhh ok, NOW I SEE IT

#

Ok, so the initial is 10% and should go to 50%. Right? And right now it goes straight to 50%?

lilac pike
#

right

smoky quartz
#

So, here’s what I’m thinking… it IS starting at 10%, but then very quickly, it jumps to 50%. So, maybe it appears like they are turning on at 50%, but in reality 2 commands are sent back to back. Do your bulbs support transitions?

lilac pike
#

yes and no... it does it by default

#

but officially, it just goes to 100%

#

but it steps

smoky quartz
#

Hmmmm maybe throw a delay of like 2 seconds after the initial turn_on might help here.

lilac pike
#

gotta wait a few, 2 people in the room atm

#

then i can test again

smoky quartz
#

Ok 😊

lilac pike
#

ok so I got the lady tucked in

#

taking another look at what is supposed to happen 1st, make sure I have the right values

smoky quartz
#

Ok.

lilac pike
#

it's gotta be the time template

#

line 135

smoky quartz
#

That’s the only thing I can think of at this point.

#

I wonder if it’s the last_changed. It was coming up as None in the template editor, right?

lilac pike
#

hmm yeah

#

changing it to 'states['binary_sensor.'~topic.split('/')[1]~'_person_occupancy'].last_changed' on the templater yields a value

smoky quartz
#

Huh, yeah, I was wrong about that. But, I use state_attr for those kind of things. Ok, try changing it back and see if it works better?

lilac pike
#

im gonna throw some stops in

#

see just where the hell this thing is being stupid

#

its '- stop "reason", i think?

smoky quartz
#
  • stop: reason
lilac pike
#

yera

#

shesh type

#

2 in a row

smoky quartz
#

lol yup. Same.

lilac pike
#

ok

#

made some debug progress

#

lines 47-49 are garbage

#

as_datetime returns null

#

because 12:00:00 is a str

#

not an actual date

smoky quartz
#

Huh, so, probably need a strptime there as well.

lilac pike
#

you happen to know what the format would be?

#

probably "%d/%m/%Y %H:%M:%S"

lilac pike
#

I'd thought you might like to know ... i tinkered with this a little more last night and ended up just going to bed

#

but now this morning the light is behaving the way it should

#

🤷

lilac pike
#

alright, so whatever I possibly figured out last night is actually working. correctly

#

thanks for your help last night

smoky quartz
#

Yay!!! That's awesome. That's a beast of an automation. lol

lilac pike
#

yeah, sometimes I go hard

#

lol

lilac pike
#

hey, can I DM you real quick?