This never got added to the wiki, Im sure someone would find it useful
Posts made by Sawyer McBride
-
RE: Sending Telegram messages via bots!
-
RE: OLED console
i think he means the terminal console, sounds like a good idea, you could use this with a kb plugged in....would be hard to code on it though XD
-
RE: IFTTT?
I've recently been looking at different ways of using my Omega and Pi's.
I've come across Cayenne which uses an agent on a Pi to control it, similar to Onion Cloud without as much granularity.
Also Initial State which looks pretty cool, its a way of recording data from sensors primarily but you can store other datapoints too. So a temp sensor or humidiy sensor, you can stream values to a REST API. Looks promising although there is a free and paid model, the free level could be limiting.
-
RE: Serial?
@Lazar-Demin ahhh ok, without a full dock with breakout then if you had something like a breadboard with power, you could power the omega, leaving the serial pins free?
-
RE: Serial?
Is there a reason you cant use the builtin Serial interface?
Download the driver and use PuTTY defaults with a speed of 115200.
https://wiki.onion.io/Tutorials/Connecting-to-Omega-via-Serial-Terminal
-
RE: Using Onion to open my apartment gate
It seems the easy part of this is the actual opening of the gate. A simple bash or python script can run the appropriate commands to send a signal to open a relay/GPIO pin.
The hard part seems to be the connection between phone (as you want to be mobile!) and the onion.
A couple of ways I can think of:
- 1: Use Telegram - It is a messaging app but you can use it to send commands to a device. The device polls Telegram through an API and if a specific command is sent then you can tell it to do something. ie, run a script that opens a gate!
- 2: Use IFTTT maker channel - Its a simple cloud based automation tool. So you can either have an IF This Then That, so if your phone gets to this GPS co-ord then open the gate. Or better would be the DO function of IFTTT which you launch the app and it has specific buttons which you can set, ie button to open gate, button to close. In the background, again the device will need a webhook to poll the API of IFTTT looking for the DO button presses.
Each method relies on polling the API of the service, IFTTT DO function would work better as the command structure of Telegram would mean you'd have to a send a command (ie
/opengate
) whereas the DO presents a nice button on an app you press.As each method relies on polling an API and you'd want it to be fast I reckon you'd want something like poll every second. I dont know if this is possible because I've not used it before!
IFTTT: https://ifttt.com/maker
Telegram: https://core.telegram.org/apiI did make a post on how to use Telegram for notifications, so you can use this to setup your bots which seems a bit odd at first. https://community.onion.io/topic/499/sending-telegram-messages-via-bots/1
-
Sending Telegram messages via bots!
Telegram is a messaging platform similar to Whatsapp, but you can create bots and use an API to send messages from devices to yourself.
I have been experimenting with using Telegram bots to send notifications and alerts instead of emails.
I thought I'd try it out on the Onion and see what happens! You can also send commands through the bot too although I havnt ventured down that path ie. send a "/lighton" command and the omega switches a specific GPIO pin to 1 to turn a light on.
You should be able to follow the sequence below to get started:
-
Browse to https://telegram.org and create an account OR download the app on your iDevice or similar and create an account that way. If you have created an account on your device you can login to a web session on the telegram website to send messages via your browser also.
-
You must get your unique CHATID for your user. Send
/getid
to @IDBot, it needs to be this specific command to get the answer. This will give you your CHATID which we will use later. -
Next create a bot! Send
/help
to @BotFather, next to create a bot send/newbot
. The BotFather will then ask a couple of questions, first a Name that is just a label and then the username for the bot which must end in Bot. He will send you the API token which again you must keep, although you can ask him to generate another by using the/token
message. You should notice there are a load of commands you can ask of the BotFather, I mainly use the/setuserpic
which you can use to change the bots avatar! -
Next is to install curl which is used to create the HTTP requests, in this case a POST.
opkg update opkg upgrade opkg install curl
- Once curl is installed we can start sending messages! Copy pasta the following to setup the script file:
cd /root touch telegram.sh chmod 775 telegram.sh
- Open the file using your favourite text editor (I enjoy VI as it is on version of linux!) Copy the below text to create a script file that is used to send a message:
#!/bin/sh # # This script sends whatever is piped to it as a message to the specified Telegram bot # message=$( cat ) apiToken=<PLACE API TOKEN HERE> # example: # apiToken=123456789:AbCdEfgijk1LmPQRSTu234v5Wx-yZA67BCD userChatId=<PLACE CHATID HERE> # example: # userChatId=123456789 sendTelegram() { curl -s \ -X POST \ https://api.telegram.org/bot$apiToken/sendMessage \ -d text="$message" \ -d chat_id=$userChatId } if [[ -z "$message" ]]; then echo "Please pipe a message to me!" else sendTelegram fi
- Once the script is setup and you have modified it to have your CHATID and bot API token then use it!
echo "Test: Onion Omega FTW!!" | ./telegram.sh
You should get back a return of a valid message from the console and on whatever platform you have Telgram installed on!
One problem I have found is the pipe validation. Within bash it echos a response if nothing is piped. The same bit of code doesnt seem to work for busybox. If anyone has got a better way of doing it let me know!
Hopefully this will get some people thinking of some better ways of notifying people of events!
Hopefully @Boken-Lin will get it added to the Wiki if it is worthy!
-
-
RE: Squeezebox Player
@fader I did see that the Omega kernel doesnt have the feature enabled for kmod-usb-audio and also another audio related feature. I did try to custom build the kernel but bricked my omega, havn't had time to try again since doing a firmware recovery. It is defo still on my to-do list. @Boken-Lin did say in another thread that they might do a few different releases with differing kernels. If they do, hopefully they'll do one with the USB audio stuff! Until then next time I have some free time I'll try and custom build a firmware again! It's just a pain for me as to do a firmware recovery I have to jam wires into the minidock as my proper dock hasnt turned up yet (Battery dock has been delayed).
-
RE: Squeezebox Player
@Ross-Pratt I am planning on using the same audio card I believe, a small white one? about Ā£2.50 on ebay? I think it would be a very do-able project that would work well as long as we can get it to recognise the card!
-
RE: i2c device not visible by i2cdetect
@Kit-Bishop That is my understanding aswell, the Omega is already drawing around 200mA of current. So in effect he is trying to put the sensor in parallel with the Omega, power-wise.
If the OP has a breadboard PSU use that for the power otherwise use the Vout shown in the diagram.
-
RE: Controlling WS2812 device (RGB LED strip)
@Boken-Lin Now this im interested in! My wife has been looking at LED door weaths but I said I wanted to make one, possibly with an Arduino....but why not the omega! Get it in a "production" environment
-
RE: De-Brick help
@Boken-Lin Haha, it pretty much was! The patient is doing well!
-
RE: Controlling WS2812 device (RGB LED strip)
Was going to have a look at neopixels, have used the library mentioned to power a few neopixels from a RasPi for a project. In my project I had a powered hub so just took a 5v USB feed for the power.
-
RE: De-Brick help
Following is the correct pins for anyone hitting a similar problem:
-
RE: De-Brick help
@Boken-Lin No need dude
So I used the following image, I thought I already knew this, or had seen it somewhere!
Just hooked up the 2Vout and GND pins to the pins on the module and sorted, ethernet port came up on the switch, changed my IP on my PC (as was easier) and uploaded the image!
Final wiring looked like the following:
PS. Hope you like my twisted pairs
Time to upgrade!!! -
RE: Another odd Omega not booting problem
Was going to say make sure your host firewall is turned off on windows as that is generally the biggest problem when hosting stuff on a windows desktop! (Windows firewall normally, obviously turn it back on after, alternitively create a rule to allow ping and tftp through)
-
RE: De-Brick help
@Boken-Lin Excellent stuff, thought that it might need some power somewhere along the way!
Any idea what pins on the ethernet module?