sailingYOLO
sailingYOLO
SKSignal K
Created by sailingYOLO on 2/10/2025 in #sensesp
sailingYOLO - I often (many times a week) get:...
Thanks for your input. I'm using version 3. It looks like a bug, when the message "websocket client is not connected" is rolling in the serial output I can still access the ESP:s web UI, so the ESP has a working connection at that time, but the SensESP does not recognize that the network is up (again? probably after a short down time). The web UI even tells me that it indeed have connection to the SignakK server. Where and how to report this bug please?
2 replies
SKSignal K
Created by sailingYOLO on 1/19/2025 in #sensesp
sailingYOLO - Hi guys.This code works well ex...
I built my own threshold function, works great now. If anyone else is struggeling, this is how I did it:
c++
// Bilge Monitor //

const uint8_t kDigitalInputBilgePin = 4;
const unsigned int kDigitalInputBilgeInterval = 1000;

pinMode(kDigitalInputBilgePin, INPUT_PULLUP);

SKMetadata* Bilgemetadata = new SKMetadata();
Bilgemetadata->description_ = "Bilge Sensor";
Bilgemetadata->display_name_ = "Bilge Sensor";
Bilgemetadata->short_name_ = "Bil Sen";

auto* bilge_input = new RepeatSensor<bool>(
kDigitalInputBilgeInterval,
[kDigitalInputBilgePin]() { return gBoolLiquidInBilge; });

bilge_input->connect_to(new LambdaTransform<bool, String>([](bool input) ->String {
if (input == 1) {return "Liquid detected in bilge!";}
else {return "Bilge is clear";}}))
->connect_to(new SKOutputString("environment.bilge.liquid",Bilgemetadata));

bilge_input->connect_to(new SKOutputBool("environment.bilge.liquidBool"));

event_loop()->onRepeat(kDigitalInputBilgeInterval, []() {
bool bilge = digitalRead(kDigitalInputBilgePin);
//ESP_LOGD(__FILENAME__, "********Bilge bilge=%d count=%d ", (int)bilge, gIntBilgeCount);
if (bilge){
gIntBilgeCount++;
if (gIntBilgeCount > 11){gIntBilgeCount = 11;} // Prevents overflow
if (gIntBilgeCount > 10 and gBoolLiquidInBilge == false){
gBoolLiquidInBilge = true;
updateDisplay();
}
} else {
gIntBilgeCount--;
if (gIntBilgeCount < 0){gIntBilgeCount = 0;} // Prevents overflow
if (gIntBilgeCount < 1 and gBoolLiquidInBilge == true){
gBoolLiquidInBilge = false;
updateDisplay();
gIntBilgeCount = 0;
}
}
});
c++
// Bilge Monitor //

const uint8_t kDigitalInputBilgePin = 4;
const unsigned int kDigitalInputBilgeInterval = 1000;

pinMode(kDigitalInputBilgePin, INPUT_PULLUP);

SKMetadata* Bilgemetadata = new SKMetadata();
Bilgemetadata->description_ = "Bilge Sensor";
Bilgemetadata->display_name_ = "Bilge Sensor";
Bilgemetadata->short_name_ = "Bil Sen";

auto* bilge_input = new RepeatSensor<bool>(
kDigitalInputBilgeInterval,
[kDigitalInputBilgePin]() { return gBoolLiquidInBilge; });

bilge_input->connect_to(new LambdaTransform<bool, String>([](bool input) ->String {
if (input == 1) {return "Liquid detected in bilge!";}
else {return "Bilge is clear";}}))
->connect_to(new SKOutputString("environment.bilge.liquid",Bilgemetadata));

bilge_input->connect_to(new SKOutputBool("environment.bilge.liquidBool"));

