# MQTT triggering notifications on deploy

**URL:** <https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163>\
**Category:** General\
**Created:** [10 January 2020 13:35 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163 "2020-01-10T13:35:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mobile\_NR\_Env](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Mobile\_NR\_Env](https://discourse.nodered.org/u/Mobile_NR_Env)\
**Post date:** [10 January 2020 13:35 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/1 "2020-01-10T13:35:07Z")

</div>

I'm sure this must be a simple fix.

HA trigger node automatically disconnect then reconnect on deploy of changes in Node Red.

Now I've switched to MQTT states for triggers. When I deploy changes on any flow, I'm getting notifications from the flows with MQTT states.

Had a bit of a search in the forum. Cant find a fix.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [10 January 2020 13:42 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/2 "2020-01-10T13:42:26Z")

</div>

Not sure what your problem is... that you are getting notifications or that you aren't... - anyway - you can set the deploy to only deploy changes to nodes rather than the whole flow so that the mqtt nodes shouldn't stop and start on a deploy if they haven't been edited.

---

<div class="post-metadata">

**Author:** ![Mobile\_NR\_Env](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Mobile\_NR\_Env](https://discourse.nodered.org/u/Mobile_NR_Env)\
**Post date:** [10 January 2020 13:50 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/3 "2020-01-10T13:50:11Z")

</div>

Will need to do partial deploys. Didnt know that was a feature!  
Sounds good.

Thanks D 👌

---

<div class="post-metadata">

**Author:** ![GravityRZ](https://avatars.discourse-cdn.com/v4/letter/g/839c29/32.png) [@GravityRZ](https://discourse.nodered.org/u/GravityRZ)\
**Post date:** [10 January 2020 14:28 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/4 "2020-01-10T14:28:43Z")

</div>

i had the same problem with domoticz.

i made a script in domoticz which sends out all the device states over MQTT  
i trigger that script with an inject node(which get's triggered when you deploy a complete new flow.

this way i always have the current state, even when i deploy a complete flow or when i restart node-red.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [10 January 2020 16:41 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/5 "2020-01-10T16:41:12Z")

</div>

> [@Mobile\_NR\_Env](#):
>
> When I deploy changes on any flow, I'm getting notifications from the flows with MQTT states.

On the publish for the triggers have you specified Retain? If so then any time a client connects and subscribes it will get sent those triggers. If you don't want to happen then don't set Retain when you publish them. In addition you will have to remove the already retained values for those topics. To do that, if you use mosquitto, you can do  
`mosquitto_pub -t "the/topic" -r -n`

---

<div class="post-metadata">

**Author:** ![Mobile\_NR\_Env](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Mobile\_NR\_Env](https://discourse.nodered.org/u/Mobile_NR_Env)\
**Post date:** [10 January 2020 21:32 UTC](https://discourse.nodered.org/t/mqtt-triggering-notifications-on-deploy/20163/6 "2020-01-10T21:32:42Z")

</div>

Will take a look! Thanks
