Puck stops working/broadcasting once it's disconnected from IDE… is it my code? #4380
Replies: 1 comment
-
Posted at 2025-01-26 by @allObjects I suggest that you put this part of the code
into the Then when Doing so gives a different grieve when connected and uploading code. The uploaded code will not start... because nobody calls it or there is no power cycle. For that reason, I put in all my code during development time this as the last line of code:
Posted at 2025-01-27 by @gfwilliams I think it's probably complaining about the data not being valid (since the nRF52 checks the data looks ok before transmitting - I think maybe the length is wrong in array index 5?), but you can't see because you're disconnected. Maybe try adding Personally, I think this is probably not a good idea - you want to save
The easiest option would be just to add moisture to BTHome though? If you just put ... and then do Or at the very least use Espruino to package up the BTHome data for you so you don't have to worry about getting the lengths right:
Posted at 2025-01-27 by remy Cheers, I had suspected it was my packet, because I had it working when I using the I temporarily got around the BTHome issue by using the module, and sending the moisture under humidity, then renaming the entity at my HA instance. Long story short - yep, Gordon is right, for anyone thinking of doing this here's the updated code attached (there was also a fairly big bug in my code that chews through the battery since the moisture probe sensor is always on). Attachments: Posted at 2025-01-28 by @gfwilliams Thanks! I believe I have just added moisture to the BTHome library - please can you try now and see if it works? I made some changes to reduce code size too. I also added the ability to supply custom data as an array (https://www.espruino.com/BTHome#custom-data) so hopefully this won't happen again if someone needs to add something that the default library doesn't support. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Posted at 2025-01-25 by remy
I've been trying to make a simple moisture sensor broadcasting using bthome. Moisture isn't a valid type for the
BTHome
library, so I'm sending the bytes directly.Upon the update function being called (every 2 seconds), the LED flashes. Whilst the puck is connected (over BT) to the Espruino IDE the puck appears to work - flashing the LED.
As soon as I disconnect the browser, the LED stops flashing, and I can no longer connect to the puck. Only a full reset (re-insert battery with BTN1 held for 10 seconds) allows me to reconnect.
This is the output from
process.env
:I've got my moisture sensor wired to GND, 3V and AOUT (from moisture) to D28 on the Puck.
This is my code, but I can't see anything that might cause any issue:
Any ideas what this might be - or equally is there any way I can debug the device in any other way?
Beta Was this translation helpful? Give feedback.
All reactions