Hi, I have added voltage meassurement publissing to your scrip.
it has a deviation of .5V from the real battery voltage, it seems no correct meassurement at all, but correction can be applied.
I don't have much knowledge of script language so is possible some math functions could be applied onto the scrip itself.
it has a deviation of .5V from the real battery voltage, it seems no correct meassurement at all, but correction can be applied.
I don't have much knowledge of script language so is possible some math functions could be applied onto the scrip itself.
![[BK7231N CBU] Generic Temperature and Humidity Sensor [BK7231N CBU] Generic Temperature and Humidity Sensor](https://obrazki.elektroda.pl/9693268100_1674079204_thumb.jpg)
addEventHandler OnClick 20 startScript this runmeas 456
init:
echo "Init driver and powersave "
startDriver TuyaMCU
setChannelType 1 temperature_div10
setChannelType 2 humidity
setChannelType 3 toggle
setChannelType 4 Voltage
setchannelType 5 toggle
PowerSave
again:
echo "activate SHT3X Sensor"
startDriver SHT3X
setChannel 3 1
echo "Send some measure"
delay_s 2
echo "stop SHT3X driver"
stopDriver SHT3X
echo "activate voltage meassurement"
setChannel 5 1
delay_s 1
publishFloat "Voltage" $CH4/1000
setchannel 5 0
setChannel 3 0
echo "wait 10min"
delay_s 600
goto again
runmeas:
// stopScript ID bExcludeSelf
// this will stop all other instances
stopScript 456 1
echo "Force measurement"
startDriver SHT3X
setChannel 3 1
delay_s 2
stopDriver SHT3X
setChannel 5 1
delay_s 1
publishFloat"Voltage" $CH4/1000
setchannel 5 0
setChannel 3 0
echo "go back to loop"
goto again;