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

Hassio - Home assistant 0.87.1 MQTT autodiscovery #361

Closed
kegra opened this issue Feb 16, 2019 · 11 comments

Comments

@kegra
Copy link

commented Feb 16, 2019

I am getting multiple errors using HA autodiscovery. and no devices appear under integrations.
i am using only the BT component.

Most of the errors are unable to parse JSON errors
Sat Feb 16 2019 19:26:42 GMT+0200 (EET)
Unable to parse JSON 5CCF7FFD89DAgatewayBT: '{{ value_json.message }}'

Sat Feb 16 2019 19:26:42 GMT+0200 (EET)
Unable to parse JSON 5CCF7FFD89DAgatewayBT: '5CCF7FFD89DAgatewayBT'

Sat Feb 16 2019 19:26:42 GMT+0200 (EET)
Unable to parse JSON 5CCF7FFD89DAgatewayBT: 'home/OpenMQTTGateway/BTtoMQTT/'

Sat Feb 16 2019 19:24:41 GMT+0200 (EET)
Unable to parse JSON 5CCF7FFD89DA: 'home/OpenMQTTGateway/LWT'

but also i get the following error.

Sat Feb 16 2019 19:26:42 GMT+0200 (EET)
Exception in async_discover_sensor when dispatching 'mqtt_discovery_new_sensor_mqtt': ({'state_topic': 'home/OpenMQTTGateway/BTtoMQTT/', 'name': 'gatewayBT', 'unique_id': '5CCF7FFD89DAgatewayBT', 'value_template': '{{ value_json.message }}', 'optimistic': False, 'retain': False, 'device': {'name': 'OpenMQTTGateway', 'manufacturer': 'OMG_community', 'sw_version': '0.9', 'identifiers': ['5CCF7FFD89DA']}, 'platform': 'mqtt'},)
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/mqtt/sensor.py", line 70, in async_discover_sensor
config = PLATFORM_SCHEMA(discovery_payload)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 267, in call
return self._compiled([], data)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 589, in validate_dict
return base_validate(path, iteritems(data), out)
File "/usr/local/lib/python3.6/site-packages/voluptuous/schema_builder.py", line 427, in validate_mapping
raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: extra keys not allowed @ data['optimistic']

I haven't used OpenMQTTGateway v9 with HA auto discovery in prior versions of HA bellow 0.87.1

@1technophile

This comment has been minimized.

Copy link
Owner

commented Feb 16, 2019

I didn't had problems with the previous hass version. I would need to upgrade and see if I reproduce your issue.

@1technophile

This comment has been minimized.

Copy link
Owner

commented Feb 18, 2019

Seems that there was some changes with the last HASS version on payload handling:
https://community.home-assistant.io/t/mqtt-automation-broke/99826/5

@Kedryn

This comment has been minimized.

Copy link

commented Feb 18, 2019

I have the same problem. It was working before, now i get the same errors.

@kegra

This comment has been minimized.

Copy link
Author

commented Feb 27, 2019

I didn't had problems with the previous hass version. I would need to upgrade and see if I reproduce your issue.

did you had the chance to try it out ?

@1technophile

This comment has been minimized.

Copy link
Owner

commented Feb 27, 2019

you will have news this week

@1technophile

This comment has been minimized.

Copy link
Owner

commented Mar 1, 2019

test done on 0.88.2
I see two devices on an OMG frame:

  • OMG binary sensor
  • gatewayBT

The state of binary sensor is connected, the state of gatewayBT is unknown.

I don't see errors in system logs

1technophile added a commit that referenced this issue Mar 1, 2019

@indy55

This comment has been minimized.

Copy link

commented Mar 9, 2019

Running the latest dev version which introduced discovery for mi flora and am receiving similar errors to the original post. Discovery is enabled in HA. Any thoughts?

2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'home/OpenMQTTGateway/LWT'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'OpenMQTTGateway'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'B4E62DD9E0A9'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'connectivity'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'online'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'offline'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'online'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9: 'offline'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9gatewayBT: 'home/OpenMQTTGateway/BTtoMQTT/'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9gatewayBT: 'gatewayBT'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9gatewayBT: 'B4E62DD9E0A9gatewayBT'
2019-03-08 17:35:42 WARNING (MainThread) [homeassistant.components.mqtt.discovery] Unable to parse JSON B4E62DD9E0A9gatewayBT: '{{ value_json.message }}'

@1technophile

This comment has been minimized.

Copy link
Owner

commented Mar 10, 2019

@indy55 you are using 0.88.2 ?

@indy55

This comment has been minimized.

Copy link

commented Mar 10, 2019

Using 0.89.1

@thewillwilson

This comment has been minimized.

Copy link

commented Mar 18, 2019

Also having the issue on 0.9.1beta

1technophile added a commit that referenced this issue Mar 19, 2019

remove optimistic and retain flag from auto discovery
#361

and add some json buffer size to avoid identifier lost

@1technophile 1technophile added this to the V0.9.1 milestone Mar 19, 2019

@1technophile

This comment has been minimized.

Copy link
Owner

commented Mar 19, 2019

should be ok now on v0.9.1beta

1technophile added a commit that referenced this issue Apr 14, 2019

v0.9.1 release (#382)
* Update IRRemoteESP8266 version to 2.5.5
factorize IR send signal function between the 2 types of receiving
Add new IRRemoteESP8266 protocols
replace pins on mega according schema
remove unecessaries spaces

* Update ESPilight library to 0.16.0

tfa protocol
kerui protocol

* Enable to switch HM1X led by a macro

#357
if //#define HM_BLUE_LED_STOP true uncommented
the HM1X led is off

* add log output through mqtt

#135
//#define subjectTRACEtoMQTT Base_Topic Gateway_Name "/log" //uncomment if you want to see traces on /log topic

* change default pin for rf receiver on ESP32

13 seems to don't work

* Add LORA gateway

first implementation of a lora gateway integration, tested on ttgo heltec boards with embedded lora module #356
Sending and receiving working

* Update README.md

* Update README.md

* add LORA gateway parameters

following lora api library def
https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md

* a first try for mi flora and mi jia auto discovery on hass

#361

* add LORA gateway auto discovery

* Some memory optimization for Arduino UNO following this thread:
https://community.openmqttgateway.com/t/arduino-uno-ethernet-shield-reboots-on-receiving-rf-signal-on-v-0-9/346/22
Rework led management to avoid use of global variables
and specify special JSON_MSG_BUFFER for arduino UNO
led can now be used for all the boards

generalize use of F macro
for memory optimization
change jsonbuffer calculation method
reduce pubsubclient max packet size for uno and nano

* Update README.md

* no need of going >67 as the code can handle only unsigned long at this time

* Add "repeat" field to RF JSON messages. (#372)

* update pubsubclient release to 2.7

* update irremote ESP8266 to 2.5.6

* publish discovery for sensors BLE once per run, add ble white and black list
Avoid publishing auto discovery on a time basis
publish auto discovery only one time per BLE sensor
add BLE white and black list implementation
set black list
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m '{"black-list":["012314551615","4C6577889C79","edfrgtyjulik"]}'
set white list
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m '{"white-list":["012314551615","4C65A5553C79","edfrgtyjulik"]}'

* remove optimistic and retain flag from auto discovery

#361

and add some json buffer size to avoid identifier lost

* correct json buffer size optimizations

* correct switch between modes raw versus message + protocol and add raw error codes (#374)

has been discussed here:
puuu/ESPiLight#39

* Add pilight repeater function

#369
set
#define repeatPilightwMQTT true
into config_RF.h to activate it

* add comment for sonoff rf bridge IR add

* Separate list of contributors for main file reading improvment

add also missing contributors

* correct deduplication issue with SRFB and improve OMG performance

by reducing the receivingMQTT call numbers
https://community.openmqttgateway.com/t/seeing-duplicated-messages/398/7

* Correct return always false when using HM10 and return number instead of char array for sensors values

* add message if wrong pubsubclient library used

* correct isue with using a different receiver with RFM69 than the default and ack issue

#376 #375

* revert thigh and tlow for sonoff rf bridge SRFBtoMQTT

#366

* correct wrong json object name

* change actuator default assignment

* change default input gpio pin

* add comment for sonoff pin

* Prepare 0.9.1 release

* Update CONTRIBUTING.md (#381)

1technophile added a commit that referenced this issue Apr 22, 2019

remove optimistic and retain flag from auto discovery
#361

and add some json buffer size to avoid identifier lost

ettiennegous added a commit to ettiennegous/OpenMQTTGateway that referenced this issue May 24, 2019

Master (#1)
* ESPilight support

Support for ESPilight - only recieve at the moment

* Adjustments for sending Pilight messages including RAW messages

https://manual.pilight.org/programs/debug.html
https://manual.pilight.org/programs/raw.html

Considering a RAW receive handler

* Fixup callback and loop for Pilight - catches all messages per loop

* Update Test_config.h

* Added ESPilight libs

* change default DHT pin for ESP32

following user feedback pin 16 works and 35 doesn't works

* correct impossibility to read value with HM10

1technophile#281 and make the code more flexible (deduct an offset from a key value instead of fixed offset)

*  Increased size of mqtt_pass to char[30]  (1technophile#288)

* Increased size of mqtt_pass to char[30]

* modified test_config.h too

* Fixed typo and added a little formatting (1technophile#290)

* Introduced WifiManager_ssid variable and documented user_config.h (1technophile#289)

* Commented user_config.h to clarify usage of WifiManager

* Introduced WifiManager_ssid variable

* Added changes to Test_config.h too

* multi gpio input module (1technophile#278)


* GPIOKeyCode module added

* Add Home Assistant MQTT room presence support (ESP32 only) (1technophile#294)

* Add Home Assistant MQTT room presence support

ESP32 only

* Publish refactoring (1technophile#298)

* factoring of the publishing function
* integration of json publishing to MQTT
* receiving and transcode json messages from mqtt
* replace the TRACE runtime condition by a buildtime one so as to decrease program size
* remove retainFlag parameter not necessary for the moment
* Increase the scope of tests for arduino mega and esp32
* Update arduinojson library to 5.13.3
* add macros to choose between simple or json publishing or both
* differentiate build test for ATmega2560
* correct wrong sprintf definition
* change IDE version for continuous integration
* let default warning level in arduino ide
* correct pins for ESP32
* reorganize user_config

* remove unecessary variable and PilighttoMQTT call

* Update README.md

* remove redundant code for home presence (1technophile#303)

* correct duplicate comments and code

* fix ESP32 ble (1technophile#304)

* remove redundant code for home presence

* hopefully fix ESP32 BLE hangs

* basic support for duplicate detection when JSON publishing is active

* correct double variable declaration and use arduino json implicit cast

* Update ZgatewayRF2.ino (1technophile#309)

Small fix for dimming with JSON payload.
switchType 0 OFF
switchType 1 ON
switchType 2 DIM
{
"switchType": 2,
"adress": "26494598",
"unit": 10,
"dim": 8
}

* correct sonoff rf bridge issue not communicating with RF module

1technophile#310

* update rc-switch (1technophile#313)

* more repeatSRFBwMQTT macro to pertinent config file

1technophile#295

* Update contributor list

* Add images

* add missing macro

* update esppilight lib

content of the library is not filtered on 433mhz only

* Mqtt discovery (1technophile#320)

* add mqtt discovery (compatibile with home assistant) with omg status binary sensor & bme280 sensor

* added mqtt discovery to Test_config.h for ESP32 (ESP8266 & other boards was not tested)

* include support for ESP8266 & arduino mega

* fix getting MAC for esp8266

* esp8266 fix

* make mqtt discovery functions functions more generic, readable and easy to use & extend

* make mqtt discovery functions functions more generic, readable and easy to use & extend PART 2

* remove the macro for each attribute and supposing that if there is a bme280 we expose all

* remove unecessaries files from pilight lib

* move MQTT_MAX_PACKET_SIZE to pubsubclient library

* per default deactivate mqtt ha discovery

* wdt tip add and presence detection improvments

-improve distance measurement
-add wdt prevent tip
-add conditional macro haroompresence

* Mqtt discovery for ha (1technophile#323)

* MQTT discovery factoring

* add DHT discovery

* BME topic macro change

* add sensors to ha discovery

* correct a comment typo 1technophile#327

* let the possibility at buildtime to don't publish service data

* reduce string usage

* change MQTT ONOFF actuator to ON OFF commands instead of true false

* add ZactuatorONOFF discovery

* add simple publishing for GPIO input

* Add RF switch and gateway discovery

* fix typo mistake

1technophile#324

* Fix compile error (1technophile#330) on rcswitch

Introduced with 1technophile#313

* Default pin for ESP8266 should be RX (1technophile#332)

* code cleanup and improvment (1technophile#339)

* replace string by char array comparison

* take mac adress from user_config for arduino ethernet shield

* remove code for managing HM10 with version < v6xx

* add sys measure call for arduino mega

* code size decrease and optim

* differentiate receiving and publishing mqtt for the new json option in user_config.h

1technophile#318 so as to avoid user with non modified controllers to have regression on receiving (per default receiving is activated for both json and simple and prioritary analysed for json)

* Storevalue after pub to avoid duplicates publishing in slow environment

* add per default Irremote protocol for arduino mega

as the mega can handle the list without memory issue (contrary to the uno)
set default mega pinout

* set default protocol with to IR NEC when no protocol is set on json

* differentiate ON OFF pin depending on board

* remove cleanFS macro and correct reseting when mqtt fail at start

clean FS now available from Arduino IDE tools menu (erase flash)

* add some image ressources

* add wifimanager config portal timeout

1technophile#350 in case of power outage so as to avoid to pop up the web page before the mqtt server restart

* add specific pinout for RF on arduino mega

* traces improvements, and code refactoring (RF315)

* enable the link between OMG status and its components

enable to have the link between OMG status and its sensors/gateways on the same place for HASS
https://community.openmqttgateway.com/t/v0-9beta-testers-needed/242/2?u=1technophile

* Update OpenMQTTGateway.ino

* put RF EMITTER PIN according to doc

* Update CONTRIBUTING.md

* Update IRRemoteESP8266 version to 2.5.5
factorize IR send signal function between the 2 types of receiving
Add new IRRemoteESP8266 protocols
replace pins on mega according schema
remove unecessaries spaces

* Update ESPilight library to 0.16.0

tfa protocol
kerui protocol

* Enable to switch HM1X led by a macro

1technophile#357
if //#define HM_BLUE_LED_STOP true uncommented
the HM1X led is off

* add log output through mqtt

1technophile#135
//#define subjectTRACEtoMQTT Base_Topic Gateway_Name "/log" //uncomment if you want to see traces on /log topic

* change default pin for rf receiver on ESP32

13 seems to don't work

* Add LORA gateway

first implementation of a lora gateway integration, tested on ttgo heltec boards with embedded lora module 1technophile#356
Sending and receiving working

* Update README.md

* Update README.md

* add LORA gateway parameters

following lora api library def
https://github.com/sandeepmistry/arduino-LoRa/blob/master/API.md

* a first try for mi flora and mi jia auto discovery on hass

1technophile#361

* add LORA gateway auto discovery

* Some memory optimization for Arduino UNO following this thread:
https://community.openmqttgateway.com/t/arduino-uno-ethernet-shield-reboots-on-receiving-rf-signal-on-v-0-9/346/22
Rework led management to avoid use of global variables
and specify special JSON_MSG_BUFFER for arduino UNO
led can now be used for all the boards

generalize use of F macro
for memory optimization
change jsonbuffer calculation method
reduce pubsubclient max packet size for uno and nano

* Update README.md

* no need of going >67 as the code can handle only unsigned long at this time

* Add "repeat" field to RF JSON messages. (1technophile#372)

* update pubsubclient release to 2.7

* update irremote ESP8266 to 2.5.6

* publish discovery for sensors BLE once per run, add ble white and black list
Avoid publishing auto discovery on a time basis
publish auto discovery only one time per BLE sensor
add BLE white and black list implementation
set black list
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m '{"black-list":["012314551615","4C6577889C79","edfrgtyjulik"]}'
set white list
mosquitto_pub -t home/OpenMQTTGateway/commands/MQTTtoBT/set -m '{"white-list":["012314551615","4C65A5553C79","edfrgtyjulik"]}'

* remove optimistic and retain flag from auto discovery

1technophile#361

and add some json buffer size to avoid identifier lost

* correct json buffer size optimizations

* correct switch between modes raw versus message + protocol and add raw error codes (1technophile#374)

has been discussed here:
puuu/ESPiLight#39

* Add pilight repeater function

1technophile#369
set
#define repeatPilightwMQTT true
into config_RF.h to activate it

* add comment for sonoff rf bridge IR add

* Separate list of contributors for main file reading improvment

add also missing contributors

* correct deduplication issue with SRFB and improve OMG performance

by reducing the receivingMQTT call numbers
https://community.openmqttgateway.com/t/seeing-duplicated-messages/398/7

* Correct return always false when using HM10 and return number instead of char array for sensors values

* add message if wrong pubsubclient library used

* correct isue with using a different receiver with RFM69 than the default and ack issue

1technophile#376 1technophile#375

* revert thigh and tlow for sonoff rf bridge SRFBtoMQTT

1technophile#366

* correct wrong json object name

* change actuator default assignment

* change default input gpio pin

* add comment for sonoff pin

* Prepare 0.9.1 release

* Add LORA to functions schema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.