change state code

This commit is contained in:
Marko Oldenburg 2020-04-26 17:33:41 +02:00
parent 29ab9a53c7
commit 69d82a997e

View File

@ -635,9 +635,10 @@ sub WriteReadings($$) {
readingsBulkUpdate(
$hash, 'state',
(
ReadingsVal( $name, 'outlet-valve_open', 0 ) == 1
? RigRadingsValue( $hash, 'open' )
: RigRadingsValue( $hash, 'closed' )
ReadingsVal( $name, 'watering-watering_timer_1_state', 0 )
eq 'idle'
? RigRadingsValue( $hash, 'closed' )
: RigRadingsValue( $hash, 'open' )
)
) if ( AttrVal( $name, 'model', 'unknown' ) eq 'watering_computer' );