Forum Replies Created
-
AuthorPosts
-
noskiParticipantOK I have resolved my issue by starting from scratch and re-installing everything.
My issue appears to be caused by the old OS I was running – Angstrom – which is what the BeagleBone originally came with back in 2014.
I flashed the latest Debian image to the eMMC with image “bone-eMMC-flasher-debian-10.3-iot-armhf-2020-04-06-4gb.img.xz” – downloaded from https://beagleboard.org/latest-images
I found instructions here useful for performing subsequent updates and disabling unneeded services – https://www.selectiveintellect.net/blog/2021/8/15/setting-up-a-beaglebone-black-with-debian-buster-for-iot
I then installed the Unified Firmware with these instructions – https://openthings.freshdesk.com/support/solutions/articles/5000631599-installing-and-updating-the-unified-firmwareWorks now đ
noskiParticipantI got a hint from another user @sakos on how this could be achieved in this post – https://opensprinkler.com/forums/topic/pre-configured-sd-card-image/#post-41383
Quote:
â Control of relay on legacy Opensprinkler Pi boards.
To assign the relay to a station just configure the station as âRFâ and set â0â as RF code.I downloaded their SD card image to try to figure out what changes they made.
They made changes to the function switch_rfstation in OpenSprinkler.cppThe function has slightly changed in the latest Firmware 2.1.9(9) from what sakos had. So I took what sakos did and tried to make it work.
What I came up with is this:void OpenSprinkler::switch_rfstation(RFStationData *data, bool turnon) {
ulong on, off;
uint16_t length = parse_rfstation_code(data, &on, &off);
#if defined(ARDUINO)
#if defined(ESP8266)
rfswitch.enableTransmit(PIN_RFTX);
rfswitch.setProtocol(1);
rfswitch.setPulseLength(length);
rfswitch.send(turnon ? on : off, 24);
#else
send_rfsignal(turnon ? on : off, length);
#endif
#else
if (((char*)data)[0]==’0′ && ((char*)data)[1]< ‘0’) {
//Single zero character of RF code
digitalWrite(PIN_RFTX, turnon ? HIGH : LOW);
} else {
// pre-open gpio file to minimize overhead
rf_gpio_fd = gpio_fd_open(PIN_RFTX);
send_rfsignal(turnon ? on : off, length);
gpio_fd_close(rf_gpio_fd);
rf_gpio_fd = -1;
}
#endif}
… and it works in controlling the mini-relay!
I understand the PIN used by the mini-relay has been repurposed in the code for the RF functionality.
It would be great if @Ray could implement a way to choose if you are using the RF functionality or the mini-relay.
Perhaps it could be handled with the argument to the build.sh script? something like:
sudo ./build.sh osbo_relay (for the relay)
sudo ./build.sh osbo_rf (for RF)But for now I guess I’ll have to live with my hack.
noskiParticipantSorry to dig up old thread.
I also have an OSBo and would like to make use of the mini-relay.
I have recently upgraded to Firmware 2.1.9(9).
@nystrom – were you able to get the mini-relay working? If so, what changes did you have to make?
@Ray – I know you said the mini-relay has been discontinued, but it would be great if it was still useable for those that have it. Can you provide pointers on what changes we can make ourselves to use the mini-relay?
noskiParticipantI tried to see if I could figure out a solution myself.
This first issue appeared to be:
E: Unable to locate package libmosquitto-devIt appears that package isn’t available for the BeagleBone.
When I search, there are packages available with a slightly different name:ubuntu@arm:~/OpenSprinkler-Firmware$ apt-cache search mosquitto
libmosquitto0 – MQTT version 3.1 client library
libmosquitto0-dev – MQTT version 3.1 client library, development files
libmosquittopp0 – MQTT version 3.1 client C++ library
libmosquittopp0-dev – MQTT version 3.1 client C++ library, development files
mosquitto – MQTT version 3.1 compatible message broker
mosquitto-clients – Mosquitto command line MQTT clients
python-mosquitto – MQTT version 3.1 client library, python bindingsSo I tried installing libmosquitto0-dev:
sudo apt-get install libmosquitto0-devI thought I was on a winner, but unfortunately now I get a whole new set of errors:
ubuntu@arm:~/OpenSprinkler-Firmware$ sudo ./build.sh osbo
Building OpenSprinkler…
Installing required libraries…
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libmosquitto-dev
Compiling firmware…
main.cpp: In function âvoid push_message(int, uint32_t, float, const char*)â:
main.cpp:1439:106: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 3 has type âuint32_t {aka unsigned int}â [-Wformat=]
sprintf_P(payload, PSTR(“{\”count\”:%lu,\”volume\”:%d.%02d}”), lval, (int)volume/100, (int)volume%100);
^
main.cpp:1442:120: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 3 has type âuint32_t {aka unsigned int}â [-Wformat=]
sprintf_P(postval+strlen(postval), PSTR(“Flow count: %lu, volume: %d.%02d”), lval, (int)volume/100, (int)volume%100);
^
mqtt.cpp: In function âvoid _mqtt_connection_cb(mosquitto*, void*, int)â:
mqtt.cpp:314:131: error: invalid conversion from âconst char*â to âconst uint8_t* {aka const unsigned char*}â [-fpermissive]
int rc = mosquitto_publish(mqtt_client, NULL, MQTT_AVAILABILITY_TOPIC, strlen(MQTT_ONLINE_PAYLOAD), MQTT_ONLINE_PAYLOAD, 0, true);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:395:20: error: initializing argument 5 of âint mosquitto_publish(mosquitto*, uint16_t*, const char*, uint32_t, const uint8_t*, int, bool)â [-fpermissive]
libmosq_EXPORT int mosquitto_publish(struct mosquitto *mosq, uint16_t *mid, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
^
mqtt.cpp: In static member function âstatic int OSMqtt::_init()â:
mqtt.cpp:341:46: error: cannot convert âboolâ to âvoid*â for argument â2â to âmosquitto* mosquitto_new(const char*, void*)â
mqtt_client = mosquitto_new(“OS”, true, NULL);
^
mqtt.cpp:347:65: error: invalid conversion from âvoid (*)(mosquitto*, void*, int)â to âvoid (*)(void*, int)â [-fpermissive]
mosquitto_connect_callback_set(mqtt_client, _mqtt_connection_cb);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:618:21: error: initializing argument 2 of âvoid mosquitto_connect_callback_set(mosquitto*, void (*)(void*, int))â [-fpermissive]
libmosq_EXPORT void mosquitto_connect_callback_set(struct mosquitto *mosq, void (*on_connect)(void *, int));
^
mqtt.cpp:348:71: error: invalid conversion from âvoid (*)(mosquitto*, void*, int)â to âvoid (*)(void*)â [-fpermissive]
mosquitto_disconnect_callback_set(mqtt_client, _mqtt_disconnection_cb);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:634:21: error: initializing argument 2 of âvoid mosquitto_disconnect_callback_set(mosquitto*, void (*)(void*))â [-fpermissive]
libmosq_EXPORT void mosquitto_disconnect_callback_set(struct mosquitto *mosq, void (*on_disconnect)(void *));
^
mqtt.cpp:349:54: error: âmosquitto_log_callback_setâ was not declared in this scope
mosquitto_log_callback_set(mqtt_client, _mqtt_log_cb);
^
mqtt.cpp:350:118: error: invalid conversion from âsize_t {aka unsigned int}â to âconst char*â [-fpermissive]
mosquitto_will_set(mqtt_client, MQTT_AVAILABILITY_TOPIC, strlen(MQTT_OFFLINE_PAYLOAD), MQTT_OFFLINE_PAYLOAD, 0, true);
^
mqtt.cpp:350:118: error: invalid conversion from âconst char*â to âuint32_t {aka unsigned int}â [-fpermissive]
mqtt.cpp:350:118: error: too few arguments to function âint mosquitto_will_set(mosquitto*, bool, const char*, uint32_t, const uint8_t*, int, bool)â
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:268:20: note: declared here
libmosq_EXPORT int mosquitto_will_set(struct mosquitto *mosq, bool will, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
^
mqtt.cpp: In static member function âstatic int OSMqtt::_connect()â:
mqtt.cpp:364:66: error: too few arguments to function âint mosquitto_connect(mosquitto*, const char*, int, int, bool)â
rc = mosquitto_connect(mqtt_client, _host, _port, MQTT_KEEPALIVE);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:322:20: note: declared here
libmosq_EXPORT int mosquitto_connect(struct mosquitto *mosq, const char *host, int port, int keepalive, bool clean_session);
^
mqtt.cpp: In static member function âstatic int OSMqtt::_publish(const char*, const char*)â:
mqtt.cpp:385:89: error: invalid conversion from âconst char*â to âconst uint8_t* {aka const unsigned char*}â [-fpermissive]
int rc = mosquitto_publish(mqtt_client, NULL, topic, strlen(payload), payload, 0, false);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:395:20: error: initializing argument 5 of âint mosquitto_publish(mosquitto*, uint16_t*, const char*, uint32_t, const uint8_t*, int, bool)â [-fpermissive]
libmosq_EXPORT int mosquitto_publish(struct mosquitto *mosq, uint16_t *mid, const char *topic, uint32_t payloadlen, const uint8_t *payload, int qos, bool retain);
^
mqtt.cpp: In static member function âstatic int OSMqtt::_loop()â:
mqtt.cpp:394:42: error: too many arguments to function âint mosquitto_loop(mosquitto*, int)â
return mosquitto_loop(mqtt_client, 0 , 1);
^
In file included from mqtt.cpp:37:0:
/usr/include/mosquitto.h:503:20: note: declared here
libmosq_EXPORT int mosquitto_loop(struct mosquitto *mosq, int timeout);
^
mqtt.cpp: In static member function âstatic const char* OSMqtt::_state_string(int)â:
mqtt.cpp:398:33: error: âmosquitto_strerrorâ was not declared in this scope
return mosquitto_strerror(error);
^
Done!And so I am stuck again đ
noskiParticipantI have tried the instruction in the wiki and all the commands worked, but when I disconnected from the internet and rebooted, the time doesn’t get set properly.
ubuntu@arm:~$ date Fri Jul 17 21:58:17 EST 2015 ubuntu@arm:~$ sudo hwclock --rtc /dev/rtc1 -r [sudo] password for ubuntu: Sat 18 Jul 2015 08:05:48 PM EST -0.714392 seconds
Where do I see the output from the echo commands in /etc/rc.local to confirm what it is doing?
noskiParticipantThanks Ray. Just for clarification, for the relay, by slightly bigger you mean v1.0 is rated 120VAC/2A and v1.1 is rated 250VAC/3A?
noskiParticipantHi ray, is there any difference between v1.0 and v1.1 other than change in layout?
Openlab in Australia is still selling v1.0. Just want to know if I would be missing out on something new/important if I bought it?
noskiParticipantHi danico, I joined the forum so I could enquire about your setup as it sounds like something I want to do. Can you provide more details? Did you get it up and running?
Is your ‘storage battery’ 12v? Are you connecting it directly to your opensprinkler or are you converting it? What types of lights are you running?
noski. -
AuthorPosts