Commit Graph

4083 Commits

Author SHA1 Message Date
Maxim Prokhorov
3147508a19 sch: display calendar events in terminal 2024-09-16 00:32:24 +03:00
Maxim Prokhorov
d997cb2c20 sch: fix sun incompatible fmod arguments
use stdlib cmath when building on host
bump to unity 2.6.0 to fix isnan conflict with stdlib
2024-09-16 00:31:16 +03:00
Maxim Prokhorov
949611a47e sch: use native type for event time points
amends 8edb7b6333

- streamline event handling through time_point & to_minutes
  instead of sometimes seconds, sometimes minutes and sometimes both
- minor refactoring cref -> value for time point and durations function args
2024-09-16 00:28:28 +03:00
Maxim Prokhorov
c4f0d0101e telnet: flush timeout
commented, but not implemented
2024-09-15 18:37:07 +03:00
Maxim Prokhorov
6e14dee583 mqtt: config error should disconnect
logic error from the original impl
2024-09-15 18:37:07 +03:00
Maxim Prokhorov
c1090c2e71 sys: polled timer with and without ready-check
- simplified abstraction for overflowing clock.
  revert to core one (millis) for the mqtt loop
- fix duration type for readyflag, use native clock type directly
- drop redundant check 'now' ge 'until', since wrapping already implicitly does it
2024-09-15 18:37:07 +03:00
Maxim Prokhorov
737e76a736 mqtt: clean session flag 2024-09-14 01:51:32 +03:00
Maxim Prokhorov
3b6f0a5a67 light: token split as external func 2024-09-14 01:42:43 +03:00
Maxim Prokhorov
412fc58867 mqtt: attempt to reconfigure in the main loop
- flag is not automatically rescheduled, do so manually
- fix mdns _mqtt._tcp polling without timer being rescheduled
2024-09-14 01:42:43 +03:00
Maxim Prokhorov
9427286a9b webui: rebuild blobs 2024-09-10 16:54:30 +03:00
Maxim Prokhorov
9dd1ced846 mqtt: typo in sync client build 2024-09-10 16:41:28 +03:00
Maxim Prokhorov
d90318db05 mqtt: compare pointers, not contents 2024-09-10 16:35:18 +03:00
Maxim Prokhorov
67483f3f0e mqtt: not supported w/ the current build options 2024-09-10 16:20:11 +03:00
Maxim Prokhorov
00c972c5ac mqtt: branch under error check 2024-09-10 16:13:35 +03:00
Maxim Prokhorov
024b1362eb mqtt: allow empty payload 2024-09-10 16:11:28 +03:00
Maxim Prokhorov
d0c81a7381 settings: unused 2024-09-10 16:11:28 +03:00
Maxim Prokhorov
33e508f376 mqtt: sync callback fixes
since secure builds are disabled, these were not building for some time
2024-09-10 16:11:28 +03:00
Maxim Prokhorov
2059c69661 mqtt: typo 2024-09-10 16:11:28 +03:00
Maxim Prokhorov
ef7603db89 mqtt: settings topic
refactor mqtt root topic & topic handling, add external module for mqtt validation
check whether root topic contains #, error out when it is missing
check whether generic topics or suffixes contain # or +, error out when they are present

special handling for settings topic to pick a single level /+/ as a key and payload as a value
resolve #2617

tests for mqtt topic filtering and validation
2024-09-10 16:11:28 +03:00
Maxim Prokhorov
f2ebfb2c43 mqtt: notify about configuration errors
repurpose sv string as an ok flag. nil when ok, non-nil for error.

consistent return state when exiting settings callback w/ raii helper
differentiate between errors and reconnects
2024-09-10 16:11:28 +03:00
Maxim Prokhorov
8c35bf6fc5 rpc: reload action 2024-09-10 16:11:27 +03:00
Maxim Prokhorov
4000d3538c mqtt: use-json -> json
rename settings key and the corresponding build flags
2024-09-10 16:11:27 +03:00
Maxim Prokhorov
087c524b88 mqtt: sync mdns discovery with reconnect timer
remove extra overhead of a timer and syncing of the ::once() callback
remove extra setSetting when there are multiple mqtt brokers available
2024-09-10 16:11:27 +03:00
Maxim Prokhorov
6bc157dc8b mqtt: topic counter should not increase on replacement 2024-09-10 16:11:27 +03:00
Maxim Prokhorov
7ef81d0c96 mqtt: schedule mdns in the main thread
amend 510d68d079
2024-09-10 16:11:27 +03:00
Maxim Prokhorov
2dd05f2179 types: preserve existing sv pointer when slicing out-of-bounds
consistent with string_view::substr behaviour, without the 'throw'ing part
allow to distinguish sv pointing to nothing and sv originating from some
kind of string (here, result of a slice) by comparing its pointer with nullptr
2024-09-10 16:11:27 +03:00
Maxim Prokhorov
e7fb49c9f6 mqtt: get rid of fpstr 2024-09-08 18:29:34 +03:00
Maxim Prokhorov
1f93ce4f29 mqtt: settings refactoring & custom topics
- customize will topic qos and retain, ref. #2616
- allow to fully replace will and json topics.
  empty string means the default <root>/<name>
  replacement is taken as-is, after applying placeholders
