lprhodes / broadlinkjs-rm

Control the IR and RF interfaces within Broadlink RM devices.
MIT License
57 stars 52 forks source link

Clear learned data #9

Closed fbacker closed 5 years ago

fbacker commented 5 years ago

What I want to happen

When running device.enterRFSweep(); the broadlink *rawData should be cleared. This happens when running device.enterLearning();.

SIDENOTE: When running RF, if I run enterLearning and then enterRFSweep, it won't find my RF Frequency.

What happens

Stored data is there until I hard reboot the broadlink.

The Issue

After recorded an action and it's time to record another. The previous action data is sent thru rawData before I get the change to change it.

Extra description

I've got both IR and RF recordings to work. However after the first successful learned code it's kept in the Broadlink for RF. So each time I run device.checkRFData(); inside an interval loop the event triggers device.on("rawData", data =>

So when I will learn a new action the old data is sent back before I get a change to send something new.

Is there a way to 'cleanup' the 'rawData'? Tried running device.cancelLearn(); before I start with no success.

fbacker commented 5 years ago

Don't know if its working now.

so.

twittwer commented 4 years ago

Hi @fbacker did you make it working?

If so, can you tell me what data is used to send it later to device.

fbacker commented 4 years ago

Yes, it's working. Over a year ago so don't remember. Stale repository, not running PR so going on own fork https://github.com/fbacker/broadlinkjs-rm where I use it in this project to record and trigger commands https://github.com/fbacker/broadlink-mqtt-bridge

Interrested so check https://github.com/fbacker/broadlink-mqtt-bridge/blob/master/src/web.js method recordAction. Line 448 and 471 collects promises to run in certain order.

twittwer commented 4 years ago

@fbacker Thank you very much - I work's with your mqtt bridge 🎉

I'll have a deeper look in the inner workings in the next time, because I don't need mqtt, but maybe it will be the easier solution 🤔

Thx again 👍