Skip to content

Commit

Permalink
Merge pull request #926 from DaveNeudoerffer/ha_fixes
Browse files Browse the repository at this point in the history
fixed test of uninitialized variable
  • Loading branch information
hplato authored Nov 11, 2024
2 parents f2d8f6c + d712813 commit a77223d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/HA_Item.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,7 @@ sub process_ha_message {
} elsif( $self->{domain} eq 'select' || $self->{domain} eq 'input_select' ) {
$self->debug( 1, "$self->{domain} event for $self->{object_name} set to $new_state->{state}" );
$self->set_mh_state( $new_state->{state}, $p_setby, $p_response );
if( $p_setby eq 'ha_server_init' ) {
if( $p_setby && $p_setby eq 'ha_server_init' ) {
$self->set_states( @{$new_state->{attributes}->{options}},"override=1" );
}
} elsif( $self->{domain} eq 'fan' ) {
Expand All @@ -1270,7 +1270,7 @@ sub process_ha_message {
}
$self->debug( 1, "fan event for $self->{object_name} set to $new_state->{state} ($level)" );
$self->set_mh_state( $level, $p_setby, $p_response );
if( $p_setby eq 'ha_server_init' ) {
if( $p_setby && $p_setby eq 'ha_server_init' ) {
#percentage_step gives the number of speed steps for the fan
if (defined $new_state->{attributes}->{percentage_step}) {
my @states = ();
Expand Down Expand Up @@ -1332,7 +1332,7 @@ sub process_ha_message {
} else {
$self->debug( 1, "climate $self->{object_name} default object set: $state" );
}
if( $p_setby eq 'ha_server_init' ) {
if( $p_setby && $p_setby eq 'ha_server_init' ) {
if( $self->{subtype} eq 'hvac_mode' ) {
$self->set_states( @{$new_state->{attributes}->{hvac_modes}},"override=1" );
} elsif( $self->{subtype} eq 'fan_mode' ) {
Expand Down

0 comments on commit a77223d

Please sign in to comment.