Skip to content

Instantly share code, notes, and snippets.

@mullender
Created October 29, 2023 21:57
Show Gist options
  • Save mullender/19707d270f3f24039f68a6ddca18a2cf to your computer and use it in GitHub Desktop.
Save mullender/19707d270f3f24039f68a6ddca18a2cf to your computer and use it in GitHub Desktop.
First attempt at tracking location over time in two dimensions, using the Everything Presence Lite sensor
type: custom:plotly-graph
title: XY Sensor plot
hours_to_show: 1
refresh_interval: 5s
entities:
- entity: binary_sensor.everything_presence_lite_252dd0_occupancy
internal: true
filters:
- resample: 5s
fn: $fn ({ xs, ys, vars }) => { vars.isPresent = ys; vars.xs = xs; }
- entity: sensor.everything_presence_lite_252dd0_target_1_x
internal: true
filters:
- resample: 5s
- filter: vars.isPresent[i]=="on"
- multiply: -1
- exponential_moving_average: null
fn: $fn ({ xs, ys, vars }) => { vars.posX = ys; vars.xs = xs; }
- entity: sensor.everything_presence_lite_252dd0_target_1_y
internal: true
filters:
- resample: 5s
- filter: vars.isPresent[i]=="on"
- exponential_moving_average: null
fn: $fn ({ xs, ys, vars }) => { vars.posY = ys; vars.xs = xs; }
- entity: ''
x: $fn ({ vars }) => vars.posX
y: $fn ({ vars }) => vars.posY
z: $fn ({ vars }) => vars.xs
filters: null
type: scatter3d
mode: lines+markers
marker:
size: 3
opacity: 1
# opacity: $fn ({ vars }) => (vars.xs.map((xs) => (xs-vars.xs[0])/(vars.xs[vars.xs.length-1]-vars.xs[0])));
line:
color: rgba(50, 50, 217, 0.5)
width: 2
opacity: 1
raw_plotly_config: true
layout:
margin:
t: 0
l: 0
r: 0
b: 0
height: 500
scene:
annotations:
- x: $fn ({ vars }) => vars.posX[0]
y: $fn ({ vars }) => vars.posY[0]
z: $fn ({ vars }) => vars.xs[0]
text: start
showarrow: true
arrowhead: 1
xaxis:
title: X Position
yaxis:
title: Y Postion
zaxis:
title: Time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment