Commit Graph
343 Commits
Author SHA1 Message Date
Northern Man c570eead82 Delete main.ino.cpp (#1289) 2022-10-18 12:33:33 -05:00
Northern Man c45181ef7e Heltec SSD1306 Display Support (#1283)
My environment

[env:heltec-display]   ; Heltec ESP32 Board with SSD1306 display
platform = ${com.esp32_platform}
board = heltec_wifi_lora_32_V2
build_type = debug
monitor_filters = esp32_exception_decoder
board_build.partitions = min_spiffs.csv
extra_scripts = pre:scripts/omg_firmware_version.py
lib_deps =
  ${com-esp.lib_deps}
  ${libraries.wifimanager32}
  ${libraries.heltec}
;  ${libraries.m5stickcp}

build_flags =
  ${com-esp.build_flags}
  ${test_env.build_flags}
; *** OpenMQTTGateway Config ***
  '-UZmqttDiscovery'          ; disables MQTT Discovery
  '-DvalueAsATopic=true'
  '-DLOG_LEVEL=LOG_LEVEL_TRACE'
; *** OpenMQTTGateway Modules ***
  '-DZboardHELTEC="HELTEC"'
; *** Heltec Board Options ***
  '-DDEBUG_OLEDDISPLAY(...)=Serial.printf( __VA_ARGS__ )'
  '-DLOG_TO_LCD=true'         ; Enable log to LCD
  '-DLED_ERROR=2'
  '-DONBOARD_LED=25'          ; Onboard LED is GPIO 25 on the Heltec Board

monitor_port = /dev/cu.SLAB_USBtoUART
monitor_speed = 921600
upload_port = /dev/cu.SLAB_USBtoUART
upload_speed = 921600

1 - Set default LCD log level to WARNING
2 - Implemented a macro based displayPrint function that will be usable across different displays

- Added logo display when idle
- Fixed log-lcd mqtt function
- Enable OLED Display on Heltec Boards
2022-10-13 21:17:25 -05:00
Florian bf38bb52f6 Remove HM10 support (#1282)
Removing HM10 support as announced in the forum
2022-10-10 20:34:12 -05:00
Florian bbaabcc20d Fix missing lowpowermode attribute (#1281)
LowPowerMode is not used outside of the BT gateway, removing it from discoveyr fixes #1267
2022-10-10 18:30:46 -05:00
spinpwr 0ff3e98d91 Adding unique device names to HA dicovery (#1270)
* Adding unique device names to HA dicovery

Multiple devices of the same model got the same name in Home Assistant,
making the device list less informative when there are many of e.g. the
same sensor.
To over come this changed the function publishing discovery messages to
add the second half of the device mac address to the device name so it
becomes unique.

Issue: #1269
2022-10-10 13:10:33 -05:00
Sami Salonen e9449f567b Re-publish discovery topics on re-connect (via cfg, disabled by default) (#1274)
Resolves https://github.com/1technophile/OpenMQTTGateway/issues/1273

Signed-off-by: Sami Salonen <ssalonen@gmail.com>

Signed-off-by: Sami Salonen <ssalonen@gmail.com>
2022-09-26 15:49:02 -05:00
DigiH 765ec8415b Additional units from decoders (#1271) 2022-09-22 17:55:36 +02:00
DigiH 5c07e7ef9d CGDN1 classes & units (#1268) 2022-09-10 16:25:54 -05:00
Florian bb88f7e795 Add unit for Amphiro/Oras shower head (#1265) 2022-09-10 18:53:47 +02:00
DigiH b16fbcbef2 valueAsASubject to valueAsATopic inconsistency fix (#1260) 2022-09-03 18:51:52 -05:00
Bad 312ef858c1 Modify new BT config using MQTT (#1259)
* Move BTConfig_default to ZgatewayBT.ino as BTConfig_init()

* Remove unused function declaration & typo

* Move bleconnect outside of ifdef ESP32

* Add new parameters to json payload on MQTTtoBT/config
And move them to function BTConfig_fromJson()

new parameters: [presenceEnable, presenceTopic, presenceUseBeaconUuid, extDecoderEnable,
extDecoderTopic, filterConnectable, pubKnownServiceData,
pubUnknownServiceData, pubKnownManufData, pubUnknownManufData,
pubServiceDataUUID, pubBeaconUuidForTopic]

* Add ignoreWBlist as new configuration parameter

* Keep hasspresence keyword (do not use presenceEnable)

* Documentation

* Typos & Optimizations arround RemoveJsonPropertyIf

* Template for BT config update

* Ensure BTConfig.minRssi sign does not matter

* Report configuration change on topic /commands/BTtoMQTT/config

# Conflicts:
#	main/ZgatewayBT.ino

* Add BT config bool commands (init, load, erase & save) to persist config parameters

* Documentation

* Fix pre-compilation issue

* Fix Code Format

* Use Preference only for ESP32

* Update Doc
2022-09-03 15:08:07 -05:00
BadandFlorian 9120d06932 Mutate relevant compilation variables into config (#1256)
* Move minRssi in config_BT.h
Move var definitions next to compilation var definitions

* Introduce UseExtDecoder when is def MQTTDecodeTopic
Replace #ifdef MQTTDecodeTopic by #if UseExtDecoder

* Rename AttemptBLECOnnect to AttemptBLEConnect

* Create a struct (BTConfig_s) for BT configuration data
Create a default config for BTConfig_s (BTConfig_default) based on defines
Create a global variable (BTConfig) to hold live BT configuration data and initialize it
Move bleConnect to BTConfig

* Move BLEscanBeforeConnect in BTConfig

* Move BLEinterval in BTConfig

* Move PublishOnlySensors in BTConfig

* Move hassPresence in BTConfig

* Move minRssi into BTConfig

* Introduce presenceTopic into BTConfig

* Move MQTTDecodeTopic as extDecoderTopic into BTConfig

* Mutate UseExtDecoder as runtime var BTConfig.extDecoderTopic

* Remove ServicedataMinLength (unused)
Always declare AttemptBLEConnect & BLE_FILTER_CONNECTABLE

* Mutate BLE_FILTER_CONNECTABLE as runtime parameter BTConfig.filterConnectable

* Mutate pubKnownBLEServiceData as runtime var in BTConfig
Mutate pubUnknownBLEServiceData as runtime var in BTConfig
Mutate pubBLEManufacturerData as runtime var in BTConfig
Mutate pubUnknownBLEManufacturerData as runtime var in BTConfig
Mutate pubBLEServiceUUID as runtime var in BTConfig

* Mutate useBeaconUuidForTopic as runtime var in BTConfig
Mutate useBeaconUuidForPresence as runtime var in BTConfig

* Small optimization

* Formatting of config_BT

Co-authored-by: Florian <1technophile@users.noreply.github.com>
2022-08-20 14:28:25 -05:00
Amy Nagle b17247c049 Add missing macType param to NO_DEVICE_FOUND (#1253)
* Add missing macType param to NO_DEVICE_FOUND

* Simplify MAC address initialization
2022-08-09 05:19:19 -05:00
DigiH c4300a002f MQTT-MAC-IP-mDNS (#1245) 2022-07-19 12:10:51 -05:00
Bad 612c3f6322 Fix wrong base topic if gateway_name is changed (#1242)
* Rectify and match parameters sizes.
Increase mqtt_topic_max_size from 100/50 to 150/75 bytes

* Faster and safer compare in cmpToMainTopic()
2022-07-19 07:52:46 +02:00
Bad 7f4e27a664 Fix presence topic (#1238) 2022-07-17 04:59:40 -05:00
Grégoire SeuxandGrégoire Seux 537583e505 Configure LoRA gateway parameters at startup (#1234)
Without this (and without sending an initial MQTT message to the gateway
to configure it) messages are not necessarily received if parameters are
different from firmware defaults.

This patch helped at least two users:
- https://community.home-assistant.io/t/awesome-lora-soil-sensor/304351/23
- https://community.home-assistant.io/t/awesome-lora-soil-sensor/304351/18

Change-Id: Ia65ee5780b56f81fc73662c8779b79083805009b

Co-authored-by: Grégoire Seux <grego_openmqttgateway@familleseux.net>
2022-07-13 23:49:31 +02:00
DigiH a388f14e75 Publishing/receiving inconsistencies fix (#1229)
* Publishing/receiving inconsistencies

* General platformio.ini changes

General platformio.ini changes to allow for publishing/receiving settings to be defined in User_cofig.h instead of them only working if defined in the environments. Kept separate so far for discussion.
2022-07-01 07:17:02 -05:00
DigiH d62083a788 Lora band define (#1231) 2022-06-29 12:14:18 -05:00
Bad 77b022505c iBeacon: Flag to use UUID in topic or presence (and fixes) (#1226)
* Add useBeaconUuidForPresence flag (disabled by default)

* Change MQTTDecodeTopic to include only the sufixe

* Rename mac_address to topic and remove unnecessary variable mactopic

* Add useBeaconUuidForTopic flag (disabled by default)

* Fix jsonPublishing #ifdef -> #if

* Revert commit 02e2d03
2022-06-19 08:22:15 -05:00
h2zero 25b8123ff6 Add option to offload decoding to an external gateway over MQTT. (#1216)
* Add option to offload decoding to an external gateway over MQTT.

* Change decode topic and add to config_bt
2022-06-12 17:44:51 -05:00
steadramonandPaul 5b697e0306 Add Pilight limitProtocols support (#1223)
* Add ability to limit protocols

* Make serial feedback notice

Co-authored-by: Paul <steadramon@local>
2022-06-05 11:47:56 -05:00
Riceball LEE 8bced299dd feat: upgrade to IRremoteESP8266@2.8.2 (#1214) 2022-05-13 14:56:02 -05:00
Florian f4700be523 Fix discovery entity id for DT24 and LYWSD03MMC (#1210) 2022-05-04 06:08:20 -05:00
Florian 1916f62895 Auto discovery: Recover MiFlora discovery and remove model if from entity id (#1209)
* Recovery MiFlora discovery

after https://github.com/theengs/decoder/pull/107

* BREAKING remove model_id from entity id
2022-05-03 19:45:28 -05:00
h2zero 8d6acbee12 Add Switchbot support and discovery. (#995)
* Use a task to process immediate BLE actions to prevent MQTT disconnection if the action takes too long to complete.

* Add state_on and state_off parameters to createDiscovery
2022-04-30 09:16:06 -05:00
Joseph Perry 4b872bebbe Add ability to specify pulse length in ZactuatorONOFF (#1200)
* Add ability to specify pulse length in ZactuatorONOFF

Add an additional parameter to the MQTT message to control the actuatorONOFF pulse length e.g. `mosquitto_pub -t home/OpenMQTTGateway_MEGA/commands/MQTTtoONOFF -m '{"gpio":15,"cmd":"high_pulse","pulse_length":25}'`

* Simplify initialization of pulselength
2022-04-20 02:55:14 -05:00
Northern Man 8d902962e5 Update ZgatewayPilight.ino (#1202) 2022-04-17 05:52:18 -05:00
CY e43f7b3c15 Add Wifi BSSID as SYSdata (#1194)
* Add Wifi BSSID as SYSdata

Publish BSSID as a SYS sensor.
2022-03-30 23:56:34 -05:00
Florian fb56162c52 Remove servicedatauuid only when model is present (#1186)
keep it if we haven't decoded the message
2022-03-15 17:44:39 -05:00
Florian 3d2b15bd6c Remove auto discovery for Ibeacon, GAEN and MS CDP (#1183)
to avoid creating hundred of entities and devices in the controller due to their changing MAC addresses
2022-03-13 09:38:38 -05:00
Amy Nagle 0e45f7cca0 Fix discovery of connectable devices (#1173) 2022-03-04 16:22:35 -06:00
Florian e6c8b6763c Fix unit discovery for kg and kpa (#1171)
And improve the code
2022-02-25 05:51:59 -06:00
aaddame f7d8714984 Update ZgatewayRF2.ino (#1164)
kaku devices don't have an OFF  payload
2022-02-14 16:14:10 -06:00
Amy Nagle 257b39da81 Add support for XMWSDJ04MMC (#1162) 2022-02-09 16:16:41 -06:00
Florian 5b42e024e2 HASS auto discovery - Separate unit filtering from class (#1159) 2022-02-07 18:42:37 -06:00
Amy Nagle 457a8f48a3 Fix OpenHAB discovery (#1153)
* Fix OpenHAB discovery

* Add test for OpenHAB discovery
2022-02-03 16:23:32 -06:00
h2zeroandFlorian 0a8458f156 Update decoder version. (#1151)
* Update decoder version.

* Add new devices and sort list

Co-authored-by: Florian <1technophile@users.noreply.github.com>
2022-01-27 15:48:29 -06:00
Florian ef41546c94 ESP8266: Fix partial erase of connection settings (#1150)
* Fix partial erase of connection settings

#1149

* Update WM version and add disconnect
2022-01-27 15:47:55 -06:00
Florian a9342f743f Change unique id structure for HASS discovery (#1147)
Now:
"uniq_id":"882D777014C-pres"
before it was:
"uniq_id":"882D7770014C-CLEARGRASSTRHKPA-pres"
This will impact BLE and gateways entities
2022-01-27 15:47:29 -06:00
h2zero f8b4b3ca21 Add "mac_type" parameter to BLE connection commands. (#1146)
This allows for connecting to devices that do not use the MAC address type 0.
This also adds the logging of the "mac_type" so it is visible to users trying to connect to broadcasting devices.

Additionally this will allow for future connectable devices using a MAC address type other than 0 to be automatically connected to
when support is added for them, similar to LYWSD03MMC etc..
2022-01-25 06:19:50 -06:00
h2zero e838d3cee0 Remove std::string as the model id and use decoder enum. (#1143)
* Remove std::string as the model id and use decoder enum.

* Update decoder version

* Check model id is in decoder range when launching discovery.

* Add BLEconnect enum MIN/MAX
2022-01-24 20:09:15 -06:00
h2zero 91ab8dcdf1 Fix some incorrect timeouts when taking semaphores. (#1145) 2022-01-24 05:50:14 -06:00
h2zero 5dac1a7035 Add immediate parameter to BLE connection commands. (#1137)
* Add immediate parameter to BLE connection commands.

When sending a command to read/write a characteristic on a BLE server this adds a new parameter to cause the action to be
performed immediately. This will stop the scan in progress to perform the actions queued.

Example use:
```
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/config -m '{
  "ble_write_address":"AA:BB:CC:DD:EE:FF",
  "ble_write_service":"cba20d00-224d-11e6-9fb8-0002a5d5c51b",
  "ble_write_char":"cba20002-224d-11e6-9fb8-0002a5d5c51b",
  "ble_write_value":"TEST",
  "value_type":"STRING",
  "ttl":4,
  "immediate":true }'
```

Stop BLE processing when immeditate command sent.

* Use a shorter connection timeout.

* Update docs.

* Remove MQTT spam for connection retrys

* Prevent crashing when the normal connection process occurs at the same time as an immediate action.

* Use a semaphore to protect BLE device vector.
2022-01-23 19:47:17 -06:00
h2zero 8b40b68081 Use write with response non-response write is not available. (#1136)
If the BLE characteristic does not have write without response available this will default to using write with response.
2022-01-18 16:52:03 -06:00
Florian 749c1592b4 Add M5Tough board (#1135) 2022-01-17 19:22:26 -06:00
Northern Man 9546f43cd6 Behaviour when MQTT and/or Wifi is not available (#1126)
* Behaviour when MQTT and/or Wifi is not available

I was looking into why all my OpenMQTTGateway devices were not responding after a recent power failure and am speculating that the ESP32 was able to restart faster than my Wifi and MQTT Server was able to restart and resume operations.  And was thinking that a generic ESP.restart may be a reasonable approach with repeated Wifi and/or MQTT connection failures.

As mentioned here https://community.openmqttgateway.com/t/behaviour-when-mqtt-and-or-wifi-is-not-available/1747

Added new variable maxRetryWatchDog, which is the maximum number of mqtt or wifi connection attempts before restarting gateway device.
2022-01-17 16:16:43 -06:00
Florian 149aa40802 Increase MQTT Packet size to enable longer certificates to pass (#1134)
* Increase MQTT Packet size to enable longer certificates to pass

through mqtt for OTA

* Enable to define the mqtt packet size with an external macro
2022-01-17 07:05:02 -06:00
Florian 76b2f0a0e1 fix wifi manager portal missing parameters on esp8266 (#1132)
* fix wifi manager portal missing parameters on esp8266

on esp8266 with ZgatewayBT
Reducing the scope of the parameters on wifi manager for esp8266 to enable to enter properly the configuration
2022-01-15 18:28:11 -06:00
Florian 665078f5f5 Fix ir protocol name not correctly displayed on esp8266 (#1129) 2022-01-14 17:46:19 -06:00