Kees - I am trying to get a bilge alarm from HA...
I am trying to get a bilge alarm from HALMET directly outputting to Bilge Alarm PGN for NMEA 2000. Anyone has an example there? I am able to get the bilge alarm path in signalk, but want to get it directly from Halmet to NMEA without relying on my signalk server.
5 Replies
I have a NMEA 2000 battery Monitor that could be used as an example and has a bilge monitor that uses a float switch to set bilge to 0 or 1 and transmit that out? see: https://github.com/Techstyleuk/SensESP-NMEA2000-Battery-Monitor/tree/main it is in SensESP ver 2.0 so some bits would need to be changed but shouldn't change the NMEA2000 stuff.
it uses PGN127505 and sets grey water fluid level to full when the float switch is activated
Ah thanks, will have a look. Looks indeed bit different then the hamlet firmware example in terms of code. Is there somewhere a bilge alarm pgn for just bilge water? Not sure how I can find the bits and pieces for such mapping
in the definition of PGN127505:
* Fluid Level contains an instance number, type of fluid, level of fluid, and
* tank capacity. For example the fluid instance may be the level of fuel in a
* tank or the level of water in the bilge. Used primarily by display or
* instrumentation devices.
I copied this from "N2kMessages.h" (https://github.com/ttlappalainen/NMEA2000/blob/master/src/N2kMessages.h) but believe it is a direct copy of the NMEA2000 standard. This is what I used in my code. There seems to be some Halmet specifics for alarm inputs (line 272 of main.cpp) but you should be able to send out a 127505 message and then have you MFD see this as bilge high and alarm
added that to n2kmessages.h
and then this in main.cpp
// Initialize the N2kBilgeAlarmSender with appropriate values
String bilge_config_path = "/bilge_alarm"; // Or use the path where the config is stored
uint8_t bilge_instance = 1; // Set a unique instance ID
bool initial_alarm_state = alarm_d4_input->get(); // Start with the initial state
// Create N2kBilgeAlarmSender instance
N2kBilgeAlarmSender* bilge_alarm_sender = new N2kBilgeAlarmSender(bilge_config_path, bilge_instance, initial_alarm_state, nmea2000);
alarm_d4_input->connect_to(bilge_alarm_sender->alarmstate);
need to test in a real n2k network, but it might work
i went for the alert PGN rather than the fluid PGN as i dont need fluid level for bilge as its on/off switch