Creating an MQTT module for an analog signal

I would like to create a module in which there would be simple analog inputs on the principle of 0 and 1.

What is the easiest way to pair this with HA to make the state of the inputs visible?
For example, if I make something based on a microprocessor or raspberry where I get the number of the input then what needs to be done next ? Is there a script that can be uploaded to a raspberry for example or how to pair this most simply with a microprocessor ?
I would like to have about 100 inputs available so I was thinking of some multiplexing and boiling it down to a code number (the way the keypad works) and then sending the state of a given input number to the HA.
Or are there any such off-the-shelf devices or similar that can be converted?
They must work with switches (contact vibration).

What does that mean? It sounds like digital (0/1).

Why use MQTT at all? ESPhome + an ESP32 would make this relatively simple without custom development.

For of the shelf, look for “smart implant”:

If the vibration sensor has a switch output (e.g. an alarm sensor), just connect it to a door reed switch sensor of your choice.

You can go full custom and create a device that is fully discoverable via MQTT using HASS Discovery, but this is an advanced topic (I created a watering controller written in Python running 4x sensors and 3x pumps without ANY HASS config - just gets discovered and works).

If this helps, :heart: this post!

You’re right. The word analog can be a bit misleading.

Attached is a schematic diagram. Let’s assume that in the house I leave the standard circuit breakers such that they plug in series under 230V [europe], but I will use low voltage on them.
So to all the switches I’m running Ethernet instead of the usual voltage cables.

I tentatively assumed that on one wire of ethernet I would connect voltage +5V then on the other 7 wires I have 7 channels available. Under these channels I connect these switches (SW1-SW7). When pressed, the board knows which socket was pressed and now the topic is further about how to send this to the HA. I would like to base the whole house on just such switches for lights, etc. In addition, there is an option with a magnetic sensor that could tell if a particular door/window is closed/open.
I just don’t know how to create / what to base the electronics on so that, for example, having 100 such inputs (not necessarily on one such board - there could be more) and, for example, to code that SW1 is “switch-no-23” and under such a name I see it in Home Assistant and use it like a regular button to turn on some light. The actuators will probably be Shelly PM Pro.

As for the schematic itself, I still have a lot of doubts:

  1. The easiest way would be to feed 5V where you don’t need anything complicated to connect a channel under the legs of, for example, a microcontroller. There have been doubts that such a low voltage is not enough and there will be too much dropout. For example, in the diagram I indicated that some switch can be 60m / 196ft away. On top of that, the wire running from the channel + wire with voltage is already 120m / 390 ft ! In the house itself, rather, such distances would not be achievable, but I still have facilities outside.
  2. I thought to increase the voltage to 12V which would still be easy to power and it would be a very safe voltage, but I would already have to somehow rework the board, because such a voltage I will not apply to any uC although, anyway, at different distances there will be different resistances and it will be difficult to get into the range therefore, it will probably be necessary to make a section for the circuit to amplify and set the voltage to the exact value.
  3. Still another issue is to feed the voltage not with one, but with more wires at the expense of fewer channels. In most cases, however, this would not be a problem, and also the resistance could decrease.
  4. In the beginning I assumed that the currents would be minimal because there would be monostable switches everywhere, so instantaneous current and rarely the possibility of simultaneous presses, so I didn’t worry that one wire to supply voltage is not enough for more channels. The situation changed when I thought to add magnetic sensors to check, for example, the states of opening doors and windows where, in the case of a short circuit, the circuit will still be closed and on more than one channel.

There are many ways. Are you determined to have it all wired? Or can some be wifi?

I would like to base the idea solely on a wired system.
As for hardware, I have already solved most of the issues at least theoretically.
I am already preparing the design of a PCB, the heart of which will be a small Atmega, which in turn will transmit data to, for example, Raspberry.

Now just a question of how to program the Raspberry to work with HA? Some ready-made client and the ability to add port names that will be visible from the HA?
Like, for example, importing a Shelly device (4 channel + meter) entities appear with channel names, etc.
Here I do not know how to move on. Could you direct me somehow?

Frankly I would use an esp32 with esphome, and ethernet wired. Your job is then 95% done.