I’ll try to answer this question as best as I can.
if you were planning to put the roomba 980 into a room press clean then close the door behind it.
I suppose you can pass a flag to image.php I don’t code PHP, but I’ve seen Jeremy’s code in configuration.yaml shell_command
vacuum_clear_image: curl -X GET -s -O /dev/null '{{ states("input_text.vacuum_map") }}?clear=true'
vacuum_generate_image: curl -X GET -s -O /dev/null '{{ states("input_text.vacuum_map") }}?last=true'
he passes clear=true, and last=true into image.php
inside the image.php he uses isset($_GET['clear'])
and isset($_GET['last'])
to get values
you can do something similar without having to get room Xprime, Yprime boundary min/max values.
Another way is to obtain X prime, Y prime boundary values as the roomba enters a specific room using the wikipedia formula. Because of the rotation on the original X,Y data, you can’t use the original X,Y data to obtain a pair of X boundary min/max values or a pair of Y boundary min/max values when entering a room.
You can do this watching in home assistant gui X prime, Y prime value as roomba crosses into that room.
add the following script below into lovelace markdown card
you’ll see in realtime the transformed Xprime, Yprime values
{% set x = state_attr('sensor.rest980', 'pose')['point']['x'] %}
,
{% set y = state_attr('sensor.rest980', 'pose')['point']['y'] %}
,
{% set rot_angle_in_degrees = -2.5 %}
{% set scale=0.97 %}
{% set xp_offset=35 %}
{% set yp_offset=0 %}
{% set xp=xp_offset+(x*cos(rot_angle_in_degrees*pi/180)+y*sin(rot_angle_in_degrees*pi/180))*scale %}
{% set yp=yp_offset+(-1*x*sin(rot_angle_in_degrees*pi/180)+y*cos(rot_angle_in_degrees*pi/180))*scale %}
origX, origY {{ x, y }}
Xprime,Yprime {{ xp, yp }}
once you get room boundary Xprime, Yprime values you can put in
if -else if logic inside image.php around line 112, after my previous code snippet where x,y values were recalculated.
your top left room for instance would have php if else like this
if ($x>=$x_room1_boundary_min && $x<=$x_room1_boundary_max
&& $y>=$y_room1_boundary_min && $y<=$y_room1_boundary_max) {
//here you can fine tune and add room specifix X_offset, Y_offset, scale
}