pimatic / rfcontroljs

nodejs modul with protocol support for different 433mhz switches and weather stations for the RFControl Arduino library.
GNU General Public License v3.0
49 stars 54 forks source link

doorbell1.coffee encode message state incorrect? #124

Closed primatic closed 5 years ago

primatic commented 6 years ago
encodeMessage: (message) ->
      id  = helper.map(helper.numberToBinaryLSBMSB(message.id, 12), binaryToPulse)
      unit = helper.map(helper.numberToBinaryLSBMSB(message.unit, 11), binaryToPulse)
      state = (if message.state then binaryToPulse['0'] else binaryToPulse[''])
return "#{id}#{unit}#{state}02"

should state line be

      state = (if message.state then binaryToPulse['0'] else binaryToPulse['1'])

?

mwittig commented 5 years ago

Hi, sorry for the late reply. Looks odd to me either. The question also is whether or not the protocol has a state bit at all, or it is just always 0 (file bit). Most doorbell protocols don't have a state. Sending the datagram simple means the doorbell button has been pushed (or the bell is ringing). I digged a little deeper, but I could not find I out why ronning did this change. My guess: As doorbeel1 is a switch protocol (not sure why) it will also trigger a message for the off state. Now, if the state bit is a fill bit, switching off will cause the bell to ring again. Anyhow, I'll leave this as is until someone with the device sends a complaint. Closing this now