Esempio n. 1
0
 def test_alarm(self, entity, attribute, old, new, kwargs):
     if new != old:
         message = "Probealarm!"
         self.fire_event("custom_notify",
                         message=message,
                         target="telegram_jo")
         #            self.fire_event("custom_notify", message=message, target="telegram_ma")
         # alarm message via separate notify_when_status_matched app
         #            try:
         #                requests.get("http://192.168.178.42:2323/?cmd=textToSpeech&text=Probealarm&password=nopw", timeout=5)
         #            except:
         #            	pass
         fc = FritzCall(address=self.args["fritz_address"],
                        password=self.args["fritz_pw"])
         fc.dial(self.args["phone_jo_handy"])
Esempio n. 2
0
 def sicherung_hebeanlage_raus(self, entity, attribute, old, new, kwargs):
     if new != old:
         self.turn_off("switch.waschmaschine")
         message = "Sicherung Keller-Steckdosen (Hebeanlage!) rausgeflogen - habe die Waschmaschinen-Steckdose ausgeschalten!"
         self.fire_event("custom_notify",
                         message=message,
                         target="telegram_jo")
         self.fire_event("custom_notify",
                         message=message,
                         target="telegram_ma")
         # alarm message via separate notify_when_status_matched app
         try:
             requests.get(
                 "http://192.168.178.42:2323/?cmd=textToSpeech&text=Achtung%20Hebeanlage%20hat%20keinen%20Strom&password=nopw",
                 timeout=5)
         except:
             pass
         fc = FritzCall(address=self.args["fritz_address"],
                        password=self.args["fritz_pw"])
         fc.dial(self.args["phone_jo_handy"])
Esempio n. 3
0
 def wasser_boden_hebeanlage(self, entity, attribute, old, new, kwargs):
     if new != old:
         self.turn_off("switch.waschmaschine")
         message = "Wasser auf dem Boden bei der Hebeanlage - habe die Waschmaschinen-Steckdose ausgeschalten!"
         self.fire_event("custom_notify",
                         message=message,
                         target="telegram_jo")
         self.fire_event("custom_notify",
                         message=message,
                         target="telegram_ma")
         # alarm message via separate notify_when_status_matched app
         try:
             requests.get(
                 "http://192.168.178.42:2323/?cmd=textToSpeech&text=Alarm%20Wasser%20auf%20dem%20Boden%20bei%20der%20Hebeanlage&password=nopw",
                 timeout=5)
         except:
             pass
         fc = FritzCall(address=self.args["fritz_address"],
                        password=self.args["fritz_pw"])
         fc.dial(self.args["phone_jo_handy"])
Esempio n. 4
0
        print("Enter FritzBox password below:")
        passwd = getpass()
        keyring.set_password(
            service_name=keyring_id,
            username="******",
            password=passwd,
        )
        print("Password successfully saved to the system keyring.")

    args = dict(address="192.168.0.1", password=passwd)
    if connection_type == "default":
        return FritzConnection(**args)
    elif connection_type == "call":
        from fritzconnection.lib.fritzcall import FritzCall

        return FritzCall(**args)


def log2df(log):
    ldf = pd.DataFrame(
        re.findall(r"(\d\d\.\d\d.\d\d \d\d:\d\d:\d\d) (.*)", log),
        columns=["timestamp", "text"],
    )
    ldf["timestamp"] = pd.to_datetime(ldf["timestamp"], format="%d.%m.%y %H:%M:%S")

    ldf.loc[ldf["text"].str.contains("Training"), "event"] = "training"
    ldf.loc[
        ldf["text"].str.contains("Internetverbindung wurde erfolgreich hergestellt."),
        "event",
    ] = "internet connected"
    ldf.loc[
Esempio n. 5
0
fritzPassword = config['main']['password']
firstRun = 'firstrun' in config['main']
if firstRun:
    del config['main']['firstrun']
    config['main']['lastprocessed'] = '0'

debug = 'debug' in config['main'] and config['main']['debug'] == 'true'
if debug:
    print("phonetotiming.py running at " + str(datetime.datetime.now()))

lastprocessed = int(config['main']['lastprocessed'])
currentprocessed = lastprocessed
hadError = False

# connect to Fritz!Box
fCall = FritzCall(address=fritzAddress, password=fritzPassword)

# read call list
calls = fCall.get_calls()

for call in calls:
    callInfo = {}

    # process all calls with id after lastprocessed
    if debug:
        print("Call id ", call.id)
    if call.id <= lastprocessed:
        continue

    if debug:
        print("Found new Call with Id " + str(call.id))
Esempio n. 6
0
from collections import Counter
from time import sleep

from callinfo import CallInfo
from callprefix import CallPrefix
from fritzconn import FritzConn
from fritzconnection.lib.fritzcall import FritzCall
from phonebook import Phonebook

if __name__ == "__main__":
    # Quick example how to use only

    # Initialize by using parameters from config file
    fritzconn = FritzConn()

    fc = FritzCall(fc=fritzconn)
    cp = CallPrefix(fc=fritzconn)
    pb = Phonebook(fc=fritzconn)

    calls = fc.get_missed_calls(update=True)
    missed_list = []
    for call in calls:
        number = call.Called if call.type == 3 else call.Caller
        missed_list.append(number)
    counts = Counter(missed_list)
    print("\nMissed calls, ordered by count:")
    print(counts)

    calls = fc.get_calls(update=True)
    numbers = set()
    for call in calls: