Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
choffmannC

choffmann

@choffmann
About
Posts
6
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • sending string via nrf and the other receivers making trouble - why?
    choffmannC choffmann

    i hope that i can update my arduino tomorrow, so that i can test if this will work....

    The FHEM code you want:
    The Devices:
    define LEDRahmen MYSENSORS_DEVICE 102 ... autmatic including des Reading/Devices
    define LEDRahmenSwitch dummy -- for setting LED and Color manually
    define LEDRahmenSwitchNotify notify LEDRahmenSwitch.* { sendLEDColor($EVTPART0, $EVTPART1) }

    and the 99_myUtils.pm Mehtods:
    (NEW: i have changed the Method from send String like 0-255-0 to 000-255-000 - see Method "changeLengthTo" )

    
    sub sendLEDColor($$){
      my ($stat,$val) = @_;
      my $tmp;
      $tmp .= changeLengthTo(hexstr_to_signed32int(substr($val,0,2)),3);
      $tmp .= "-";
      $tmp .= changeLengthTo(hexstr_to_signed32int(substr($val,2,2)),3);
      $tmp .= "-";
      $tmp .= changeLengthTo(hexstr_to_signed32int(substr($val,4,6)),3);
    
      #my $m = hexstr_to_signed32int($tmp);
      #Log 1, "MeinE Testmethode";
      #Log 1, $;
      fhem("set LEDRahmen status".$stat." ".$tmp."");
    
    
    }
    
    sub changeLengthTo($$){
      my($str,$toLength) = @_;
      my $tmpstr;
      for(my $i = (length($str)+1); $i <= $toLength; $i++){
        $tmpstr.= "0";
      }
      return $tmpstr.$str;
    }
    
    sub hexstr_to_signed32int($) {
        my ($hexstr) = @_;
        die "Invalid hex string: $hexstr"
            if $hexstr !~ /^[0-9A-Fa-f]{1,8}$/;
     
        my $num = hex($hexstr);
        return $num >> 31 ? $num - 2 ** 32 : $num;
    }
    
    Development
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular