just to be sure you placed this in your scripts.yaml without any other needed context right?
No, it’s just a service call. It is meant to be used in a script or automation. If you simply copy-pasted it directly under the script:
domain, that explains the cause of the error message.
If you want it to be part of a script, refer to the first example shown here.
thx a bunch,
it finally clicked a bit i had no clue this was just something that needed to be run once to create the items not to ‘provide upkeep’
I’ve solved my dimmer from the same provider too:
- platform: mqtt
schema: template
name: "Licht Eetkamer"
command_topic: "cloudapp/QBUSMQTTGW/UL1/UL4/setState"
state_topic: "cloudapp/QBUSMQTTGW/UL1/UL4/state"
state_template: >-
{% if value_json.properties.value > 0 %}
on
{% else %}
off
{% endif %}
command_on_template: >
{%- if brightness is defined -%}
{"id":"UL4","type":"state","properties":{"value":{{brightness | float | multiply(0.39215686) | round(0)}}}}
{%- else -%}
{"id":"UL4","type":"state","properties":{"value":100}}
{%- endif -%}
}
brightness_template: "{{ value_json.properties.value | float | multiply(2.55) | round(0) }}"
command_off_template: '{"id":"UL4","type":"state","properties":{"value":0}}'
the way i defined the brightness template should be available for the discovery route too right?
again! thx a bunch for the previous support
Didn’t you originally ask to have this done via MQTT Discovery and to create more than just an entity?
Because the example you posted doesn’t meet either of those original requirements.
I’ll try to make it a bit more clear:
'Unable to have anything more than an entity" with this I wanted to say that I can create entities for my physical devices but no more than that, no device for HA.
now that you have so kindly provided me with the script I have been able to take away my mqtt lights that were made trough the config I linked and made them trough your script, creating a light device and entity which work beautifully with the new area card since it can now be assigned to an area.
the last piece of code I linked if from a dimmer module of the same hardware, for which I want to do the same thing → instead of just having an entity without anything else, also make a nice device with an entity to match