init
This commit is contained in:
3
.idea/.gitignore
generated
vendored
Normal file
3
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
10
.idea/ShellyX.iml
generated
Normal file
10
.idea/ShellyX.iml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
||||||
4
.idea/misc.xml
generated
Normal file
4
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (ShellyX)" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
||||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/ShellyX.iml" filepath="$PROJECT_DIR$/.idea/ShellyX.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
142
HelloWorld.js
Normal file
142
HelloWorld.js
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
//GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007
|
||||||
|
//More information: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||||
|
//ABSOLUTELY NO WARRANTY!!!
|
||||||
|
//Made by Ostfriese
|
||||||
|
|
||||||
|
//############################## Config ############################
|
||||||
|
let Config = {
|
||||||
|
temp_diff: 2,
|
||||||
|
temp_min: 12,
|
||||||
|
id_inside: 100,
|
||||||
|
hum_target: 55,
|
||||||
|
interval: 10, // 2 seconds is the minimum interval
|
||||||
|
Tank_Sensor: 0, //Sensor Wasserstand
|
||||||
|
comp: 0, // Kompressor
|
||||||
|
FanH: 1, // Luefter Schnell
|
||||||
|
FanL: 2, // Luefter langsam
|
||||||
|
LedG: 3,
|
||||||
|
LedR: 4,
|
||||||
|
LedB: 5
|
||||||
|
}
|
||||||
|
//############################## Config end ############################
|
||||||
|
|
||||||
|
function LedsOff() {
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedR) + '?turn=on'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedG) + '?turn=on'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedB) + '?turn=on'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Gruen() {
|
||||||
|
LedsOff();
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedG) + '?turn=off'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Rot() {
|
||||||
|
LedsOff();
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedR) + '?turn=off'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function Blau() {
|
||||||
|
LedsOff();
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.LedB) + '?turn=off'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function allesAus() {
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.comp) + '?turn=off'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanH) + '?turn=off'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanL) + '?turn=off'
|
||||||
|
});
|
||||||
|
LedsOff();
|
||||||
|
}
|
||||||
|
|
||||||
|
function niedrigeStufe() {
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.comp) + '?turn=on'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanH) + '?turn=off'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanL) + '?turn=on'
|
||||||
|
});
|
||||||
|
Blau();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hoheStufe() {
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.comp) + '?turn=on'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanH) + '?turn=on'
|
||||||
|
});
|
||||||
|
Shelly.call("http.get", {
|
||||||
|
url: 'http://127.0.0.1/relay/' + JSON.stringify(Config.FanL) + '?turn=off'
|
||||||
|
});
|
||||||
|
Blau();
|
||||||
|
}
|
||||||
|
|
||||||
|
function watch() {
|
||||||
|
try {
|
||||||
|
temperature = Shelly.getComponentStatus('Temperature', Config.id_inside).tC;
|
||||||
|
humidity = Shelly.getComponentStatus('Humidity', Config.id_inside).rh;
|
||||||
|
tank = Shelly.getComponentStatus('Input', Config.Tank_Sensor).state;
|
||||||
|
//print('Temp. inside =',temp_inside);
|
||||||
|
print('Hum. Inside =', humidity);
|
||||||
|
print('tank= ', tank);
|
||||||
|
//inside <= minimum
|
||||||
|
if (humidity <= Config.hum_target) {
|
||||||
|
//allesAus();
|
||||||
|
Gruen();
|
||||||
|
print('Relay(', Config.comp, ') off. Inside hum <= ', Config.hum_target);
|
||||||
|
} else {
|
||||||
|
delta = humidity - Config.hum_target;
|
||||||
|
//delta more than or equal Config.temp_diff
|
||||||
|
//if (!tank && delta >= Config.temp_diff) {
|
||||||
|
//niedrigeStufe();
|
||||||
|
Blau();
|
||||||
|
// print('Relay(', Config.comp, ') on. Delta >= ', Config.hum_target);
|
||||||
|
}
|
||||||
|
//delta less than Config.temp_diff
|
||||||
|
//else {
|
||||||
|
//allesAus();
|
||||||
|
// Gruen();
|
||||||
|
// print('Relay(', Config.comp, ') off. Delta < ', Config.hum_target);
|
||||||
|
//}
|
||||||
|
//}
|
||||||
|
print('\n')
|
||||||
|
} catch (err) {
|
||||||
|
//allesAus();
|
||||||
|
//Rot();
|
||||||
|
print(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function start() {
|
||||||
|
LedsOff();
|
||||||
|
//allesAus();
|
||||||
|
// do a first shot
|
||||||
|
print('Starting....');
|
||||||
|
watch();
|
||||||
|
// set watch timer to configured value
|
||||||
|
Timer.set(Config.interval * 1000, true, watch);
|
||||||
|
}
|
||||||
|
|
||||||
|
// schedule script start for 1 second
|
||||||
|
Timer.set(1000, false, start);
|
||||||
16
main.py
Normal file
16
main.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# This is a sample Python script.
|
||||||
|
|
||||||
|
# Press ⌃R to execute it or replace it with your code.
|
||||||
|
# Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings.
|
||||||
|
|
||||||
|
|
||||||
|
def print_hi(name):
|
||||||
|
# Use a breakpoint in the code line below to debug your script.
|
||||||
|
print(f'Hi, {name}') # Press ⌘F8 to toggle the breakpoint.
|
||||||
|
|
||||||
|
|
||||||
|
# Press the green button in the gutter to run the script.
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print_hi('PyCharm')
|
||||||
|
|
||||||
|
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
|
||||||
Reference in New Issue
Block a user