- validate will and data topic structure before connecting
- validate {suf,post}fix as {suf,post}fix, not as topic
2024-09-08 01:11:56 +03:00
Maxim Prokhorov
919d348199 mqtt: varying reconnect time & fix boot delay
- track 'network' connection, not wifi specifically
  currently, there is only wifi, hence register a callback after sta event
- initial timer setup was counting from millis() zero when booting
  count from network connection instead, like it would after disconnect
  using timed flags for both skip and retry timers
2024-09-08 00:53:45 +03:00
Maxim Prokhorov
2bbf5da07b sys: polled flag in addition to a timer one
saving a bit of space by not including os timer struct
2024-09-07 17:28:38 +03:00
Maxim Prokhorov
4a2a2f2cb7 mqtt: use global retain flag for status
resolve #2616
2024-09-02 13:22:24 +03:00
Maxim Prokhorov
46f4eef428 pio: auth as literal string
ref. https://scons.org/doc/production/HTML/scons-user.html#f-Literal
> The specified string will be preserved as-is and not have construction variables expanded.

resolve #1498
2024-08-30 15:49:30 +03:00
Maxim Prokhorov
938cf45a3e core: bump version 2024-08-30 15:02:51 +03:00
Maxim Prokhorov
845d9892f2 ci: fixup release builds 2024-08-30 12:59:40 +03:00
Maxim Prokhorov
11358fd591 build: web support string without the embedded html 2024-08-30 12:54:38 +03:00
Maxim Prokhorov
4809038217 sch: search same & next hour only w/ local schedules 2024-08-30 12:03:11 +03:00
Maxim Prokhorov
96ac2b8060 ci: silly warnings 2024-08-29 17:30:10 +03:00
Maxim Prokhorov
a8f4faf903 sch: common cleanup for events 2024-08-29 17:26:56 +03:00
Maxim Prokhorov
30ae346a19 sch: events in mqtt & api
also changes internal timestamp to minutes instead of seconds
no mqtt publish, though, w/ retain defaults and no settings back-up
2024-08-29 17:26:56 +03:00
Maxim Prokhorov
eea56d7a0c sch: inconsistent DST <-> SDT transition when searching
- probe for double and missing hours when daylight saving time happens
  this is specific to local time schedules, utc should remain unaffected
- try to stay consistent with current pattern matching happening in loop
  when an hour is missing, simply skip to the next schedule
  when hour is repeated, make sure to recheck 'earlier' matches
- clean-up tests previously using very-very internal structs
  try to handle everything (sic) using `handle_*` functions
  from the corresponding namespace
2024-08-29 17:18:31 +03:00
Maxim Prokhorov
8aba3b8730 sch: event funcs must be implemented
leftover from original impl attempt
2024-08-24 23:42:58 +03:00
Maxim Prokhorov
cf4c656019 sch: parse already validated datetime inline
get rid of ptr calculations, use fixed offset & len on the string
cherry-pick char -> int conversion funcs from build .h

adjust datetime struct to be able to use aggregate ctor pre-c++17
2024-08-24 23:42:43 +03:00
Maxim Prokhorov
cfb83300d0 test: node does not like when gc closes files
> (node:1916) Warning: Closing file descriptor 31 on garbage collection
> (Use `node --trace-warnings ...` to show where the warning was created)
> (node:1916) [DEP0137] DeprecationWarning: Closing a FileHandle object on garbage collection is deprecated. Please close FileHandle objects explicitly using FileHandle.prototype.close(). In the future, an error will be thrown if a file descriptor is closed during garbage collection.
> (node:1916) Warning: Closing file descriptor 32 on garbage collection

per https://nodejs.org/api/deprecations.html#DEP0137
explicitly close after reading
2024-08-24 01:57:41 +03:00
Maxim Prokhorov
812ff5a800 pio: pin script replacement to framework version instead of platform
don't replace w/ git version
2024-08-24 01:06:01 +03:00
Maxim Prokhorov
b3bc053e52 pio: workaround py3.12+ syntax warnings
core 2.7.4 elf2bin patches w/ subprocess.run
temporary workaround for -latest, pending 3.2.0 release
2024-08-24 00:50:06 +03:00
Maxim Prokhorov
dd525f1770 sch: offset list elements 2024-08-23 23:32:43 +03:00
Maxim Prokhorov
90827850be relay: timer & pulse instead of toggle param
- replace 'pulse #ID TIME TOGGLE' TOGGLE param with 'timer #ID TIME'
- drop timers list command, use 'pulse' or 'timer' interchangeably
- adjust api to use new command string, allow mqtt & http to pulse without 'toggle'

amends 530b64b1
2024-08-23 23:01:01 +03:00
Maxim Prokhorov
37596eb436 sch: missing tests for zero offset 2024-08-23 21:30:20 +03:00
Maxim Prokhorov
dfc9fe693e sch: formatting 2024-08-23 21:24:27 +03:00
Maxim Prokhorov
7b83a48aa0 core: bump version 2024-08-22 23:41:31 +03:00