event_loop()->onRepeat(kDigitalInputBilgeInterval, []() {
bool bilge = digitalRead(kDigitalInputBilgePin);
//ESP_LOGD(__FILENAME__, "********Bilge bilge=%d count=%d ", (int)bilge, gIntBilgeCount);
if (bilge){
gIntBilgeCount++;
if (gIntBilgeCount > 11){gIntBilgeCount = 11;} // Prevents overflow
if (gIntBilgeCount > 10 and gBoolLiquidInBilge == false){
gBoolLiquidInBilge = true;
updateDisplay();
}
} else {
gIntBilgeCount--;
if (gIntBilgeCount < 0){gIntBilgeCount = 0;} // Prevents overflow
if (gIntBilgeCount < 1 and gBoolLiquidInBilge == true){
gBoolLiquidInBilge = false;
updateDisplay();
gIntBilgeCount = 0;
}
}
});
2 replies
SKSignal K
Created by sailingYOLO on 1/19/2025 in #sensesp
sailingYOLO - Hi guys.This code works well ex...
When i removed the debounce it works. When reading the docs it states that no results are sent if no change in the digitalRead in this case. So there isn't any other way to "debounce" and still send the last debonced state?
2 replies
SKSignal K
Created by sailingYOLO on 1/12/2025 in #sensesp
sailingYOLO - Hi,I'm trying to get engine run...
Thank you, that worked great! Is there a way to get a SignalK value from the server on demand instead of getting events triggered every listen_delay?
8 replies
SKSignal K
Created by sailingYOLO on 1/12/2025 in #sensesp
sailingYOLO - Hi,I'm trying to get engine run...
Hi. Thanks again for the fast answer 🙂 Have looked into the chain counter example, but need to look some more. Still no clue how to read SignalK path from SensESP, anyone that can direct me to an example please.
8 replies
SKSignal K
Created by sailingYOLO on 1/12/2025 in #sensesp
sailingYOLO - Hi,I'm trying to get engine run...
Hi. Thanks for the comprehensive answer 👍 . Maybe I was unclear, I have everything working, SK data, Display update, Button events and actions to update on demand. I did also look at the example, previous of posting here, but I still don't understand how call a function from within the ->Connect_To function? Lambda? I want to update the display automagically every 30 minutes or so, that's configured in the Listener I guess. 1. How do I populate the value from a SK-path to a global variable? 2. How do I call a function from the Connect_To? Sorry for the misunderstanding, again, thank you for the previous answer!
8 replies
SKSignal K
Created by ab19 on 10/17/2024 in #questions
SensESP OTA Updates thru VPN
Hi. Check that you have the correct default gateway in your ESP WiFi configuration if using static IP. If using DHCP, check that your DHCP-server sends the correct default gateway.
2 replies
SKSignal K
Created by FlyingK on 10/3/2024 in #sensesp
FlyingK - Got my test setup up and running. Tha...
Sounds great! Do you have any source code available?
1 replies
SKSignal K
Created by sailingYOLO on 11/23/2024 in #sensesp
sailingYOLO - Hi. I have a simple bilge sensor ...
Thank you for your answers, what a community 😃 Debounce was exactly what I was after, perfect! This is the code that works greate for a digital inputreader, and for me:
c++
auto* bilge_input = new DigitalInputState(4, INPUT, 11000,"/bilge/input");

bilge_input->connect_to(new DebounceBool(10000,"/bilge/debounce"))
->connect_to(new LambdaTransform<bool, String>([](bool input) ->String {
if (input == 1) {return "Liquid detected in bilge!";}
else {return "Bilge is clear";}}))
->connect_to(new SKOutputString("propulsion.engine.bilge"));
c++
auto* bilge_input = new DigitalInputState(4, INPUT, 11000,"/bilge/input");

bilge_input->connect_to(new DebounceBool(10000,"/bilge/debounce"))
->connect_to(new LambdaTransform<bool, String>([](bool input) ->String {
if (input == 1) {return "Liquid detected in bilge!";}
else {return "Bilge is clear";}}))
->connect_to(new SKOutputString("propulsion.engine.bilge"));
5 replies