Next week I’m going to make sausages and stuff again with Monique.
12.5 kg without the extra ingredients. Nice
Viking sausage, black puddin’ and more .
Recipes will follow
Code :
Notes: There is a problem with 4 line LCD using LiquidCrystal_I2C
Lines 3 and 4 will be shifted 4 characters to the right.
Workaround is: lcd.setCursor(-4, 2); // Go to column 0, row 3
#include <ESP8266WiFi.h> #include <PubSubClient.h> #include <WiFiClient.h> #include "SoftwareSerial.h" #include <Ethernet.h> #include <Arduino.h> #include <RotaryEncoder.h> #define wifi_ssid "MYSSID" #define wifi_password "MYSSIDPASS" #define mqtt_server "MQTTSERVER" #define mqtt_port 1883 WiFiClient espClient; EthernetClient ethClient; PubSubClient mqtt(espClient); #include <Wire.h> // Include Wire library (required for I2C devices) #include <LiquidCrystal_I2C.h> // Include LiquidCrystal_I2C library LiquidCrystal_I2C lcd(0x27, 16, 4); // Configure LiquidCrystal_I2C library with 0x27 address, 16 columns and 4 rows volatile bool flag = false; #define PIN_IN1 D7 #define PIN_IN2 D6 #define push D5 int temp = 0; RotaryEncoder *encoder = nullptr; #if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_NANO_EVERY) // This interrupt routine will be called on any change of one of the input signals void checkPosition() { encoder->tick(); // just call tick() to check the state. } #elif defined(ESP8266) /** * @brief The interrupt service routine will be called on any change of one of the input signals. */ IRAM_ATTR void checkPosition() { encoder->tick(); // just call tick() to check the state. } #endif void scrollText(int row, String message, int delayTime, int lcdColumns) { for (int i=0; i < lcdColumns; i++) { message = " " + message; } message = message + " "; for (int pos = 0; pos < message.length(); pos++) { lcd.setCursor(0, row); lcd.print(message.substring(pos, pos + lcdColumns)); delay(delayTime); } } void setup_wifi() { delay(10); WiFi.mode(WIFI_STA); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { delay(500); } } void setup() { setup_wifi(); mqtt.setServer(mqtt_server, mqtt_port); mqtt.setCallback(callback); Serial.begin(115200); Serial.println("initializing..."); WiFiClient espClient; PubSubClient mqtt(espClient); mqtt.setClient(espClient); mqtt.setServer(mqtt_server, 1883); mqtt.setCallback(callback); mqtt.subscribe("escape/display1/#"); lcd.init(); // Initialize I2C LCD module lcd.backlight(); // Turn backlight ON lcd.setCursor(0, 0); // Go to column 0, row 0 lcd.print("Init"); lcd.setCursor(0, 1); // Go to column 0, row 1 lcd.print("Display #1"); encoder = new RotaryEncoder(PIN_IN1, PIN_IN2, RotaryEncoder::LatchMode::TWO03); // register interrupt routine attachInterrupt(digitalPinToInterrupt(PIN_IN1), checkPosition, CHANGE); attachInterrupt(digitalPinToInterrupt(PIN_IN2), checkPosition, CHANGE); pinMode(push, INPUT_PULLUP); } void reconnect() { // Loop until we're reconnected while (!mqtt.connected()) { // Create a random client ID String clientId = "ESP8266Client-"; clientId += String(random(0xffff), HEX); // Attempt to connect if (mqtt.connect(clientId.c_str())) { // Once connected, publish an announcement... mqtt.publish("escape", "display1 connected"); // ... and resubscribe mqtt.subscribe("escape/display1/#"); } else { // Wait 5 seconds before retrying delay(5000); } } } void callback(char* topic, byte* payload, unsigned int length) { payload[length]= '\0'; char * charPointer = (char *)payload; String s=""; s =charPointer; s = s + " "; String topicStr = topic; if (topicStr == "escape/display1/clear"){ lcd.clear(); } if (topicStr == "escape/display1/1in"){ lcd.setCursor(0, 0); // Go to column 0, row 1 lcd.print(s.substring(0, 16)); } if (topicStr == "escape/display1/2in"){ lcd.setCursor(0, 1); // Go to column 0, row 2 lcd.print(s.substring(0, 16)); } if (topicStr == "escape/display1/3in"){ lcd.setCursor(-4, 2); // Go to column 0, row 3 lcd.print(s.substring(0, 16)); } if (topicStr == "escape/display1/4in"){ lcd.setCursor(-4, 3); // Go to column 0, row 4 lcd.print(s.substring(0, 16)); } } void loop() { if (!mqtt.connected()) { reconnect(); } mqtt.loop(); static int pos = 0; encoder->tick(); // just call tick() to check the state. int newPos = encoder->getPosition() / 2; if (pos != newPos) { String nr=""; Serial.print("pos:"); Serial.print(newPos); Serial.print(" dir:"); Serial.println((int)(encoder->getDirection())); pos = newPos; // hier nog iets mee doen // zonder setPos moet je eerst lang clockwise voordat weer gaat tellen // met setPos blijft 0 // if (pos < 0){ // pos = 0; // encoder->setPosition(0); // } nr = pos + " "; lcd.setCursor(10, 3); // Go to column 10, row 3 lcd.print(pos); lcd.print(" "); } temp = digitalRead(push); if (temp == LOW) { char msg_out[20]; sprintf(msg_out, "%d",pos); mqtt.publish("escape/display1/rotary", msg_out); } }
I’ve been playing tin whistles/low whistle for a long time, but I love flutes.
My first try on a Concert metal flute was in a bus with the “Eendracht” to germany. There is a photo but i’ve trashed stuff a long time ago.
A old girlfriend (Noelle) let me try it. Apparently I didn’t do it that badly.
Now 30 odd years later, I picked it up again. But now on the Irish Wooden flute.
We bought it 10+ years, and occasionally I pick it up and try to play some slow airs.
I love the sound of flutes. But I’m bad at lip embouchure.
The Irish Flute makes it even harder, there is no Lip plate.
We have some books, and Coline attended to the Flute lessons in Ireland.
Tunes i’ve been practicing on flute at this time:
(Some are Uilleann/ Low Whistle tunes I already know)
Having a large collection of tunes does not make it easy.
But having trouble myself to get all the octaves correct, I limit myself to certain tunes.
I’ll post some progress / examples at a later date.
Very interesting book and DVD!
Yes, we even tried beatboxing with the flute. (see below)
Some nice flute playing below:
And the best players (according to my opinion)
Sir James Galway
Matt Malloy
Michael McGoldrick
Jethro Tull
Séamus Tansey
Calum Stewart – I play one of his tunes on Uilleann
Paddy Carty
Robert Harvey
Flook stuff
Egyptian flutes are amazing : Lookup Erik the Flutemaker for more exceptional flutes.
Pan flutes from Peru and some asian bamboo flutes are amazing also
I’ve made a overtone flute a while ago, these ones doesn´t have holes.
I’ll post something about those soon.
The last example with overtone reminds me to post my findings about.
(Mongolian) throatsinging, overtone flutes and Altai playing.
(look it up .. amazing, We’ve been to a Hanggai concert)
But i’m drifting away from flutes and the topic in general.
Above McGoldrick with some Fred Morrison tunes i also play.
I’ve got the DFPlayer with the GD3200B instead of the better YX5200, but it works.
As part of my game, so MQTT controlled.
Code
I’m using Soft Serial
// based on code from: // https://github.com/Makuna/DFMiniMp3/blob/master/examples/PlayMp3/PlayMp3.ino // above example has no wifi/mqtt and is missing the SoftSerial include line #include <ESP8266WiFi.h> #include <PubSubClient.h> #include <WiFiClient.h> #include <DFMiniMp3.h> #include "SoftwareSerial.h" #include <Ethernet.h> #define wifi_ssid "SSID" #define wifi_password "SSIDPASS" #define mqtt_server "MQTTSERVER" #define mqtt_port 1883 WiFiClient espClient; EthernetClient ethClient; PubSubClient mqtt(espClient); class Mp3Notify; SoftwareSerial secondarySerial(D6, D5); // RX, TX typedef DFMiniMp3<SoftwareSerial, Mp3Notify> DfMp3; DfMp3 dfmp3(secondarySerial); class Mp3Notify { public: static void PrintlnSourceAction(DfMp3_PlaySources source, const char* action) { if (source & DfMp3_PlaySources_Sd) { Serial.print("SD Card, "); } if (source & DfMp3_PlaySources_Usb) { Serial.print("USB Disk, "); } if (source & DfMp3_PlaySources_Flash) { Serial.print("Flash, "); } Serial.println(action); } static void OnError([[maybe_unused]] DfMp3& mp3, uint16_t errorCode) { // see DfMp3_Error for code meaning Serial.println(); Serial.print("Com Error "); Serial.println(errorCode); } static void OnPlayFinished([[maybe_unused]] DfMp3& mp3, [[maybe_unused]] DfMp3_PlaySources source, uint16_t track) { Serial.print("Play finished for #"); Serial.println(track); // start next track track += 1; // this example will just start back over with 1 after track 3 if (track > 3) { track = 1; } dfmp3.playMp3FolderTrack(track); // sd:/mp3/0001.mp3, sd:/mp3/0002.mp3, sd:/mp3/0003.mp3 } static void OnPlaySourceOnline([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source) { PrintlnSourceAction(source, "online"); } static void OnPlaySourceInserted([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source) { PrintlnSourceAction(source, "inserted"); } static void OnPlaySourceRemoved([[maybe_unused]] DfMp3& mp3, DfMp3_PlaySources source) { PrintlnSourceAction(source, "removed"); } }; void setup_wifi() { delay(10); WiFi.mode(WIFI_STA); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { delay(500); } } void setup() { setup_wifi(); mqtt.setServer(mqtt_server, mqtt_port); mqtt.setCallback(callback); Serial.begin(115200); Serial.println("initializing..."); WiFiClient espClient; PubSubClient mqtt(espClient); mqtt.setClient(espClient); mqtt.setServer(mqtt_server, 1883); mqtt.setCallback(callback); mqtt.subscribe("escape/soundin"); dfmp3.begin(); uint16_t volume = dfmp3.getVolume(); Serial.print("volume "); Serial.println(volume); dfmp3.setVolume(24); uint16_t count = dfmp3.getTotalTrackCount(DfMp3_PlaySource_Sd); Serial.print("files "); Serial.println(count); Serial.println("starting..."); // start the first track playing // dfmp3.playMp3FolderTrack(1); // sd:/mp3/0001.mp3 } void reconnect() { // Loop until we're reconnected while (!mqtt.connected()) { // Create a random client ID String clientId = "ESP8266Client-"; clientId += String(random(0xffff), HEX); // Attempt to connect if (mqtt.connect(clientId.c_str())) { // Once connected, publish an announcement... mqtt.publish("escape", "sound connected"); // ... and resubscribe mqtt.subscribe("escape/soundin"); } else { // Wait 5 seconds before retrying delay(5000); } } } void callback(char* topic, byte* payload, unsigned int length) { // digitalWrite(led, HIGH); String topicStr = topic; byte value = atoi((char*)payload); dfmp3.playMp3FolderTrack(value); // sd:/mp3/0001.mp3 Serial.println(value); } void waitMilliseconds(uint16_t msWait) { uint32_t start = millis(); while ((millis() - start) < msWait) { dfmp3.loop(); delay(1); } } void loop() { if (!mqtt.connected()) { reconnect(); } mqtt.loop(); waitMilliseconds(100); }
Warning, read the notes!
There are several caveats.
To use RX/TX as GPIO pins you need to do the following:
//Define pins int led = 1; //tx int col = 3; //rx // Change to function mode 3 // see https://www.esp8266.com/wiki/doku.php?id=esp8266_gpio_pin_allocations pinMode(1, FUNCTION_3); pinMode(3, FUNCTION_3); // Revert to normal mode // pinMode(1, FUNCTION0); // Define mode input/output // i'm using led to control the led so thats an output // I'm using col for the keypad column scanner, that's an input pinMode(led, OUTPUT); pinMode(col, INPUT);
Complete code
The (*) clears input
The (#) sends the pin code using MQTT
Sending a 0 or 1 to escape/keypadin topic will toggle the led
#include <ESP8266WiFi.h> #include <PubSubClient.h> #include <WiFiClient.h> // Do not change order! #include "Keypad.h" #include <TM1637Display.h> #include <Ethernet.h> #define wifi_ssid "SSID" #define wifi_password "SSIDPASS" #define mqtt_server "MQTTSERVER" #define mqtt_port 1883 #define MSG_BUFFER_SIZE (50) char msg[MSG_BUFFER_SIZE]; int value = 0; const byte ROWS = 4; //four rows const byte COLS = 3; //four columns int led = 1; //tx int col = 3; //rx #define CLK D1 #define DIO D2 #define TEST_DELAY 2000 TM1637Display display(CLK, DIO); char keys[ROWS][COLS] = { {'1', '2', '3'}, {'4', '5', '6'}, {'7', '8', '9'}, {'*', '0', '#'} }; byte rowPins[ROWS] = {D3, D5 , D6 , D7 }; byte colPins[COLS] = {D4 , col, D8 }; Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS); int keyNum = 0; WiFiClient espClient; EthernetClient ethClient; PubSubClient mqtt(espClient); void setup_wifi() { delay(10); WiFi.mode(WIFI_STA); WiFi.begin(wifi_ssid, wifi_password); while (WiFi.status() != WL_CONNECTED) { delay(500); } } void setup() { setup_wifi(); mqtt.setServer(mqtt_server, mqtt_port); mqtt.setCallback(callback); pinMode(1, FUNCTION_3); pinMode(3, FUNCTION_3); pinMode(led, OUTPUT); pinMode(col, INPUT); // using above? .. then disable serial! // Serial.begin(9600); display.showNumberDec(0, true); delay(TEST_DELAY); WiFiClient espClient; PubSubClient mqtt(espClient); mqtt.setClient(espClient); mqtt.setServer(mqtt_server, 1883); mqtt.setCallback(callback); mqtt.subscribe("escape/keypadin"); } void callback(char* topic, byte* payload, unsigned int length) { // digitalWrite(led, HIGH); String topicStr = topic; byte value = atoi((char*)payload); if (value == 1){ digitalWrite(led, HIGH); }else if (value == 0){ digitalWrite(led, LOW); } } void reconnect() { while (!mqtt.connected()) { // Create a random client ID String clientId = "ESP8266Client-"; clientId += String(random(0xffff), HEX); if (mqtt.connect(clientId.c_str())) { mqtt.publish("outTopic", "hello world"); mqtt.subscribe("escape/keypadin"); } else { delay(5000); } } } void loop() { if (!mqtt.connected()) { reconnect(); } mqtt.loop(); // put your main code here, to run repeatedly: char key = keypad.getKey(); if (key) { if(key=='*'){ keyNum = 0; } else if (key=='#'){ ++value; snprintf (msg, MSG_BUFFER_SIZE, "#%1d", keyNum); mqtt.publish("escape/keypad", msg); } else{ if(keyNum<=999){ keyNum = (keyNum*10) + (int(key)-48); } } // Serial.println(key); display.setBrightness(0x0f); uint8_t data[] = { 0x0, 0x0, 0x0, 0x0 }; display.setSegments(data); display.setSegments(data); display.showNumberDec(keyNum); } }
A friend needed to scrape data from an authenticated website.
This needs to be scripted and processed without human intervention.
Following steps are needed to get the correct curl commands (one time only)
next steps
save curl command in a file
remove –compresssion and -H ‘Cookie: JSESSIONID=?????????????????????????????’
add just after curl
-k (no certificate check) and
–cookie-jar tmpcookiefile
excecute this. It will give you a file with a session id and a true field.
(This will change at every login)
but is needed for subsequential requests
Next: use this sessioncookie to get the next authenticated request
So to scrape with login, you need two lines in your script.
One to get the session cookie. (YOUR username/pass will be in here!!)
And the second to get the needed page using the cookie
#!/bin/bash
#authenticate and save sessioncookie
curl -k --cookie-jar part1.cookie 'https://xxx.xxxxx.xxx/site/dologin' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' -H 'Accept-Language: en-GB,en;q=0.9,nl-NL;q=0.8,nl;q=0.7' -H 'Cache-Control: max-age=0' -H 'Connection: keep-alive' -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryb1chvkAVZSF3hPSu' -H 'Origin: https://xxx.xxxxx.xxx' -H 'Referer: https://xxx.xxxxx.xxx/site/loginform' -H 'Sec-Fetch-Dest: document' -H 'Sec-Fetch-Mode: navigate' -H 'Sec-Fetch-Site: same-origin' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36' -H 'sec-ch-ua: "Chromium";v="110", "Not A(Brand";v="24", "Google Chrome";v="110"' -H 'sec-ch-ua-mobile: ?0' -H 'sec-ch-ua-platform: "Windows"' --data-raw $'------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[username]"\r\n\r\nusername\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[password]"\r\n\r\npassword\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[refname]"\r\n\r\n\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[refid]"\r\n\r\n\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[refmod]"\r\n\r\n\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu\r\nContent-Disposition: form-data; name="form[csrf_hash]"\r\n\r\ncsrf_ab09f7887d9dacfe1489b68b64fe6a01\r\n------WebKitFormBoundaryb1chvkAVZSF3hPSu--\r\n'
#get data from second page
curl -k -l --cookie part1.cookie https://xxx.xxxxx.xxx/subscriber/overview
A friend of mine remembered me of the Mikrotik addons in HA.
I forgot all about this.
I’ve got two integrations running. (Installed via HACS)
Don´t forget to enable the API on your devices.
/ip services set api disabled=no port=8728
The addons/integrations extract a lot of information from the MT devices.
This integration will also let you know that your MT Router can be updated.
This is part if the presence detector/Device locator.
My roaming wifi network will give false locations. My laptop never left the same spot!
I will add to this page, after testing for a while
I stopped www.pipetunesearch.org in 2022. See below link for more info
But i’m getting emails and forum mentions, that people are missing this site ..
So .. it’s back
Today i’ve migrated my DNS/DHCP to a Mikrotik router.
See post
I’m planning to replace my main firewall/dhcp/dns/web/irc/mail/ids whatever more .. to virtual machines and a mikrotik router.
Having used bind and isc-dhcp-server for many years, i had to try some alternatives.
And now DNS/DHCP in a Mikrotik router!
I still use Phpipam as cmdb.
So i’m planning to use ansible to synchronize phpipam and the mikrotik.
Nice .. no seach domain needed …
nslookup webserver, resolves webserver.dmz
If there are 2 hosts with the same hostname, you have to add a domain.