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 433toMQTT - put value to topic suggestion #833

Closed
AlexMKX opened this issue Dec 13, 2020 · 2 comments
Closed

Hassio 433toMQTT - put value to topic suggestion #833

AlexMKX opened this issue Dec 13, 2020 · 2 comments
Milestone

Comments

@AlexMKX
Copy link

AlexMKX commented Dec 13, 2020

The Home assistant doesn't have conditions for a values.
When I describe sensors like this :

  - platform: mqtt
    state_topic: "homeassistant/rfgw/433toMQTT"
    off_delay: 10
    payload_on: "999999"
    payload_available: "999999"
    name: "motion_sensor"
    value_template: "{{ value_json.value | string }}"

  - platform: mqtt
    state_topic: "homeassistant/rfgw/433toMQTT"
    off_delay: 10
    payload_on: "888888"
    payload_available: "888888"
    name: "door sensor"
    value_template: "{{ value_json.value | string }}"

i'm getting errors in log : " No matching payload found for entity "
Which caused by the same topic is used for 433toMQTT.
In order to solve this - the value (which identifies the specific 433 button) should be appended to topic. To have topics like these :
homeassistant/rfgw/433toMQTT/999999 for sensor 1
and
homeassistant/rfgw/433toMQTT/888888 for sensor 2 respectively

proposed patch :
ZgatewayRF.ino@void RFtoMQTT() :
change
pub(subjectRFtoMQTT, RFdata);
to

#  ifdef HASSIO_433_MQTT
      char subject [1024];
      memset(&subject,0,sizeof(subject));
      char mqttval[64];
      memset (mqttval,0,sizeof(mqttval));
      itoa(MQTTvalue,mqttval,10);
      sprintf(subject,"%s/%s",subjectRFtoMQTT,mqttval);
      pub(subject, RFdata);
# else
      pub(subjectRFtoMQTT, RFdata);
# endif 
@1technophile
Copy link
Owner

This is available here

//#define valueAsASubject true

By uncommenting the line.

We should add some docs about it.

@1technophile 1technophile added this to the v0.9.6 milestone Dec 13, 2020
@1technophile
Copy link
Owner

Added to the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants