1
1
2
2
# SinricPro (ESP8266 / ESP32 SDK)
3
- ## Version 2.2.4
3
+ ## Version 2.2.5
4
4
## Installation
5
5
6
6
### VS Code & PlatformIO:
24
24
## Examples
25
25
| PlatformIO| Arduino|
26
26
| :--:| :--:|
27
- | [ Switch] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/switch ) | [ Switch] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/Switch ) |
28
- | [ Doorbell] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/doorbell ) | [ Doorbell] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/doorbell ) |
29
- | - | [ GarageDoorOpener] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/GarageDoor ) |
30
- | [ TemperatureSensor] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/temperaturesensor ) | [ TemperatureSensor] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/temperaturesensor ) |
27
+ | [ Switch] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/switch ) | [ Switch] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/Switch ) |
28
+ | [ Doorbell] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/doorbell ) | [ Doorbell] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/doorbell ) |
29
+ | - | [ Lock] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/GarageDoor ) |
30
+ | [ TemperatureSensor] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/temperaturesensor ) | [ TemperatureSensor] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/temperaturesensor ) |
31
+ | [ TV] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/pio-examples/tv ) | [ TV] ( https://github.com/sinricpro/esp8266-esp32-sdk/tree/master/examples/tv )
31
32
32
33
---
33
34
@@ -160,6 +161,7 @@ Defined in [SinricProTV.h](/src/SinricProTV.h)
160
161
Callbacks
161
162
- [ onPowerState] ( #onpowerstate )
162
163
- [ onChangeChannel] ( #onchangechannel )
164
+ - [ onChangeChannelNumber] ( #onchangechannelnumber )
163
165
- [ onSkipChannels] ( #onskipchannels )
164
166
- [ onSelectInput] ( #onselectinput )
165
167
- [ onSetVolume] ( #onsetvolume )
@@ -448,6 +450,21 @@ Devices: | [TV](#tv) |
448
450
449
451
---
450
452
453
+ ### onChangeChannelNumber
454
+ ``` C++
455
+ bool onChangeChannelNumber (const String &deviceId, int channelNumber, String &channelName)
456
+ ```
457
+ | parameter | type| input value | output value | example |
458
+ |--|--|--|--|-- |
459
+ | `deviceId` | `const String&` | `deviceId` | --- | `"5d8f5ade41307b450335925d"` |
460
+ | `channelNumber` | `int` | `0..n` | --- | `4` |
461
+ |`channelName` | `String&` | --- | `channel name` | `"HBO"` (name of a tv channel) |
462
+ | `[return]`| `bool` | --- | `true`: request handled properly<br>`false`: error | `true` |
463
+
464
+ Devices: | [TV](#tv) |
465
+
466
+ ---
467
+
451
468
### onColor
452
469
```C++
453
470
bool onColor(const String &deviceId, byte &r, byte &g, byte &b)
@@ -723,19 +740,21 @@ bool sendBandsEvent(String bands, int level, String cause = "PHYSICAL_INTERACTIO
723
740
| ` bands ` | ` String ` | selected band | ` "BASS" ` , ` "MIDRANGE" ` ,` "TREBBLE" ` |
724
741
| ` level ` | ` int ` | report new band level | ` 0 ` ..` n ` |
725
742
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
743
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
726
744
727
745
Devices: | [ Speaker] ( #speaker ) |
728
746
729
747
---
730
748
731
749
### sendBrightnessEvent
732
750
``` C++
733
- void sendBrightnessEvent(int brightness, String cause = "PHYSICAL_INTERACTION")
751
+ bool sendBrightnessEvent (int brightness, String cause = "PHYSICAL_INTERACTION")
734
752
```
735
753
| parameter| type | description | value |
736
754
|--|--|--|:--:|
737
755
| `brightness` | `int` | brightness level | `0`..`100`|
738
756
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
757
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
739
758
740
759
Devices: | [Light](#light) |
741
760
@@ -749,59 +768,64 @@ bool sendChangeChannelEvent(String channelName, String cause = "PHYSICAL_INTERAC
749
768
| --| --| --| :--:|
750
769
| ` channelName ` | ` String ` | report new channel | example: ` "HBO" ` |
751
770
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
771
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
752
772
753
773
Devices: | [ TV] ( #tv ) |
754
774
755
775
---
756
776
757
777
### sendColorEvent
758
778
``` C++
759
- void sendColorEvent(byte r, byte g, byte b, String cause = "PHYSICAL_INTERACTION")
779
+ bool sendColorEvent (byte r, byte g, byte b, String cause = "PHYSICAL_INTERACTION")
760
780
```
761
781
| parameter| type | description | value |
762
782
|--|--|--|:--:|
763
783
| `r` | `byte` | red value | `0`..`255` |
764
784
| `g` | `byte` | green value | `0`..`255` |
765
785
| `b` | `byte` | blue value | `0`..`255` |
766
786
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
787
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
767
788
768
789
Devices: | [Light](#light) |
769
790
770
791
---
771
792
772
793
### sendColorTemperatureEvent
773
794
```C++
774
- void sendColorTemperatureEvent (int colorTemperature, String cause = "PHYSICAL_INTERACTION")
795
+ bool sendColorTemperatureEvent(int colorTemperature, String cause = "PHYSICAL_INTERACTION")
775
796
```
776
797
| parameter| type | description | value |
777
798
| --| --| --| :--:|
778
799
| ` colorTemperature ` | ` int ` | color temperature | ` 2200 ` , ` 2700 ` , ` 4000 ` , ` 5500 ` , ` 7000 ` |
779
800
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
801
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
780
802
781
803
Devices: | [ Light] ( #light ) |
782
804
783
805
---
784
806
785
807
### sendContactEvent
786
808
``` C++
787
- void sendContactEvent(bool detected, String cause = "PHYSICAL_INTERACTION")
809
+ bool sendContactEvent (bool detected, String cause = "PHYSICAL_INTERACTION")
788
810
```
789
811
| parameter| type | description | value |
790
812
|--|--|--|:--:|
791
813
| `detected` | `bool` | report contact state | `true`: contact is closed<br>`false`: contact is open |
792
814
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
815
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
793
816
794
817
Devices: | [ContactSensor](#contactsensor) |
795
818
796
819
---
797
820
798
821
### sendDoorbellEvent
799
822
```C++
800
- void sendDoorbellEvent (String cause = "PHYSICAL_INTERACTION")
823
+ bool sendDoorbellEvent(String cause = "PHYSICAL_INTERACTION")
801
824
```
802
825
| parameter| type | description | value |
803
826
| --| --| --| :--:|
804
827
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
828
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
805
829
806
830
Devices: | [ Doorbell] ( #doorbell ) |
807
831
@@ -815,6 +839,7 @@ bool sendMediaControlEvent(String mediaControl, String cause = "PHYSICAL_INTERAC
815
839
|--|--|--|:--:|
816
840
| `mediaControl` | `String` | report a media event | `"Play"`, `"Pause"`, `"Stop"`, `"StartOver"`, `"Previous"`, `"Next"`, `"Rewind"`, `"FastForward"` |
817
841
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
842
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
818
843
819
844
Devices: | [TV](#tv) | [Speaker](#speaker) |
820
845
@@ -828,19 +853,21 @@ bool sendModeEvent(String mode, String cause = "PHYSICAL_INTERACTION")
828
853
| --| --| --| :--:|
829
854
| ` mode ` | ` String ` | report new mode | ` "MOVIE" ` , ` "MUSIC" ` , ` "NIGHT" ` , ` "SPORT" ` , ` "TV" ` |
830
855
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
856
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
831
857
832
858
Devices: | [ Speaker] ( #speaker ) |
833
859
834
860
---
835
861
836
862
### sendMotionEvent
837
863
``` C++
838
- void sendMotionEvent(bool detected, String cause = "PHYSICAL_INTERACTION")
864
+ bool sendMotionEvent (bool detected, String cause = "PHYSICAL_INTERACTION")
839
865
```
840
866
| parameter| type | description | value |
841
867
|--|--|--|:--:|
842
868
| `detected` | `bool` | report motion event | `true`: motion detected<br>`false`: motion not detected (should be sent if motion not happens any longer) |
843
869
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
870
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
844
871
845
872
Devices: | [MotionSensor](#motionsensor) |
846
873
@@ -854,34 +881,38 @@ bool sendMuteEvent(bool mute, String cause = "PHYSICAL_INTERACTION")
854
881
| --| --| --| :--:|
855
882
| ` mute ` | ` bool ` | report mute event | ` true ` : device is muted <br >` false ` : device is unmuted |
856
883
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
884
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
857
885
858
886
Devices: | [ TV] ( #tv ) | [ Speaker] ( #speaker ) |
859
887
860
888
---
861
889
862
890
### sendPowerLevelEvent
863
891
``` C++
864
- sendPowerLevelEvent(int level, String cause="PHYSICAL_INTERACTION")
892
+ bool sendPowerLevelEvent (int level, String cause="PHYSICAL_INTERACTION")
865
893
```
866
894
| parameter| type | description | value |
867
895
|--|--|--|:--:|
868
896
| `level` | `int` | device power level | `0`..`100`|
869
897
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
898
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
870
899
871
900
Devices: | [Dimmable Switch](#dimmable-switch) | [Fan (non US)](#fan-non-us) |
872
901
873
902
---
874
903
875
904
### sendPowerStateEvent
876
905
```C++
877
- sendPowerStateEvent (bool state, String cause="PHYSICAL_INTERACTION")
906
+ bool sendPowerStateEvent(bool state, String cause="PHYSICAL_INTERACTION")
878
907
```
879
908
| parameter| type | description | value |
880
909
| --| --| --| --|
881
910
| ` state ` | ` bool ` | device state | ` true ` : device is on<br >` false ` : device is off |
882
911
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" `
912
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
883
913
884
914
Devices: | [ Switch] ( #switch ) | [ Dimmable Switch] ( #dimmable-switch ) | [ Light] ( #light ) | [ TV] ( #tv ) | [ Speaker] ( #speaker ) | [ Temperaturesensor] ( #temperaturesensor ) | [ Thermostat] ( #thermostat ) | [ MotionSensor] ( #motionsensor ) | [ ContactSensor] ( #contactsensor ) | [ Fan (non US)] ( #fan-non-us ) | [ Fan (US)] ( #fan-us ) |
915
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
885
916
886
917
---
887
918
@@ -893,6 +924,7 @@ bool sendRangeValueEvent(int rangeValue, String cause = "PHYSICAL_INTERACTION")
893
924
|--|--|--|:--:|
894
925
| `rangeValue` | `int` | report actual range value | `0`..`n` |
895
926
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
927
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
896
928
897
929
Devices: | [Fan (US)](#fan-us) | [Window AC Unit](#window-ac-unit) |
898
930
@@ -906,46 +938,50 @@ bool sendSelectInputEvent(String intput, String cause = "PHYSICAL_INTERACTION")
906
938
| --| --| --| :--:|
907
939
| ` input ` | ` String ` | report actual input | ` "AUX 1" ` , ` "AUX 2" ` , ` "AUX 3" ` , ` "AUX 4" ` , ` "AUX 5" ` , ` "AUX 6" ` , ` "AUX 7" ` , ` "BLURAY" ` , ` "CABLE" ` , ` "CD" ` , ` "COAX 1" ` ,` "COAX 2" ` , ` "COMPOSITE 1" ` , ` "DVD" ` , ` "GAME" ` , ` "HD RADIO" ` , ` "HDMI 1" ` , ` "HDMI 2" ` , ` "HDMI 3" ` , ` "HDMI 4" ` , ` "HDMI 5" ` , ` "HDMI 6" ` , ` "HDMI 7" ` , ` "HDMI 8" ` , ` "HDMI 9" ` , ` "HDMI 10" ` , ` "HDMI ARC" ` , ` "INPUT 1" ` , ` "INPUT 2" ` , ` "INPUT 3" ` , ` "INPUT 4" ` , ` "INPUT 5" ` , ` "INPUT 6" ` , ` "INPUT 7" ` , ` "INPUT 8" ` , ` "INPUT 9" ` , ` "INPUT 10" ` , ` "IPOD" ` , ` "LINE 1" ` , ` "LINE 2" ` , ` "LINE 3" ` , ` "LINE 4" ` , ` "LINE 5" ` , ` "LINE 6" ` , ` "LINE 7" ` , ` "MEDIA PLAYER" ` , ` "OPTICAL 1" ` , ` "OPTICAL 2" ` , ` "PHONO" ` , ` "PLAYSTATION" ` , ` "PLAYSTATION 3" ` , ` "PLAYSTATION 4" ` , ` "SATELLITE" ` , ` "SMARTCAST" ` , ` "TUNER" ` , ` "TV" ` , ` "USB DAC" ` , ` "VIDEO 1" ` , ` "VIDEO 2" ` , ` "VIDEO 3" ` , ` "XBOX" ` |
908
940
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
941
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
909
942
910
943
Devices: | [ TV] ( #tv ) |
911
944
912
945
---
913
946
914
947
### sendTargetTemperatureEvent
915
948
``` C++
916
- void sendTargetTemperatureEvent(float temperature, String cause = "PHYSICAL_INTERACTION")
949
+ bool sendTargetTemperatureEvent (float temperature, String cause = "PHYSICAL_INTERACTION")
917
950
```
918
951
| parameter| type | description | value |
919
952
|--|--|--|:--:|
920
953
| `temperature` | `float` | temperature | `-n`..`n` |
921
954
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
955
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
922
956
923
957
Devices: | [Thermostat](#thermostat) | [Window AC Unit](#window-ac-unit) |
924
958
925
959
---
926
960
927
961
### sendTemperatureEvent
928
962
```C++
929
- void sendTemperatureEvent (float temperature, float humidity = -1, String cause = "PERIODIC_POLL")
963
+ bool sendTemperatureEvent(float temperature, float humidity = -1, String cause = "PERIODIC_POLL")
930
964
```
931
965
| parameter| type | description | value |
932
966
| --| --| --| :--:|
933
967
| ` temperature ` | ` float ` | temperature | ` -n ` ..` n ` |
934
968
| ` humidity ` | ` float ` | (optional) humidity | ` 0 ` ..` +n ` <br >(` -1 ` if not supported) |
935
969
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PERIODIC_POLL" ` |
970
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
936
971
937
972
Devices: | [ Temperaturesensor] ( #temperaturesensor ) | [ Thermostat] ( #thermostat ) | [ Window AC Unit] ( #window-ac-unit ) |
938
973
939
974
---
940
975
941
976
### sendThermostatModeEvent
942
977
``` C++
943
- void sendThermostatModeEvent(String thermostatMode, String cause = "PHYSICAL_INTERACTION")
978
+ bool sendThermostatModeEvent (String thermostatMode, String cause = "PHYSICAL_INTERACTION")
944
979
```
945
980
| parameter| type | description | value |
946
981
|--|--|--|:--:|
947
982
| `thermostatMode` | `String` | thermostat mode | `"COOL"`, `"HEAT"`, `"AUTO"` |
948
983
| `cause` | `String` | (optional) describing why this is event ocours | `"PHYSICAL_INTERACTION"` |
984
+ | [return] | `bool` | `true` = event was sent, `false` event was not sent | `true` , `false` |
949
985
950
986
Devices: | [Thermostat](#thermostat) |
951
987
@@ -959,6 +995,7 @@ bool sendVolumeEvent(int volume, String cause = "PHYSICAL_INTERACTION")
959
995
| --| --| --| :--:|
960
996
| ` volume ` | ` int ` | report actual volume level| ` 0 ` ..` 100 ` |
961
997
| ` cause ` | ` String ` | (optional) describing why this is event ocours | ` "PHYSICAL_INTERACTION" ` |
998
+ | [ return] | ` bool ` | ` true ` = event was sent, ` false ` event was not sent | ` true ` , ` false ` |
962
999
963
1000
Devices: | [ TV] ( #tv ) | [ Speaker] ( #speaker ) |
964
1001
0 commit comments