268 Commits

Author SHA1 Message Date
2111939863 docs: add changelog file 2023-01-10 09:51:23 +01:00
c9a3cc9e1d docs: change verson numbers
change modul versions
2023-01-10 09:50:36 +01:00
b399fcd524 test: add hooks
hooks for commit test and create changelog
2023-01-10 09:48:39 +01:00
89bbb4bb10 Merge branch 'main' of git.cooltux.net:/FHEM/mod-GardenaSmart 2023-01-10 09:29:11 +01:00
801a1a468f Merge pull request 'testing' (#80) from testing into main
Reviewed-on: #80
2022-12-22 08:04:47 +01:00
eddcb708ba Merge pull request 'dev' (#79) from dev into testing
Reviewed-on: #79
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-11-14 20:34:36 +01:00
c7073b24b4 Merge pull request 'patch-fix_commandref_spell' (#78) from patch-fix_commandref_spell into dev
Reviewed-on: #78
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-10-14 09:01:55 +02:00
fe97f0b203 [translaten] - add commandref translation 2022-09-18 08:52:43 +02:00
eebe13bb7b spellcheck + corrections 2022-09-06 14:34:38 +02:00
a6174d9982 Merge pull request 'dev' (#77) from dev into testing
Reviewed-on: #77
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-09-06 14:26:24 +02:00
aea73bb010 Merge pull request 'patch-wc_rest_valve_and_additinal_commandref' (#76) from patch-wc_rest_valve_and_additinal_commandref into dev
Reviewed-on: #76
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-09-06 13:32:06 +02:00
4cb9f2e50b Merge pull request 'dev' (#74) from dev into testing
Reviewed-on: #74
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-09-06 13:31:53 +02:00
b61c32a850 [enhancement] - commandref 2022-09-06 12:32:40 +02:00
8c49aaa079 [enhancement] - commandref 2022-08-30 16:23:00 +02:00
1f54fc7601 [test] commandref 2022-08-28 20:11:11 +02:00
3dd4796e14 [try] - to setup cmdref to set webui 2022-08-23 15:04:06 +02:00
7b188e3e41 [add] - wc reset valve, commandref 2022-08-23 11:24:21 +02:00
c2863d9998 Merge pull request 'patch-offline_status_startup_undefined' (#73) from patch-offline_status_startup_undefined into dev
Reviewed-on: #73
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-08-11 20:07:01 +02:00
76a7eeb4e5 [fix] - upper/lower case 2022-08-11 14:25:19 +02:00
388ae1635e [enhancement] - add resetvalveerrors ic24 2022-08-11 12:40:13 +02:00
d660366aea [final 2] - removed debug dumper code 2022-08-09 15:03:38 +02:00
8b9ce793cd [final] - removed debug print lines, cleanup code 2022-08-09 14:52:34 +02:00
71b435d90b [fix] - schedules + debug 2022-08-09 10:34:04 +02:00
c86cae74e6 [fix] - debug output 2022-08-09 10:13:57 +02:00
8ce2980356 [fix] - corret debug output 2022-08-09 10:04:43 +02:00
0d29721111 [fix] - commandref 2022-08-08 21:03:29 +02:00
ade45510ac [fix] - checkmethode delete reading if ist = soll 2022-08-08 20:59:57 +02:00
8a32c9f215 [fix] - removed "valveid" from reading 2022-08-08 20:47:19 +02:00
78b5731bbf [fix] - cast all propertie as string - fixed bulkupdateifchanged 2022-08-07 20:20:17 +02:00
0ee95be7be [fix] - delete unused schedules 2022-08-06 20:20:04 +02:00
bae27c39c1 [enhancement] - delete unused scheuldes from readings 2022-08-06 13:13:43 +02:00
47804c996b [enhancement] - commandref 2022-08-04 15:47:10 +02:00
6a7083f6ea [fix] - translation 2022-08-04 14:54:44 +02:00
ada7e2875c [fix] - fix 2022-08-04 14:44:35 +02:00
658f40e979 [enhancemend] - commandref 2022-08-04 14:39:44 +02:00
1c7097e476 [fix] - schedules_event incrementation 2022-08-04 10:34:48 +02:00
e363b45862 [fix] - eventhandler ic24 2022-08-04 10:31:11 +02:00
11c5e6650d [fix] - update event handled 2022-08-02 14:58:59 +02:00
4b998d19ab [fix] - show schedules_events_count fot non sensor devices
[fix] - remove _valve_ in non valve devices fpr schedules
2022-08-02 14:52:52 +02:00
7f6c7bc265 [log] - removed valve_names log line 2022-07-30 20:31:59 +02:00
e108afda5a add translation 2022-07-29 12:49:27 +02:00
a13c42f08c [add] - translations/commandref 2022-07-27 22:31:53 +02:00
df33172650 [add] - translation pumpe filter 2022-07-24 20:29:15 +02:00
f3d153726b [fix] - uninitialized 727 2022-07-24 20:25:21 +02:00
33a10d3756 [fix] - exists gegen defined 2022-07-22 21:08:02 +02:00
abcccefeb4 cleanup 2022-07-20 12:15:53 +02:00
f61e9d327b cleanup code, fix start up defined string 2022-07-19 20:20:20 +02:00
42afa2133e Merge pull request 'readd lost setter webinterface' (#72) from patch-dev_merge_failed_electronic_pressure_pump into dev
Reviewed-on: #72
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-07-13 21:18:55 +02:00
6aba15caca readd lost setter webinterface 2022-07-13 20:56:47 +02:00
1abf586f71 change version number
[Ticket: no]
2022-07-13 07:58:43 +02:00
f02da0c428 Merge branch 'dev' of git.cooltux.net:/FHEM/mod-GardenaSmart into dev 2022-07-13 07:21:20 +02:00
ebb342d83f Merge branch 'dev' of git.cooltux.net:/FHEM/mod-GardenaSmart 2022-07-13 07:20:49 +02:00
fd4ac49f59 Merge pull request '„FHEM/74_GardenaSmartDevice.pm“ ändern' (#71) from patch_electronic_pressure_pump_water_pump_name_mistake into dev
Reviewed-on: #71
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-07-12 20:16:02 +02:00
73d7c50db0 „FHEM/74_GardenaSmartDevice.pm“ ändern 2022-07-12 20:09:33 +02:00
f5ec4f699a Merge pull request 'patch_ic24' (#69) from patch_ic24 into dev
Reviewed-on: #69
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-07-12 19:35:25 +02:00
f2400a3949 Merge remote-tracking branch 'origin/dev' into patch_ic24 2022-07-12 19:25:35 +02:00
63443d75b4 [add] - cancleValve for conencted valvs only 2022-07-11 20:22:27 +02:00
5e87026852 [enhancement] - change stopSchedule and resumeSchedule setter to connected valves 2022-07-11 20:03:12 +02:00
c6ee46489b [fix] state , initial nearst fallback, paused untel readded - paused_until is UTC no bug -> calc for state in localtim 2022-07-10 20:16:07 +02:00
97540ef9c4 [fix] Garbage at end of string in strptime 2022-07-08 15:38:30 +02:00
0c75c89cf0 [enhancement] - scheudiles handling wc,ic24,pump, next schedule, permanenlty cloesd 2022-07-08 15:23:36 +02:00
93d0ef26c7 [fix] - schedules events 2022-07-08 15:11:18 +02:00
9b49c75317 [fix] scheduled count 2022-07-08 12:58:49 +02:00
5e10125a09 [fix] - readings schedules_event 2022-07-08 12:51:51 +02:00
9e389681f0 [fix] - scheduled 2022-07-08 12:48:51 +02:00
5b8bd75c55 [fix] - ifcondition schedules events 2022-07-08 12:47:49 +02:00
f77f49b7f1 fix 2022-07-08 12:46:20 +02:00
43d9356d8c fix 2022-07-08 12:43:14 +02:00
41c226536f fix 2022-07-08 12:42:32 +02:00
ec88be0b06 [enhancment] - schedules 2022-07-08 12:39:38 +02:00
8ce72c5ddc [NEW] - implementation schedules infos 2022-07-08 12:29:27 +02:00
9643a9074f [fix] - condition has_schedule 2022-07-07 20:05:16 +02:00
6f1eebcf48 [fix] - change condition has_schedule 2022-07-07 20:03:57 +02:00
c084fabc92 [fix] - try 2 fix nearst irrigateion > 1 year 2022-07-07 13:22:38 +02:00
188f5d3838 Merge pull request 'testing' (#67) from testing into main
Reviewed-on: #67
2022-07-01 10:41:17 +02:00
9d70fa238a Merge pull request 'dev' (#66) from dev into testing
Reviewed-on: #66
2022-07-01 10:29:53 +02:00
740effe531 Merge branch 'testing' into dev 2022-07-01 10:28:44 +02:00
426fb7c06a Merge branch 'main' into dev 2022-07-01 10:23:47 +02:00
782ad5f0a9 [fix] - tip fehler 2022-06-30 20:11:32 +02:00
41ef5cd10a Merge pull request '[fix] - setter procedure' (#64) from patch_pressure_pump_setlist into dev
Reviewed-on: #64
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-06-30 13:47:49 +02:00
6d684ade92 [fix] time piece 2022-06-30 13:09:32 +02:00
bc4b6eecf5 [fix] - timer paused >1 jahr 2022-06-30 11:37:01 +02:00
e8c2bd5183 [fix] - setter procedure 2022-06-29 20:32:00 +02:00
967ec86ea1 [fix] - state ohne plan , nicht listen 2022-06-29 13:38:08 +02:00
0086f52d74 [alpha] extendedState - fix empty reading + state ic24/wc 2022-06-29 12:26:39 +02:00
54b378d094 [visual] - lowercase not available 2022-06-29 09:00:03 +02:00
200751b72b [fix] - rollback 2022-06-28 23:09:33 +02:00
7cefd1c7e3 d 2022-06-28 23:08:35 +02:00
ee0c7fa4ba [test] set empty 2022-06-28 23:07:34 +02:00
ae3bf5f68a [fix] - readings 2022-06-28 23:03:42 +02:00
929bd705d5 [fix] - debug stuff - cleanup 2022-06-28 13:11:28 +02:00
9b1170a978 [fix] - debug stuff 2022-06-28 13:10:10 +02:00
2a5872002f [fix] - debug stuff 2022-06-28 13:08:47 +02:00
1b7670f8c5 [fix] - fixup debug code stuff 2022-06-28 13:06:32 +02:00
768a5a6d7a Merge pull request 'patch_lona' (#61) from patch_lona into dev
Reviewed-on: #61
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2022-06-26 19:28:11 +02:00
2eefd813df [fix] - cleanup 2022-06-26 19:24:38 +02:00
197dba15f1 fix - clear next_start 2022-06-26 19:22:06 +02:00
8dd9771033 [fix] - watering_next_start 2022-06-25 16:17:28 +02:00
a4a75ab016 patch lono. eventuell recrusive readings einbauen. waterpump rechtschreibfehler mit fixed 2022-06-25 12:58:59 +02:00
2cbe907db4 [alpha] - extendedstate: state fix if empty or not exists 2022-06-24 18:40:46 +02:00
af3dee00a2 [fix] - ix state 2022-06-24 13:57:07 +02:00
c9b1e470cb [ALPHA] extendetState - permanentyl paused 2022-06-24 13:20:54 +02:00
458edffa85 [alpha] extendetState : fix irrigation left zero value 2022-06-23 13:33:27 +02:00
930e42835b [alpha] excentedState - fix wc state, add irrigation duration 2022-06-23 12:55:03 +02:00
d3020ded2c [alpha] - extendetState - irrigation stuff 2022-06-23 12:45:31 +02:00
97f55e6122 debugg 2022-06-23 12:41:18 +02:00
9f9722ce9c fix 2022-06-23 12:36:17 +02:00
6ce4b352b4 fix 2022-06-23 12:15:10 +02:00
b3d39a6e58 debug stuff 2022-06-23 12:14:29 +02:00
3780befa7a dry run 2022-06-23 12:11:00 +02:00
c68f35c2e3 [alpha] - extendetState. fix state 2022-06-23 12:08:26 +02:00
830e5426d6 [alpha] extemdedState - fix state 2022-06-23 11:45:59 +02:00
bbf9919ad3 [alpa] extendetState: fix irrigatiopn time stuff 2022-06-23 11:37:04 +02:00
ab2e990ffb [alpha] - extendedState - fix next irrigation and irregation left time 2022-06-23 11:31:22 +02:00
df99f04e6e scheduling if event != '' 2022-06-16 20:15:29 +02:00
91ff06ea79 [extendetState] - fix up schedule 2022-06-16 16:04:05 +02:00
0c3db5e445 - 2022-06-14 10:22:14 +02:00
9ffde3bd2c [alpha] - ExtendetState: debugzeilen added 2022-06-14 10:18:16 +02:00
3326b134a8 [alpha] - extendedState 2022-06-13 21:01:39 +02:00
f8b4df8f4f blank 2022-06-13 20:46:41 +02:00
5bf618a9d2 [alpha] - extendetState | legacy: will be irrigeated by longest_duration, has scheduling check 2022-06-13 20:44:02 +02:00
9a85c9c20d [alpha] - extendetSate ic24 2022-06-12 20:08:11 +02:00
86b679ba97 [alpha] - extendetState, legacy enabled 2022-06-12 11:13:57 +02:00
a4865cae47 [alpha] - extendetState 2022-06-11 15:35:29 +02:00
b6a179a0ea [alpha] - extendedState 2022-06-11 15:24:44 +02:00
4666020263 [alpha] - extendedState 2022-06-11 15:23:15 +02:00
576569ea2d fixing symikolon 2022-06-11 14:12:02 +02:00
ae4e1b9990 fix 2022-06-11 14:09:42 +02:00
c07f757c4a [alpha] - implementation extend state with one more thing... 2022-06-11 14:07:16 +02:00
6faccfe564 fix boolean 2022-06-10 20:27:09 +02:00
9505316291 cleanup code 2022-06-10 20:24:42 +02:00
c76fd125ec first step state 2022-06-10 20:21:29 +02:00
3b28a20b33 add ventil check 2022-05-31 19:47:49 +02:00
8002d2a1d3 add state 2022-05-31 15:40:18 +02:00
6b475415cc copy & past error 2022-05-27 20:04:39 +02:00
40074a3db6 add lona readings 2022-05-27 11:44:59 +02:00
234607cb8d Merge pull request 'patch_waterpump' (#58) from patch_waterpump into dev
Reviewed-on: #58
2022-05-26 11:56:03 +02:00
9ad11bff63 lona 2022-05-17 20:53:37 +02:00
0849705c62 fix lona 2022-05-17 20:52:52 +02:00
6490c2f1be debug stuff 2022-05-17 20:13:45 +02:00
d863cbeff0 fix IODEV 2022-05-17 11:05:59 +02:00
d04ea31ef0 revert back 2022-05-17 10:36:02 +02:00
33fddad023 try 3 2022-05-17 10:24:47 +02:00
b620f87eb1 try 2 2022-05-17 10:19:15 +02:00
97b4147072 test 2022-05-17 10:04:33 +02:00
bd3d354786 test 2022-05-17 08:25:44 +02:00
b230baa776 fixing 2022-05-17 08:23:47 +02:00
4e6ca5f8ed test 2022-05-17 07:57:58 +02:00
d6e6847955 strgin format error 2022-05-14 23:02:12 +02:00
c551f4855f state format 2022-05-14 22:59:41 +02:00
15c791e1bf fix state 2022-05-08 12:41:04 +02:00
af2f803be5 add resetcall + state 2022-05-08 12:39:10 +02:00
91fd570896 long state 2022-05-07 20:29:16 +02:00
0e876c319c fux payload 2022-05-07 19:04:29 +02:00
122983580f fix payload 2022-05-07 18:08:47 +02:00
948f68515c change debug 2022-05-07 17:58:48 +02:00
528e8d5a08 vers push 2022-05-07 13:08:26 +02:00
b7adf6af6d add readingss and fix payload 2022-05-07 12:58:03 +02:00
a8646efe0d more debug 2022-05-06 18:58:45 +02:00
480946f9be Log Debug 2022-05-06 12:19:15 +02:00
c3620aa017 add log 2022-05-06 12:10:46 +02:00
43bf81053b operatingmode, leakagedetection and turnonpressure fix - ins blaue gerate 2022-05-05 12:27:21 +02:00
b4f5cef061 debug ausgabe 2022-05-05 09:20:56 +02:00
58333bef34 add setter 2022-05-03 22:23:00 +02:00
0beab4ec1d erste teste 2022-05-03 22:18:54 +02:00
4860b7e0ee fix log line 2022-05-03 21:37:41 +02:00
bf6734f44b initial 2022-05-01 20:54:44 +02:00
a1fad78c3b change debug stuff 2022-05-01 09:37:52 +02:00
bfbf2cced4 add second debug line for state 2022-04-28 20:21:44 +02:00
78e9906e6b fix debug 2022-04-28 20:17:22 +02:00
8d03f20b57 fix 2022-04-18 19:16:20 +02:00
83b9a4347c fix code 2022-04-18 19:08:28 +02:00
b197fbd082 simple quick code 2022-04-18 19:01:33 +02:00
29869e9b08 simple quick try 2022-04-18 18:52:58 +02:00
d61e06e0e9 debug lines 2022-04-17 15:44:05 +02:00
6b87b19f0d add valve_name and paused_untel for schedule 2022-04-14 16:42:18 +02:00
c87d8e9302 Merge pull request 'main' (#55) from main into testing
Reviewed-on: #55
2022-04-12 19:23:55 +02:00
8afc912ed5 Merge pull request 'dev' (#54) from dev into main
Reviewed-on: #54
2022-04-12 13:37:37 +02:00
b06c9acda3 Merge pull request 'patch_water_control' (#53) from patch_water_control into dev
Reviewed-on: #53
2022-04-12 13:35:44 +02:00
a56dfe6a2d round minutes in irregation 2022-04-12 08:40:40 +02:00
17b4182abe cleanup code 2022-04-10 13:07:59 +02:00
9f19ed8817 fix locales, todo change view of remaining time 2022-04-07 19:49:40 +02:00
cea5741fb8 fix open + paused 2022-04-07 14:49:23 +02:00
5661ef3e59 fix locales 2022-04-07 14:31:00 +02:00
40c7318992 some locales 2022-04-07 12:38:11 +02:00
9bdeb2ac19 add awake translation 2022-04-07 12:23:53 +02:00
e64f8fd0a4 fix 2022-04-07 12:10:15 +02:00
a193c6f814 tz offset in state 2022-04-07 11:44:19 +02:00
d1b04b6a74 cleanup 2022-04-07 11:30:51 +02:00
7113e9974e stateformat 2022-04-07 11:10:02 +02:00
7c074adbb9 fix 2022-04-05 11:42:07 +02:00
462311836f fix state_string variable 2022-04-05 11:40:24 +02:00
c553b8ef8f wc state 2022-04-05 11:36:29 +02:00
1d75b5cc77 fix state 2022-04-05 09:23:34 +02:00
f2c840bedc fix regex 2022-04-05 09:17:27 +02:00
b6c5f42acc add sensor2 2022-04-05 08:18:06 +02:00
65cbeba975 fix ic24 2022-03-29 16:35:58 +02:00
1498f73b10 Merge pull request 'devel' (#49) from devel into master
Reviewed-on: #49
2022-02-09 14:16:38 +01:00
8ae1510a71 Merge pull request 'patch-async_run_parseJson' (#48) from patch-async_run_parseJson into devel
Reviewed-on: #48
2022-02-09 14:11:54 +01:00
b211fe2b56 Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-09 13:51:13 +01:00
85c7b3fa0a change condition to grep wintermode
[Ticket: no]
2022-02-09 10:29:40 +01:00
65df7eb47b chage state to hibernate
[Ticket: no]
2022-02-08 11:56:46 +01:00
13e7e24911 change version number, ready for testing
[Ticket: no]
2022-02-01 18:42:33 +01:00
b61458a45e code clean up
after add run parseJSON function ansynchron

[Ticket: no]
2022-02-01 17:01:49 +01:00
673445e339 Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-01 13:05:53 +01:00
157e9fc58c Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-01 12:53:37 +01:00
f3f2688292 Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-01 12:42:32 +01:00
5d245d5a3d Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-01 11:53:08 +01:00
ddbe145179 Subject line (try to keep under 50 characters)
Multi-line description of commit,
feel free to be detailed.

[Ticket: X]
2022-02-01 10:59:08 +01:00
bd06f26248 no array reference found. will be check
[Ticket: no]
2022-02-01 09:54:42 +01:00
8e470ccbb6 Subject line (try to keep under 50 characters)
Undefined subroutine &FHEM::GardenaSmartBridge::CleanSubprocess called

[Ticket: none]
2022-02-01 09:26:31 +01:00
7c01c1c790 make parseJSON function to run asynchron
in installations wirh many of Gardena devices,
 the parseJSON function run long time.
 This patch make the parseJSON function asybchron

[Ticket: #47]
2022-01-31 19:43:20 +01:00
7b30b50cf1 Merge pull request 'ready for release' (#46) from testing into master
Reviewed-on: #46
2021-10-27 05:20:13 +02:00
32eec48ce6 Merge pull request 'devel' (#45) from devel into testing
Reviewed-on: #45
2021-09-27 11:24:53 +02:00
5545ac1370 Merge pull request 'change controlfile' (#44) from patch-controlfile into devel
Reviewed-on: #44
2021-09-27 11:24:20 +02:00
d186f3e6c8 change controlfile 2021-09-27 11:21:17 +02:00
eec264b014 Merge pull request 'devel' (#43) from devel into testing
Reviewed-on: #43
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-09-24 20:01:46 +02:00
ef1aabfcb0 Merge pull request 'patch-token_expired' (#42) from patch-token_expired into devel
Reviewed-on: #42
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-09-11 20:23:39 +02:00
c3882d4af3 enable hook on new system 2021-08-07 23:54:37 +02:00
43b4c15a9d debug, token fix 2021-08-07 23:52:29 +02:00
908fe4fc24 check also location_id so we have token and user id ... 2021-07-28 21:51:36 +02:00
b423fc73fc pump version 2021-07-28 21:45:10 +02:00
9abd0a9173 fix helper debug device for post 2021-07-28 21:42:34 +02:00
2af38efe42 Merge pull request 'devel' (#40) from devel into testing
Reviewed-on: #40
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-07-23 11:27:48 +02:00
8ddb1a8233 Merge pull request 'patch-power_timer' (#39) from patch-power_timer into devel
Reviewed-on: #39
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-07-21 13:59:10 +02:00
23be875b9f Merge branch 'devel' into patch-power_timer 2021-07-21 13:58:25 +02:00
5294e3fea5 Merge pull request 'patch-mower_timestamp_start' (#37) from patch-mower_timestamp_start into devel
Reviewed-on: #37
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-07-16 21:20:28 +02:00
12c4a0d5ba increase slider to 720 2021-07-16 20:26:16 +02:00
a856bb574a fix empty arg array condition 2021-07-13 17:22:03 +02:00
4e52ea8215 add payload propertie 2021-07-12 12:01:02 +02:00
70c54892d8 change to unixtimestamp 2021-06-28 20:11:18 +02:00
b49d7f643b Merge pull request 'patch-connect_problems' (#35) from patch-connect_problems into devel
Reviewed-on: #35
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-06-28 18:39:21 +02:00
cf93bbdba6 missed ); 2021-06-28 16:16:10 +02:00
9d3ddb088b add mower timestamp to readings 2021-06-28 16:11:39 +02:00
48e526a627 fixup 2021-06-28 10:47:51 +02:00
113dec6551 cleanup code 2021-06-28 10:27:23 +02:00
71ef5799c2 remove debug stuff 2021-06-28 10:24:43 +02:00
49ef217d12 initdone 2021-06-21 22:44:38 +02:00
65f031e1c2 fix2 2021-06-21 21:18:34 +02:00
10718f1355 hard post 2021-06-21 20:46:23 +02:00
b0638c525e test 2021-06-21 20:44:39 +02:00
0adf1d8a3b fix 2021-06-21 19:36:18 +02:00
a0d8125d32 payload 2021-06-21 19:31:51 +02:00
b6866dd44a add some function 2021-06-21 19:24:41 +02:00
6f0aee2a69 debug 2021-06-19 10:46:28 +02:00
acb482e37f pump version 2021-06-18 12:35:39 +02:00
0ec53ea1b3 add init 2021-06-17 19:17:27 +02:00
08bb518e9a removed debug stuff 2021-06-16 20:05:53 +02:00
33eb0ed012 comment Dumper 2021-06-16 10:11:52 +02:00
70af6fd6a3 fix token 404 2021-06-16 10:11:12 +02:00
44a251f7f7 fix json error by empty response, add test log level 1 for notify 2021-06-11 19:05:54 +02:00
0aa3e543a8 Merge pull request 'merge des aktuellen devel in testing' (#34) from devel into testing
Reviewed-on: #34
Reviewed-by: Sebastian Schwaz <sebastianschwarz@noreply@cooltux.net>
2021-06-09 13:53:43 +02:00
97b8a6edab fixing connection / interval / 404 error 2021-06-09 13:23:28 +02:00
a7d374596d Merge pull request 'patch-wintermode' (#33) from patch-wintermode into devel
Reviewed-on: #33
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-06-06 19:23:34 +02:00
cf0772f6ae missed 2 of them( notify ) 2021-06-05 18:47:43 +02:00
fe23d695e4 undo notify regexp 2021-06-05 18:42:27 +02:00
9a6241b608 Merge branch 'patch-wintermode' of ssh://git.cooltux.net:8222/FHEM/mod-GardenaSmart into patch-wintermode 2021-06-05 09:30:40 +02:00
065eebb858 comment dumper 2021-06-05 09:30:31 +02:00
1f3465a12d Merge branch 'devel' into patch-wintermode 2021-06-05 09:29:03 +02:00
e3674c401d change timestamp for schedule stop 2021-06-05 09:24:29 +02:00
1dde30c52c fix notifys, 2021-06-04 15:31:05 +02:00
5fb14e80a8 Merge pull request 'patch-watercontrol_schedule' (#32) from patch-watercontrol_schedule into devel
Reviewed-on: #32
Reviewed-by: Marko Oldenburg <marko@noreply@cooltux.net>
2021-05-30 22:37:05 +02:00
c9f212a641 variable fix 2021-05-29 22:08:35 +02:00
9e20c40b37 wintermode 2021-05-28 20:56:19 +02:00
e9d37309b4 versionsbump 2021-05-28 20:35:57 +02:00
613e14b4f9 cmdref 2021-05-28 20:28:07 +02:00
6e5f2d98b3 buttonconfing + cmdref 2021-05-28 20:25:44 +02:00
249f996db7 add stop/resume schedule 2021-05-26 20:37:39 +02:00
7 changed files with 6182 additions and 672 deletions

1
CHANGED Normal file
View File

@ -0,0 +1 @@
spellcheck + corrections

3972
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
###############################################################################
#
# Developed with Kate
# Developed with VSCodium and richterger perl plugin.
#
# (c) 2017-2021 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# (c) 2017-2022 Copyright: Marko Oldenburg (fhemdevelopment at cooltux dot net)
# All rights reserved
#
# Special thanks goes to comitters:
@ -57,7 +57,6 @@
package FHEM::GardenaSmartBridge;
use GPUtils qw(GP_Import GP_Export);
use strict;
use warnings;
use POSIX;
@ -66,11 +65,12 @@ use FHEM::Meta;
use HttpUtils;
my $missingModul = '';
eval "use Encode qw(encode encode_utf8 decode_utf8);1"
eval { use Encode qw /encode_utf8 decode_utf8/; 1 }
or $missingModul .= "Encode ";
# eval "use JSON;1" || $missingModul .= 'JSON ';
eval "use IO::Socket::SSL;1" or $missingModul .= 'IO::Socket::SSL ';
eval { use IO::Socket::SSL; 1 }
or $missingModul .= 'IO::Socket::SSL ';
# try to use JSON::MaybeXS wrapper
# for chance of better performance + open code
@ -78,15 +78,11 @@ eval {
require JSON::MaybeXS;
import JSON::MaybeXS qw( decode_json encode_json );
1;
};
if ($@) {
$@ = undef;
} or do {
# try to use JSON wrapper
# for chance of better performance
eval {
# JSON preference order
local $ENV{PERL_JSON_BACKEND} =
'Cpanel::JSON::XS,JSON::XS,JSON::PP,JSON::backportPP'
@ -95,10 +91,7 @@ if ($@) {
require JSON;
import JSON qw( decode_json encode_json );
1;
};
if ($@) {
$@ = undef;
} or do {
# In rare cases, Cpanel::JSON::XS may
# be installed but JSON|JSON::MaybeXS not ...
@ -106,10 +99,7 @@ if ($@) {
require Cpanel::JSON::XS;
import Cpanel::JSON::XS qw(decode_json encode_json);
1;
};
if ($@) {
$@ = undef;
} or do {
# In rare cases, JSON::XS may
# be installed but JSON not ...
@ -117,10 +107,7 @@ if ($@) {
require JSON::XS;
import JSON::XS qw(decode_json encode_json);
1;
};
if ($@) {
$@ = undef;
} or do {
# Fallback to built-in JSON which SHOULD
# be available since 5.014 ...
@ -128,20 +115,17 @@ if ($@) {
require JSON::PP;
import JSON::PP qw(decode_json encode_json);
1;
};
if ($@) {
$@ = undef;
} or do {
# Fallback to JSON::backportPP in really rare cases
require JSON::backportPP;
import JSON::backportPP qw(decode_json encode_json);
1;
}
}
}
}
}
};
};
};
};
};
## Import der FHEM Funktionen
#-- Run before package compilation
@ -205,6 +189,7 @@ sub Initialize {
$hash->{AttrFn} = \&Attr;
$hash->{AttrList} =
'debugJSON:0,1 '
. 'debugDEVICE:0,1 '
. 'disable:1 '
. 'interval '
. 'disabledForIntervals '
@ -234,9 +219,7 @@ sub Define {
my $name = shift @$aArg;
$hash->{BRIDGE} = 1;
$hash->{URL} =
AttrVal( $name, 'gardenaBaseURL',
'https://smart.gardena.com' )
. '/v1';
AttrVal( $name, 'gardenaBaseURL', 'https://smart.gardena.com' ) . '/v1';
$hash->{VERSION} = version->parse($VERSION)->normal;
$hash->{INTERVAL} = 60;
$hash->{NOTIFYDEV} = "global,$name";
@ -258,7 +241,7 @@ sub Undef {
my $hash = shift;
my $name = shift;
RemoveInternalTimer($hash);
RemoveInternalTimer( $hash, "FHEM::GardenaSmartBridge::getDevices" );
delete $modules{GardenaSmartBridge}{defptr}{BRIDGE}
if ( defined( $modules{GardenaSmartBridge}{defptr}{BRIDGE} ) );
@ -279,7 +262,8 @@ sub Attr {
if ( $attrName eq 'disable' ) {
if ( $cmd eq 'set' && $attrVal eq '1' ) {
RemoveInternalTimer($hash);
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
readingsSingleUpdate( $hash, 'state', 'inactive', 1 );
Log3 $name, 3, "GardenaSmartBridge ($name) - disabled";
}
@ -304,13 +288,15 @@ sub Attr {
if ( $cmd eq 'set' ) {
return 'Interval must be greater than 0'
if ( $attrVal == 0 );
RemoveInternalTimer($hash);
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
$hash->{INTERVAL} = $attrVal;
Log3 $name, 3,
"GardenaSmartBridge ($name) - set interval: $attrVal";
}
elsif ( $cmd eq 'del' ) {
RemoveInternalTimer($hash);
RemoveInternalTimer( $hash,
"FHEM::GardenaSmartBridge::getDevices" );
$hash->{INTERVAL} = 60;
Log3 $name, 3,
"GardenaSmartBridge ($name) - delete User interval and set default: 60";
@ -352,25 +338,21 @@ sub Notify {
@{$events} or grep /^DEFINED.$name$/,
@{$events} or grep /^MODIFIED.$name$/,
@{$events} or grep /^ATTR.$name.gardenaAccountEmail.+/,
@{$events} or grep /^DELETEATTR.$name.disable$/,
@{$events}
)
)
|| (
$devtype eq 'GardenaSmartBridge'
&& (
grep /^gardenaAccountPassword.+/,
@{$events}
)
)
|| ( $devtype eq 'GardenaSmartBridge'
&& ( grep /^gardenaAccountPassword.+/, @{$events} ) )
&& $init_done
);
getDevices($hash)
if (
$devtype eq 'Global'
&& (
grep /^DELETEATTR.$name.disable$/,
@{$events} or grep /^ATTR.$name.disable.0$/,
grep /^ATTR.$name.disable.0$/,
@{$events} or grep /^DELETEATTR.$name.interval$/,
@{$events} or grep /^ATTR.$name.interval.[0-9]+/,
@{$events}
@ -387,7 +369,6 @@ sub Notify {
)
)
{
InternalTimer( gettimeofday() + $hash->{INTERVAL},
"FHEM::GardenaSmartBridge::getDevices", $hash );
Log3 $name, 4,
@ -396,6 +377,7 @@ sub Notify {
return;
}
sub Get {
my $hash = shift // return;
my $aArg = shift // return;
@ -407,14 +389,15 @@ sub Get {
if ( lc $cmd eq 'debug_devices_list' ) {
my $device = shift @$aArg;
$hash->{helper}{debug_device} = $device;
Write($hash, undef, undef, undef, undef);
return undef;
} else {
Write( $hash, undef, undef, undef, undef );
return;
}
else {
my $list = "";
$list .= " debug_devices_list:"
.join( ',', @{ $hash->{helper}{deviceList} })
if ( AttrVal( $name, "debugJSON", "none") ne "none"
&& exists($hash->{helper}{deviceList}) );
$list .=
" debug_devices_list:" . join( ',', @{ $hash->{helper}{deviceList} } )
if ( AttrVal( $name, "debugDEVICE", "none" ) ne "none"
&& exists( $hash->{helper}{deviceList} ) );
return "Unknown argument $cmd,choose one of $list";
}
}
@ -424,13 +407,13 @@ sub Set {
my $aArg = shift // return;
my $name = shift @$aArg // return;
my $cmd = shift @$aArg // return qq{"set $name" needs at least one argument};
my $cmd = shift @$aArg
// return qq{"set $name" needs at least one argument};
# Das Argument für das Passwort, also das Passwort an sich darf keine = enthalten!!!
if ( lc $cmd eq 'getdevicesstate' ) {
getDevices($hash);
}
elsif ( lc $cmd eq 'gettoken' ) {
return "please set Attribut gardenaAccountEmail first"
@ -454,6 +437,15 @@ sub Set {
DeletePassword($hash);
}
elsif ( lc $cmd eq 'debughelper' ) {
return "usage: $cmd" if ( scalar( @{$aArg} ) != 2 );
my $new_helper = $aArg->[0];
my $new_helper_value = $aArg->[1];
Log3( $name, 5,
"[DEBUG] - GardenaSmartBridge ($name) - override helper $new_helper with $new_helper_value"
);
$hash->{helper}{$new_helper} = $new_helper_value;
}
else {
my $list = "getDevicesState:noArg getToken:noArg"
@ -475,12 +467,14 @@ sub Write {
my ( $session_id, $header, $uri, $method );
( $payload, $session_id, $header, $uri, $method, $deviceId, $service_id ) =
createHttpValueStrings( $hash, $payload, $deviceId, $abilities, $service_id );
createHttpValueStrings( $hash, $payload, $deviceId, $abilities,
$service_id );
HttpUtils_NonblockingGet(
{
url => $hash->{URL} . $uri,
timeout => 15,
incrementalTimeout => 1,
hash => $hash,
device_id => $deviceId,
data => $payload,
@ -496,8 +490,8 @@ sub Write {
"GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: secret!, DATA: secret!, METHOD: $method"
);
# Log3($name, 3,
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
# Log3($name, 3,
# "GardenaSmartBridge ($name) - Send with URL: $hash->{URL}$uri, HEADER: $header, DATA: $payload, METHOD: $method");
return;
}
@ -518,7 +512,7 @@ sub ErrorHandling {
Log3 $name, 4, "GardenaSmartBridge ($name) - Request: $data";
my $decode_json = eval { decode_json($data) };
my $decode_json = eval { decode_json($data) } if ( length($data) > 0 );
if ($@) {
Log3 $name, 3, "GardenaSmartBridge ($name) - JSON error while request";
}
@ -534,7 +528,6 @@ sub ErrorHandling {
1 );
if ( $err =~ /timed out/ ) {
Log3 $dname, 5,
"GardenaSmartBridge ($dname) - RequestERROR: connect to gardena cloud is timed out. check network";
}
@ -620,7 +613,7 @@ sub ErrorHandling {
}
if (
$data =~ /Error/
$data =~ /Error/ && $data !~ /lastLonaErrorCode/
|| ( defined($decode_json)
&& ref($decode_json) eq 'HASH'
&& defined( $decode_json->{errors} ) )
@ -698,6 +691,11 @@ sub ErrorHandling {
. $param->{code};
}
if ( !defined( $hash->{helper}{session_id} ) ) {
readingsSingleUpdate( $hash, 'token', 'none', 1 );
InternalTimer( gettimeofday() + 5,
"FHEM::GardenaSmartBridge::getToken", $hash );
}
readingsEndUpdate( $dhash, 1 );
Log3 $dname, 5,
@ -710,29 +708,58 @@ sub ErrorHandling {
return;
}
if (defined($hash->{helper}{debug_device})){
Log3 $name, 5, "GardenaSmartBridge DEBUG Device";
my @device_spec = ("name", "id", "category");
my $devJson=$decode_json->{devices};
my $output = '.:{ DEBUG OUTPUT for '.$devJson->{name}.' }:. \n';
elsif ( defined( $decode_json->{message} )
&& $decode_json->{message} eq 'Unauthorized' )
{
Log3 $name, 3,
"GardenaSmartBridge ($name) - Unauthorized -> fetch new token ";
getToken($hash);
return;
}
if ( defined( $hash->{helper}{debug_device} )
&& $hash->{helper}{debug_device} ne 'none' )
{
Log3 $name, 4, "GardenaSmartBridge DEBUG Device";
delete $hash->{helper}{debug_device};
my @device_spec = ( "name", "id", "category" );
my $devJson = $decode_json->{devices};
my $output = '.:{ DEBUG OUTPUT for ' . $devJson->{name} . ' }:. \n';
for my $spec (@device_spec) {
$output .= "$spec : $devJson->{$spec} \n";
}
#settings
$output .= '\n=== Settings \n';
my $i = 0;
for my $dev_settings ( @ { $devJson->{settings} } ) {
$output .= "[".$i++."]id: $dev_settings->{id} \n";
$output .= "name: $dev_settings->{name} ";
if (ref ($dev_settings->{value}) eq 'ARRAY'
|| ref ($dev_settings->{value}) eq 'HASH'){
for my $dev_settings ( @{ $devJson->{settings} } ) {
$output .= "[" . $i++ . "]id: $dev_settings->{id} \n";
$output .= "name: $dev_settings->{name} \n";
if ( ref( $dev_settings->{value} ) eq 'ARRAY'
|| ref( $dev_settings->{value} ) eq 'HASH' )
{
$output .= 'N/A \n';
} else {
}
else {
$output .= "value: $dev_settings->{value} \n";
}
}
$output .= '\n=== Abilities \n';
$i = 0;
for my $dev_settings ( @{ $devJson->{abilities} } ) {
$output .= "[" . $i++ . "]id: $dev_settings->{id} \n";
$output .= "name: $dev_settings->{name} \n";
}
$hash->{helper}{debug_device_output} = $output;
asyncOutput($param->{cl}, $hash->{helper}{debug_device_output});
asyncOutput( $param->{cl}, $hash->{helper}{debug_device_output} );
return;
}
readingsSingleUpdate( $hash, 'state', 'Connected', 1 )
@ -762,15 +789,21 @@ sub ResponseProcessing {
}
}
# print Dumper $decode_json;
if ( defined( $decode_json->{data} ) && $decode_json->{data}
&& ref($decode_json->{data}) eq 'HASH'
&& !defined( $hash->{helper}->{user_id})) {
if ( defined( $decode_json->{data} )
&& $decode_json->{data}
&& ref( $decode_json->{data} ) eq 'HASH'
&& !defined( $hash->{helper}->{user_id} ) )
{
$hash->{helper}{session_id} = $decode_json->{data}{id};
$hash->{helper}{user_id} = $decode_json->{data}{attributes}->{user_id};
$hash->{helper}{refresh_token} = $decode_json->{data}{attributes}->{refresh_token};
$hash->{helper}{refresh_token} =
$decode_json->{data}{attributes}->{refresh_token};
$hash->{helper}{token_expired} =
gettimeofday() + $decode_json->{data}{attributes}->{expires_in};
InternalTimer( $hash->{helper}{token_expired},
"FHEM::GardenaSmartBridge::getToken", $hash );
Write( $hash, undef, undef, undef );
Log3 $name, 3, "GardenaSmartBridge ($name) - fetch locations id";
@ -802,50 +835,35 @@ sub ResponseProcessing {
&& ref( $decode_json->{devices} ) eq 'ARRAY'
&& scalar( @{ $decode_json->{devices} } ) > 0 )
{
my @buffer = split( '"devices":\[', $json );
my ( $json, $tail ) = ParseJSON( $hash, $buffer[1] );
require SubProcess;
while ($json) {
my $subprocess =
SubProcess->new( { onRun => \&ResponseSubprocessing } );
$subprocess->{buffer} = $buffer[1];
Log3 $name, 5,
"GardenaSmartBridge ($name) - Decoding JSON message. Length: "
. length($json)
. " Content: "
. $json;
Log3 $name, 5,
"GardenaSmartBridge ($name) - Vor Sub: Laenge JSON: "
. length($json)
. " Content: "
. $json
. " Tail: "
. $tail;
my $pid = $subprocess->run();
if ( defined($tail) and $tail ) {
$decode_json = eval { decode_json($json) };
if ($@) {
Log3 $name, 5,
"GardenaSmartBridge ($name) - JSON error while request: $@";
if ( !defined($pid) ) {
Log3( $name, 1,
qq{GardenaSmartBridge ($name) - Cannot execute parse json asynchronously}
);
CleanSubprocess($hash);
readingsSingleUpdate( $hash, 'state',
'Cannot execute parse json asynchronously', 1 );
return;
}
Dispatch( $hash, $json, undef )
if ( $decode_json->{category} ne 'gateway' );
WriteReadings( $hash, $decode_json )
if ( defined( $decode_json->{category} )
&& $decode_json->{category} eq 'gateway' );
}
Log3( $name, 4,
qq{GardenaSmartBridge ($name) - execute parse json asynchronously (PID="$pid")}
);
( $json, $tail ) = ParseJSON( $hash, $tail );
$hash->{".fhem"}{subprocess} = $subprocess;
Log3 $name, 5,
"GardenaSmartBridge ($name) - Nach Sub: Laenge JSON: "
. length($json)
. " Content: "
. $json
. " Tail: "
. $tail;
}
InternalTimer( gettimeofday() + 1,
"FHEM::GardenaSmartBridge::PollChild", $hash );
return;
}
@ -855,12 +873,148 @@ sub ResponseProcessing {
return;
}
sub ResponseProcessingFinalFromSubProcessing {
my $hash = shift;
my $response = shift;
my $name = $hash->{NAME};
my @response = split '\|,', $response;
Log3( $name, 4,
qq{GardenaSmartBridge ($name) - got result from asynchronous parsing} );
my $decode_json;
Log3( $name, 4, qq{GardenaSmartBridge ($name) - asynchronous finished.} );
if ( scalar(@response) > 0 ) {
for my $json (@response) {
#################
$decode_json = eval { decode_json($json) };
if ($@) {
Log3 $name, 5,
"GardenaSmartBridge ($name) - JSON error while request: $@";
}
Dispatch( $hash, $json, undef )
if ( $decode_json->{category} ne 'gateway' );
WriteReadings( $hash, $decode_json )
if ( defined( $decode_json->{category} )
&& $decode_json->{category} eq 'gateway' );
}
}
return;
}
sub PollChild {
my $hash = shift;
my $name = $hash->{NAME};
if ( defined( $hash->{".fhem"}{subprocess} ) ) {
my $subprocess = $hash->{".fhem"}{subprocess};
my $response = $subprocess->readFromChild();
if ( defined($response) ) {
ResponseProcessingFinalFromSubProcessing( $hash, $response );
$subprocess->wait();
CleanSubprocess($hash);
}
Log3( $name, 4,
qq{GardenaSmartBridge ($name) - still waiting ($subprocess->{lasterror}).}
);
InternalTimer( gettimeofday() + 1,
"FHEM::GardenaSmartBridge::PollChild", $hash );
return;
}
return;
}
# ResponseSubprocessin muss in eine async ausgelagert werden
######################################
# Begin Childprozess
######################################
sub ResponseSubprocessing {
my $subprocess = shift;
my $buffer = $subprocess->{buffer};
my @response = ();
my ( $json, $tail ) = ParseJSON($buffer);
while ($json) {
if ( defined($tail) and $tail ) {
push @response, $json;
}
( $json, $tail ) = ParseJSON($tail);
}
$subprocess->writeToParent( join '|', @response );
return;
}
sub ParseJSON {
my $buffer = shift;
my $open = 0;
my $close = 0;
my $msg = '';
my $tail = '';
if ($buffer) {
for my $c ( split //, $buffer ) {
if ( $open == $close && $open > 0 ) {
$tail .= $c;
}
else {
if ( $c eq '{' ) {
$open++;
}
elsif ( $c eq '}' ) {
$close++;
}
$msg .= $c;
}
}
if ( $open != $close ) {
$tail = $msg;
$msg = '';
}
}
return ( $msg, $tail );
}
######################################
# End Childprozess
######################################
sub CleanSubprocess {
my $hash = shift;
my $name = $hash->{NAME};
delete( $hash->{".fhem"}{subprocess} );
Log3( $name, 4, qq{GardenaSmartBridge ($name) - clean Subprocess} );
}
sub WriteReadings {
my $hash = shift;
my $decode_json = shift;
# print Dumper $decode_json;
my $name = $hash->{NAME};
if ( defined( $decode_json->{id} )
@ -905,7 +1059,8 @@ sub WriteReadings {
{name} . '-' . $t,
$v
)
if ($decode_json->{abilities}[0]{properties}[$properties]{name} !~ /ethernet_status|wifi_status/ );
if ( $decode_json->{abilities}[0]{properties}[$properties]
{name} !~ /ethernet_status|wifi_status/ );
if (
(
$decode_json->{abilities}[0]{properties}
@ -931,10 +1086,9 @@ sub WriteReadings {
elsif ( $decode_json->{abilities}[0]{properties}
[$properties]{name} eq 'wifi_status' )
{
#TODO: read valies if bridge connected to wifi
readingsBulkUpdateIfChanged( $hash,
'wifi_status-ssid', $v->{ssid} )
if (ref($v->{ssid}) ne 'HASH');
if ( ref( $v->{ssid} ) ne 'HASH' );
readingsBulkUpdateIfChanged( $hash,
'wifi_status-mac', $v->{mac} );
readingsBulkUpdateIfChanged( $hash,
@ -967,23 +1121,25 @@ sub getDevices {
my $hash = shift;
my $name = $hash->{NAME};
RemoveInternalTimer($hash);
RemoveInternalTimer( $hash, "FHEM::GardenaSmartBridge::getDevices" );
if ( not IsDisabled($name) ) {
delete $hash->{helper}{deviceList};
my @list;
@list = devspec2array('TYPE=GardenaSmartDevice');
for my $gardenaDev (@list){
for my $gardenaDev (@list) {
push( @{ $hash->{helper}{deviceList} }, $gardenaDev );
}
if ( AttrVal( $name, 'gardenaAccountEmail', 'none' ) ne 'none'
&& ( defined( ReadPassword( $hash, $name ) ) ) )
{
Write( $hash, undef, undef, undef );
Log3 $name, 4,
"GardenaSmartBridge ($name) - fetch device list and device states";
"GardenaSmartBridge ($name) - fetch device list and device states";
} # fi gardenaAccountEmail
}
else {
readingsSingleUpdate( $hash, 'state', 'disabled', 1 );
Log3 $name, 3, "GardenaSmartBridge ($name) - device is disabled";
}
@ -1005,36 +1161,29 @@ sub getToken {
readingsSingleUpdate( $hash, 'state', 'get token', 1 );
delete $hash->{helper}{session_id}
if ( defined( $hash->{helper}{session_id} )
&& $hash->{helper}{session_id} );
if ( exists( $hash->{helper}{session_id} ) );
delete $hash->{helper}{user_id}
if ( defined( $hash->{helper}{user_id} ) && $hash->{helper}{user_id} );
if ( exists( $hash->{helper}{user_id} ) );
delete $hash->{helper}{locations_id}
if ( defined( $hash->{helper}{locations_id} )
&& $hash->{helper}{locations_id} );
# Write(
# $hash,
# '"sessions": {"email": "'
# . AttrVal( $name, 'gardenaAccountEmail', 'none' )
# . '","password": "'
# . ReadPassword( $hash, $name ) . '"}',
# undef,
# undef
# );
if ( exists( $hash->{helper}{locations_id} ) );
Write(
$hash,
'"data": {"type":"token", "attributes":{"username": "'
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
. '","password": "'
. ReadPassword( $hash, $name ) . '", "client_id":"smartgarden-jwt-client"}}',
. ReadPassword( $hash, $name )
. '", "client_id":"smartgarden-jwt-client"}}',
undef,
undef
);
Log3 $name, 4, '"data": {"type":"token", "attributes":{"username": "' . AttrVal( $name, 'gardenaAccountEmail', 'none' ) . '","password": "'
. ReadPassword( $hash, $name ) . '", "client_id":"smartgarden-jwt-client"}}';
Log3 $name, 4,
'"data": {"type":"token", "attributes":{"username": "'
. AttrVal( $name, 'gardenaAccountEmail', 'none' )
. '","password": "'
. ReadPassword( $hash, $name )
. '", "client_id":"smartgarden-jwt-client"}}';
Log3 $name, 3,
"GardenaSmartBridge ($name) - send credentials to fetch Token and locationId";
@ -1085,7 +1234,7 @@ sub ReadPassword {
Log3 $name, 3,
"GardenaSmartBridge ($name) - unable to read password from file: $err";
return undef;
return;
}
@ -1111,7 +1260,7 @@ sub ReadPassword {
else {
Log3 $name, 3, "GardenaSmartBridge ($name) - No password in file";
return undef;
return;
}
return;
@ -1129,59 +1278,6 @@ sub Rename {
return;
}
sub ParseJSON {
my $hash = shift;
my $buffer = shift;
my $name = $hash->{NAME};
my $open = 0;
my $close = 0;
my $msg = '';
my $tail = '';
if ($buffer) {
for my $c ( split //, $buffer ) {
if ( $open == $close && $open > 0 ) {
$tail .= $c;
Log3 $name, 5,
"GardenaSmartBridge ($name) - $open == $close and $open > 0";
}
elsif ( ( $open == $close ) && ( $c ne '{' ) ) {
Log3 $name, 5,
"GardenaSmartBridge ($name) - Garbage character before message: "
. $c;
}
else {
if ( $c eq '{' ) {
$open++;
}
elsif ( $c eq '}' ) {
$close++;
}
$msg .= $c;
}
}
if ( $open != $close ) {
$tail = $msg;
$msg = '';
}
}
Log3 $name, 5,
"GardenaSmartBridge ($name) - return msg: $msg and tail: $tail";
return ( $msg, $tail );
}
sub createHttpValueStrings {
my ( $hash, $payload, $deviceId, $abilities, $service_id ) = @_;
@ -1190,9 +1286,9 @@ sub createHttpValueStrings {
my $uri = '';
my $method = 'POST';
$header .= "\r\nAuthorization: Bearer $session_id"
if ( defined($hash->{helper}{session_id}) );
if ( defined( $hash->{helper}{session_id} ) );
$header .= "\r\nAuthorization-Provider: husqvarna"
if ( defined($hash->{helper}{session_id}) );
if ( defined( $hash->{helper}{session_id} ) );
# $header .= "\r\nx-api-key: $session_id"
# if ( defined( $hash->{helper}{session_id} ) );
@ -1200,20 +1296,23 @@ sub createHttpValueStrings {
$payload = '{}' if ( !defined($payload) );
if ( $payload eq '{}' ) {
$method = 'GET';
$method = 'GET' if ( defined( $hash->{helper}{session_id} ) );
$payload = '';
$uri .= '/locations?locatioId=null&user_id=' . $hash->{helper}{user_id}
if ( exists( $hash->{helper}{user_id} )
&& !defined( $hash->{helper}{locations_id} ) );
readingsSingleUpdate( $hash, 'state', 'fetch locationId', 1 )
if ( !defined( $hash->{helper}{locations_id} ) );
$uri .= '/auth/token' if ( !defined( $hash->{helper}{session_id} ) );
if ( exists( $hash->{helper}{user_id} )
&& !defined( $hash->{helper}{locations_id} ) );
$uri .= '/devices'
if (!defined($abilities)
&& defined( $hash->{helper}{locations_id} ) );
}
$uri = '/devices/'.InternalVal($hash->{helper}{debug_device}, 'DEVICEID', 0 ) if ( exists ($hash->{helper}{debug_device}));
$uri =
'/devices/' . InternalVal( $hash->{helper}{debug_device}, 'DEVICEID', 0 )
if ( defined( $hash->{helper}{debug_device} )
&& defined( $hash->{helper}{locations_id} ) );
$uri = '/auth/token' if ( !defined( $hash->{helper}{session_id} ) );
if ( defined( $hash->{helper}{locations_id} ) ) {
@ -1222,11 +1321,7 @@ sub createHttpValueStrings {
$method = 'PUT';
my $dhash = $modules{GardenaSmartDevice}{defptr}{$deviceId};
$uri .=
'/devices/'
. $deviceId
. '/settings/'
. $service_id
$uri .= '/devices/' . $deviceId . '/settings/' . $service_id
if ( defined($abilities)
&& defined($payload)
&& $abilities =~ /.*_settings/ );
@ -1262,7 +1357,11 @@ sub createHttpValueStrings {
. $deviceId
. '/abilities/'
. $abilities
. ( defined($valve_id) ? '/properties/watering_timer_'. $valve_id : '/command')
. (
defined($valve_id)
? '/properties/watering_timer_' . $valve_id
: '/command'
);
}
elsif (defined($abilities)
@ -1279,6 +1378,19 @@ sub createHttpValueStrings {
. $abilities
. '/properties/manual_watering_timer';
}
elsif (defined($abilities)
&& defined($payload)
&& $abilities eq 'watering_button_config' )
{
$method = 'PUT';
$uri .=
'/devices/'
. $deviceId
. '/abilities/watering'
. '/properties/button_config_time';
}
elsif (defined($abilities)
&& defined($payload)
@ -1463,9 +1575,9 @@ sub DeletePassword {
],
"release_status": "stable",
"license": "GPL_2",
"version": "v2.4.0",
"version": "v2.6.0",
"author": [
"Marko Oldenburg <leongaultier@gmail.com>"
"Marko Oldenburg <fhemdevelopment@cooltux.net>"
],
"x_fhem_maintainer": [
"CoolTux"

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,2 @@
UPD 2021-05-22_04:53:56 46135 FHEM/73_GardenaSmartBridge.pm
UPD 2021-05-22_04:54:14 51644 FHEM/74_GardenaSmartDevice.pm
UPD 2023-01-10_09:49:28 49646 FHEM/73_GardenaSmartBridge.pm
UPD 2023-01-10_09:49:45 126305 FHEM/74_GardenaSmartDevice.pm

36
hooks/commit-msg Executable file
View File

@ -0,0 +1,36 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".
# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
# This example catches duplicate Signed-off-by lines.
commit_msg=$(cat "${1:?Missing commit message file}")
test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
if ! echo "$commit_msg" | grep -Eq "^(build|chore|ci|docs|feat|feat!|fix|perf|refactor|revert|style|test)(\(.+\))?: .*$" ; then
echo "Invalid commit message"
exit 1
fi
echo "Commit message is valid!"

18
hooks/post-commit Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -eu
# destination of the final changelog file
OUTPUT_FILE=CHANGELOG.md
# generate the changelog
git --no-pager log --no-merges --format="### %s%d%n>%aD%n%n>Author: %aN (%aE)%n%n>Commiter: %cN (%cE)%n%n%b%n%N%n" > $OUTPUT_FILE
# prevent recursion!
# since a 'commit --amend' will trigger the post-commit script again
# we have to check if the changelog file has changed or not
res=$(git status --porcelain | grep -c ".\$OUTPUT_FILE$")
if [ "$res" -gt 0 ]; then
git add $OUTPUT_FILE
git commit --amend
echo "Populated Changelog in $OUTPUT_FILE"
fi