Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wakeup SetAlarm Cannot Set Multiple Days #1069

Open
quitmeyer opened this issue Mar 13, 2024 · 0 comments
Open

Wakeup SetAlarm Cannot Set Multiple Days #1069

quitmeyer opened this issue Mar 13, 2024 · 0 comments

Comments

@quitmeyer
Copy link

Hi, I have a pijuice on a pi4 and discovered that it seems to be impossible to set the "day"

I have noted this in the comments of a couple other posts, but figured it should be a standalone issue
#489

i noticed that you can set multiple minutes or hours by specifying them with a semicolon (like 3;4;8)
but if you try to set day: 3;4;8 it throws an invalid error. You can however specify multiple weekdays

The root of this problem seems that it is actually just in the source code.
` if 'weekday' in alarm:
try:
day = alarm['weekday']
if day == 'EVERY_DAY':
d[3] = 0x80 | 0x40

            elif isinstance(day, str) and day.find(';') < 0:
                dw = int(day)
                d[3] = d[3] | (dw & 0x0F) | 0x40

            elif isinstance(day, int):
                dw = int(day)
                d[3] = d[3] | (dw & 0x0F) | 0x40

            elif (isinstance(day, str) and day.find(';') >= 0):
                d[3] = 0x40 | 0x80
                ds = 0x00
                dl = day.split(';')
                dl = dl[0:-1] if (not bool(dl[-1].strip())) else dl
                for i in dl:
                    ds = ds | (0x01 << int(i))
                d[8] = ds
        except:
            return {'error': 'INVALID_WEEKDAY'}
    elif 'day' in alarm:
        try:
            day = alarm['day']
            if day == 'EVERY_DAY':
                d[3] = 0x80

            else:
                dm = int(day)
                d[3] = (((dm // 10) & 0x03) << 4)
                d[3] = d[3] | ((dm % 10) & 0x0F)
        except:
            return {'error': 'INVALID_DAY_OF_MONTH'}
    else:
        d[3] = 0x80  # every day

`

does anyone know if there's a workaround to doing this? or if the source code can be patched to allow multiple days to be entered?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant