Coder Social home page Coder Social logo

Comments (11)

proddy avatar proddy commented on June 23, 2024

I get the same error withg 3.7.0-dev.4. Looking into why.

from ems-esp32.

MichaelDvP avatar MichaelDvP commented on June 23, 2024

I get the same error withg 3.7.0-dev.4. Looking into why.

Maybe HA do not like numbers at the beginning of the name 3wayvalve (was ww3wayvalve, now dhw/3wayvalve)

from ems-esp32.

proddy avatar proddy commented on June 23, 2024

yes, so we need to change the code and replace for example value_json.dhw.3wayvalve with value_json.dhw['3wayvalve'].

in publish_ha_sensor_config() this code

        if (is_nested() && tag >= DeviceValueTAG::TAG_HC1) {
            snprintf(val_obj, sizeof(val_obj), "value_json.%s.%s", EMSdevice::tag_to_mqtt(tag), entity);
            snprintf(val_cond, sizeof(val_cond), "value_json.%s is defined and %s is defined", EMSdevice::tag_to_mqtt(tag), val_obj);
        } else {
            snprintf(val_obj, sizeof(val_obj), "value_json.%s", entity);
            snprintf(val_cond, sizeof(val_cond), "%s is defined", val_obj);
        }

replacing the 3 json_value's

Will you do it or shall i do after your PR?

from ems-esp32.

MichaelDvP avatar MichaelDvP commented on June 23, 2024

My dev is with changes in thermostat dhw and the HA compatibility options. If this is ok, i can add it and make a PR.
Does value_json.%s.%s become value_json[' %s.%s'] or an other notation, maybe value_json['%s'.'%s'] or value_json['%s']['%s']?

from ems-esp32.

proddy avatar proddy commented on June 23, 2024

"value_json.%s.%s" goes to "value_json.%s['%s']"
and
value_json.%s to value_json['%s']

I think! not at home, but we can always fix after. That's the beautify of dev builds, they're allowed to break ;-)

from ems-esp32.

MichaelDvP avatar MichaelDvP commented on June 23, 2024

Yes, that "value_json.%s['%s']" should work, but i've tried to allow also special chars in the tag. As we don't have them, stick to quote the entities only.
@bakboord4 Please check https://github.com/MichaelDvP/EMS-ESP32/releases
If this works for you, i'll make a PR.

from ems-esp32.

bakboord4 avatar bakboord4 commented on June 23, 2024

@MichaelDvP. I'll give it a try.

from ems-esp32.

bakboord4 avatar bakboord4 commented on June 23, 2024

@MichaelDvP
Result after a total restart of HA.

Logger: homeassistant.components.mqtt.mixins
Bron: components/mqtt/mixins.py:270
integratie: MQTT (documentatie, problemen)
Eerst voorgekomen: 20:03:11 (1 gebeurtenissen)
Laatst gelogd: 20:03:11

Error 'invalid template (TemplateSyntaxError: expected token 'end of print statement', got 'wayvalve') for dictionary value @ data['value_template']' when processing MQTT discovery message topic: 'homeassistant/binary_sensor/NefitCV/boiler_dhw_3wayvalve/config', message: '{'unique_id': 'boiler_dhw_3-way_valve_active', 'object_id': 'boiler_dhw_3-way_valve_active', 'name': 'dhw 3-wegklep actief', 'state_topic': 'NefitCV/boiler_data', 'payload_on': 'aan', 'payload_off': 'uit', 'value_template': "{{value_json.dhw.3wayvalve if value_json.dhw is defined and value_json.dhw.3wayvalve is defined else 'uit'}}", 'availability': [{'topic': 'NefitCV/boiler_data', 'value_template': "{{'online' if value_json.dhw is defined and value_json.dhw.3wayvalve is defined else 'offline'}}"}], 'availability_mode': 'all', 'device': {'identifiers': ['NefitCV-boiler'], 'name': 'NefitCV Boiler'}, 'platform': 'mqtt'}'

from ems-esp32.

bakboord4 avatar bakboord4 commented on June 23, 2024

@MichaelDvP after applying 3.7.0 dev.5

from ems-esp32.

proddy avatar proddy commented on June 23, 2024

Works for me in 3.7.0-dev-5

from ems-esp32.

bakboord4 avatar bakboord4 commented on June 23, 2024

@proddy @MichaelDvP. Good to hear that. Please continue, I do not have time at this moment to do a complete re-install.

from ems-esp32.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.