Skip to content

Instantly share code, notes, and snippets.

@overas
overas / temperatur_til_fil.py
Created August 29, 2023 13:58
Microbit måler temperatur og skriver data til en fil
from microbit import *
import time
display.show(Image.HAPPY)
while True:
if button_a.is_pressed():
temperatureValues = open("temperatur.txt", "w")
temperatureValues.write("Minutter" + "," + "Temperatur" + "\n")
break
{
"hass_url": "empty",
"long_lived_token": "empty",
"costfun": "profit",
"optimization_time_step": 60,
"historic_days_to_retrieve": 2,
"method_ts_round": "nearest",
"set_total_pv_sell": false,
"lp_solver": "COIN_CMD",
"lp_solver_path": "/usr/bin/cbc",
#sudo service airiana start
Apr 7 18:44:44 localhost systemd[1]: Started Airiana Core executive.
Apr 7 18:44:44 localhost airiana-core.py: file is /home/pi/Airiana/airiana-core.py
Apr 7 18:44:44 localhost airiana-core.py: changing to /home/pi/Airiana/
Apr 7 18:44:44 localhost python3[1305]: cp: cannot create regular file './RAM/data.log': Permission denied
Apr 7 18:44:44 localhost python3[1308]: touch: cannot touch './RAM/forecast.txt': Permission denied
Apr 7 18:44:44 localhost python3[1293]: Traceback (most recent call last):
Apr 7 18:44:44 localhost python3[1293]: File "/home/pi/Airiana/airiana-core.py", line 78, in <module>
Apr 7 18:44:44 localhost python3[1293]: ferr = os.open("./RAM/err", os.O_WRONLY | os.O_CREAT)
pi@airiana:~/Airiana-python3-migration $ sudo service airiana status
● airiana.service - Airiana Core executive
Loaded: loaded (/etc/systemd/system/airiana.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2022-02-18 09:26:21 CET; 1s ago
Process: 1071 ExecStart=/usr/bin/python3 /home/pi/airiana/airiana-core.py daemon ping humidity TCP (code=exited, status=2)
Main PID: 1071 (code=exited, status=2)
CPU: 118ms
Feb 18 09:26:21 airiana systemd[1]: airiana.service: Scheduled restart job, restart counter is at 5.
Feb 18 09:26:21 airiana systemd[1]: Stopped Airiana Core executive.
pi@airiana:~/Airiana-python3-migration $ ./restart
● airiana.service - Airiana Core executive
Loaded: loaded (/etc/systemd/system/airiana.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Fri 2022-02-18 09:42:03 CET; 39ms ago
Process: 1170 ExecStart=/usr/bin/python3 /home/pi/airiana/airiana-core.py daemon ping humidity TCP (code=exited, status=2)
Main PID: 1170 (code=exited, status=2)
CPU: 80ms
sh: 1: disown: not found
pi@airiana:~/Airiana-python3-migration $
pi@raspberrypi:~/Airiana-python3-migration $ sudo python ./install.py
Installing the AirianaCores
Hit:1 http://archive.raspberrypi.org/debian bullseye InRelease
Hit:2 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
javascript-common libexpat1-dev libjs-jquery libjs-sphinxdoc libjs-underscore libpython3-dev libpython3.9-dev python-pip-whl python3-dev python3-distutils
# Enkel kode til skritteller
from microbit import *
steps = 0 # Antall steg nullstilles
while True: # En løkke som kjører til den blir avbrutt
if (
accelerometer.current_gesture() == "shake"
# Write your code here :-)
# Radiosender til å sette i Faradaybur
from microbit import *
import radio
radio.on() # Radio skrus på
radio.config(
channel=42, power=7
# Write your code here :-)
# Radiomottaker til å ha utenfor Faradaybur
from microbit import *
import radio
radio.on() # Radio skrus på
radio.config(channel=42) # Radiokanal settes til kanal 42
while True: # Løkke som kjører til den blir avbrutt
2021-11-26 19:05:10 WARNING (Recorder) [homeassistant.components.sensor.recorder] Entity sensor.accumulated_consumption_toraldasen_32 from integration tibber has state class total_increasing, but its state is not strictly increasing. Triggered by state 48.327086 with last_updated set to 2021-11-26T18:00:29.482433+00:00. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue+label%3A%22integration%3A+tibber%22