
https://henrikhjelm.se/api/posten/
Tänkte köra en beta testing av denna api…
maila mig om du använder den och om du stöter på några problem eller om den funkar som du har tänk dig.

för att ansluta till olika enheter
https://mobaxterm.mobatek.net/

för att ansluta till olika enheter
https://www.raidrive.com/
[Verse]
Henrik’s the name
Coding’s my game
Teaching algorithms
Textbooks are my fame
From morning till night
Never taking a break
Putting bugs to sleep
No time for mistake
Late nights in the lab
Lines of codeI tackle
Debugging and testing
Never skipping a shackle
Stacking functions like bricks
to build a masterpiece
In my programming kingdom
I’m the high priest
[Verse 2]
Students looking tired
Minds filled with doubt
Losing motivation
Feeling left out
But I’m here to uplift
Lift the spirits high
Turning zeros to heroes
That’s my battle cry
https://suno.com/song/6038be8e-1dcf-4af1-9a52-190f3f1b28fd

convert movie format to mp4 ?
this code are scanning for example mkv and convert all to mp4
#!/bin/bash
# Help message function
print_help() {
echo "Usage: $0 <file_extension>"
echo "Example: $0 mkv"
}
# Check if argument is provided
if [ $# -eq 0 ]; then
print_help
exit 1
fi
# Supported video file formats
supported_formats=("avi" "mkv" "mov" "mp4" "wmv" "flv" "mpg" "mpeg" "3gp")
# Check if provided file extension is supported
if [[ ! " ${supported_formats[@]} " =~ " $1 " ]]; then
echo "Unsupported file format. Supported formats: ${supported_formats[*]}"
print_help
exit 1
fi
# Loop through all files with the provided extension in the current directory
for file in *."$1"; do
# Check if the file exists
if [ -e "$file" ]; then
# Get the filename without extension
filename="${file%.*}"
# Convert the file to mp4 using ffmpeg
ffmpeg -i "$file" "${filename}2.mp4"
# Optional: Check if conversion was successful and remove the original file
if [ $? -eq 0 ]; then
echo "Conversion of $file successful."
rm "$file"
else
echo "Conversion of $file failed."
fi
else
echo "No files with .$1 extension found."
exit 1
fi
done
why not.. we do it in php to… but now you most write a dir to.
<?php
// Function to convert video files to mp4
function convertVideosToMp4($folder, $extension) {
// Supported video file formats
$supportedFormats = ["avi", "mkv", "mov", "mp4", "wmv", "flv", "mpg", "mpeg", "3gp"];
// Check if provided file extension is supported
if (!in_array($extension, $supportedFormats)) {
echo "Unsupported file format. Supported formats: " . implode(", ", $supportedFormats) . PHP_EOL;
return;
}
// Open the directory
if ($handle = opendir($folder)) {
// Loop through all files in the directory
while (false !== ($file = readdir($handle))) {
// Check if the file has the provided extension
if (pathinfo($file, PATHINFO_EXTENSION) == $extension) {
// Get the filename without extension
$filename = pathinfo($file, PATHINFO_FILENAME);
// Convert the file to mp4 using ffmpeg and rename to {filename}2.mp4
$command = "ffmpeg -i \"$folder/$file\" \"$folder/{$filename}2.mp4\"";
exec($command, $output, $return_var);
// Check if conversion was successful and remove the original file
if ($return_var == 0) {
echo "Conversion of $file successful." . PHP_EOL;
unlink("$folder/$file");
} else {
echo "Conversion of $file failed." . PHP_EOL;
}
}
}
// Close the directory handle
closedir($handle);
} else {
echo "Unable to open directory: $folder" . PHP_EOL;
}
}
// Check if folder and extension are provided
if ($argc < 3) {
echo "Usage: php convert.php <folder_path> <file_extension>" . PHP_EOL;
echo "Example: php convert.php /path/to/folder mkv" . PHP_EOL;
exit(1);
}
// Get folder path and extension from command line arguments
$folderPath = $argv[1];
$extension = $argv[2];
// Call function to convert videos to mp4
convertVideosToMp4($folderPath, $extension);
?>
why not… we do it in python to
import os
import subprocess
import sys
def convert_videos_to_mp4(folder, extension):
# Supported video file formats
supported_formats = ["avi", "mkv", "mov", "mp4", "wmv", "flv", "mpg", "mpeg", "3gp"]
# Check if provided file extension is supported
if extension not in supported_formats:
print(f"Unsupported file format. Supported formats: {', '.join(supported_formats)}")
return
# Loop through all files in the folder
for file in os.listdir(folder):
# Check if the file has the provided extension
if file.endswith(f".{extension}"):
# Get the filename without extension
filename = os.path.splitext(file)[0]
# Convert the file to mp4 using ffmpeg and rename to {filename}2.mp4
command = f"ffmpeg -i \"{os.path.join(folder, file)}\" \"{os.path.join(folder, filename)}2.mp4\""
subprocess.run(command, shell=True)
# Check if conversion was successful and remove the original file
if os.path.exists(os.path.join(folder, f"{filename}2.mp4")):
print(f"Conversion of {file} successful.")
os.remove(os.path.join(folder, file))
else:
print(f"Conversion of {file} failed.")
# Check if folder and extension are provided
if len(sys.argv) < 3:
print("Usage: python convert.py <folder_path> <file_extension>")
print("Example: python convert.py /path/to/folder mkv")
sys.exit(1)
# Get folder path and extension from command line arguments
folder_path = sys.argv[1]
extension = sys.argv[2]
# Call function to convert videos to mp4
convert_videos_to_mp4(folder_path, extension)

Gå till https://henrikhjelm.se/api/vagar.php för att få en översikt över API:et och eventuellt se om det finns något användbart formulär.
En exempel-URL för att hämta vägdata för en given plats och radie ser ut så här:
https://henrikhjelm.se/api/vagar.php?lat=62.3908&long=17.3069&radius=200
API:et kommer att returnera vägdata i JSON-format. Här är ett exempel på hur svaret kan se ut:
{
"road": [
{
"id": 9181805,
"priority": 3,
"createddate": "2024-01-15 17:53:18",
"title": "Lv 623 Håkanstaleden",
"exactlocation": "Håkansta–Norderön",
"description": "Färjan är ur trafik från tisdag 2/1 kl 09:00 på grund av rådande isläge. Isvägen mellan Sunne och Vällviken ersätter färjan.",
"latitude": 63.136474609375,
"longitude": 14.32264518737793,
"category": 0,
"subcategory": "Färja"
},
{
"id": 9301925,
"priority": 3,
"createddate": "2024-01-15 23:42:31",
"title": "Lv 586 Vällviken–Sunne",
"exactlocation": "",
"description": "Isvägen mellan Vällviken och Sunne är öppen för fordon upp till två ton.",
"latitude": 63.09188461303711,
"longitude": 14.383475303649902,
"category": 1,
"subcategory": "Färja"
}
]
}

problemet med denna enhet är att den klarar bara av en stream åt gången.
rtsp://192.168.4.71:554/live/profile.0/video
användare : admin
lösenordet står under produkten. 6 st siffror.
min lösning.
motioneye får ta kamera streamen.
sätta om en video stream av kameran.
alla ansluter till motioneye streamen



Bilden är tagen från https://www.youtube.com/watch?v=FeTrI_kogXs
Har några elever som kollar på denna sida då och då. och dom behöver inte veta hur min lägenhet ser ut.
men dom kan ju få veta och ni vart jag har mina lampor och övrigt…
type: picture-elements
elements:
- type: state-icon
icon: mdi:lightbulb
entity: light.qnect_smart_filament_sh_lfe27g125_qne
style:
top: 38%
left: 25.0%
transform: scale(1.5,1.5)
tap_action:
action: toggle
- type: state-icon
icon: mdi:lightbulb
entity: light.henke_dimmable_light_2
style:
top: 27%
left: 14%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-icon
icon: mdi:lightbulb
entity: light.henke_dimmable_light_1
style:
top: 19%
left: 65%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-icon
icon: mdi:lightbulb
entity: light.henke_dimmable_light_4
style:
top: 5%
left: 37%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-icon
icon: mdi:lightbulb
entity: light.smart_lampa
style:
top: 14%
left: 37%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-icon
icon: mdi:lightbulb
entity: light.qnect_smart_filament_sh_lfe27g125_qne_2
style:
top: 60%
left: 60%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-label
entity: sensor.henke_living_room_temperature
style:
top: 52%
left: 25%
transform: scale(2,2)
color: black
- type: custom:simple-clock-card
entity: sensor.henke_living_room_temperature
use_military: false
hide_seconds: true
style:
top: 57%
left: 0%
transform: scale(0.8,0.8)
- type: icon
entity: switch.henke_flakt
icon: mdi:fan
style:
top: 7%
left: 57%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
- type: state-label
entity: sensor.tradfriauto_5
style:
top: 65%
left: 25%
transform: scale(2,2)
color: black
- type: icon
entity: switch.sh_p01_qne_smart_plug_2_socket
icon: mdi:remote-tv
style:
top: 70%
left: 50%
transform: scale(1.5,1.5)
color: black
tap_action:
action: toggle
image: /local/map.png


För lätt installerad el mätare. jag antog att det skulle ta 1-2 timmar att fixa och jävlas.
men denna produkt är väldigt lätt att installera och få in i homeassistant.
Svåraste är att koppla in rj12 kabeln i mätaren.
Jag kontaktade skaparen på facebook och köpte den av han där.
https://github.com/remne/p1ib

