thanks romeak01
i have update with my sample, i think that will run ok.
#include <MySensor.h>
#include <SPI.h> //import MySensors library
#define trigPin 6
#define echoPin 5
int max = 91; //distance (cm) from min water level to sensor
int min = 6; // distance (cm) from max water level to sensor
int procent; //distance percentage
int ilosc; //amount of the tank as a percentage
#define child_id_ilosc 1 //setting to identify the amount of water in the tank
MySensor gw;
MyMessage msgilosc(child_id_ilosc, V_IMPEDANCE);
void setup() {
pinMode(trigPin, OUTPUT); //Pin, that its connet to trig
pinMode(echoPin, INPUT); //a echo, input
gw.begin(); //launch MySensors library
gw.sendSketchInfo("Water tank meter", "1.0");
gw.present(child_id_ilosc, S_WEIGHT); //present data to controller
}
void loop() {
long czas, dystans, diferenca;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
czas = pulseIn(echoPin, HIGH);
dystans = czas / 58;
diferenca = max -min;
procent = (((dystans - min) * 100) / diferenca);
ilosc = 100 - procent;
gw.send(msgilosc.set(ilosc)); // send to controller
delay(1000); // delay
}```